| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\PaymentGateways\Gateways\Stripe\Traits; |
| 4 |
|
| 5 |
trait SEPAMandateForm |
| 6 |
{ |
| 7 |
use FormFieldMarkup; |
| 8 |
|
| 9 |
public function getMandateFormHTML(int $form_id, array $args): string |
| 10 |
{ |
| 11 |
ob_start(); |
| 12 |
|
| 13 |
$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
| 14 |
|
| 15 |
do_action('give_before_cc_fields', $form_id); ?> |
| 16 |
|
| 17 |
<fieldset id="give_cc_fields" class="give-do-validate"> |
| 18 |
<legend> |
| 19 |
<?php |
| 20 |
esc_attr_e('IBAN Info', 'give'); ?> |
| 21 |
</legend> |
| 22 |
|
| 23 |
<?php |
| 24 |
if (is_ssl()) { |
| 25 |
?> |
| 26 |
<div id="give_secure_site_wrapper"> |
| 27 |
<span class="give-icon padlock"></span> |
| 28 |
<span><?php |
| 29 |
esc_attr_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
| 30 |
</div> |
| 31 |
<?php |
| 32 |
} |
| 33 |
|
| 34 |
if ($this->canShowFields()) { |
| 35 |
?> |
| 36 |
<div id="give-iban-number-wrap" class="form-row form-row-responsive give-stripe-cc-field-wrap"> |
| 37 |
<label for="give-iban-number-field-<?php |
| 38 |
echo $id_prefix; ?>" class="give-label"> |
| 39 |
<?php |
| 40 |
echo __('IBAN', 'give'); ?> |
| 41 |
<span class="give-required-indicator">*</span> |
| 42 |
<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php |
| 43 |
esc_attr_e( |
| 44 |
'The (typically) 16 digits on the front of your credit card.', |
| 45 |
'give' |
| 46 |
); ?>"></span> |
| 47 |
</label> |
| 48 |
<div |
| 49 |
id="give-stripe-sepa-fields-<?php |
| 50 |
echo $id_prefix; ?>" |
| 51 |
class="give-stripe-sepa-iban-field give-stripe-cc-field" |
| 52 |
data-hide_icon="<?php |
| 53 |
echo give_stripe_hide_iban_icon($form_id); ?>" |
| 54 |
data-icon_style="<?php |
| 55 |
echo give_stripe_get_iban_icon_style($form_id); ?>" |
| 56 |
data-placeholder_country="<?php |
| 57 |
echo give_stripe_get_iban_placeholder_country(); ?>" |
| 58 |
></div> |
| 59 |
</div> |
| 60 |
<div class="form-row form-row-responsive give-stripe-sepa-mandate-acceptance-text"> |
| 61 |
<?php |
| 62 |
if (give_is_setting_enabled(give_get_option('stripe_mandate_acceptance_option', 'enabled'))) { |
| 63 |
echo give_stripe_get_mandate_acceptance_text(); |
| 64 |
} |
| 65 |
?> |
| 66 |
</div> |
| 67 |
<?php |
| 68 |
/** |
| 69 |
* This action hook is used to display content after the Credit Card expiration field. |
| 70 |
* |
| 71 |
* Note: Kept this hook as it is. |
| 72 |
* |
| 73 |
* @since 2.5.0 |
| 74 |
* |
| 75 |
* @param int $form_id Donation Form ID. |
| 76 |
* @param array $args List of additional arguments. |
| 77 |
*/ |
| 78 |
do_action('give_after_cc_expiration', $form_id, $args); |
| 79 |
|
| 80 |
/** |
| 81 |
* This action hook is used to display content after the Credit Card expiration field. |
| 82 |
* |
| 83 |
* @since 2.5.0 |
| 84 |
* |
| 85 |
* @param int $form_id Donation Form ID. |
| 86 |
* @param array $args List of additional arguments. |
| 87 |
*/ |
| 88 |
do_action('give_stripe_after_cc_expiration', $form_id, $args); |
| 89 |
} |
| 90 |
?> |
| 91 |
</fieldset> |
| 92 |
<?php |
| 93 |
// Remove Address Fields if user has option enabled. |
| 94 |
$billing_fields_enabled = give_get_option('stripe_collect_billing'); |
| 95 |
if ( ! $billing_fields_enabled) { |
| 96 |
remove_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
| 97 |
} |
| 98 |
|
| 99 |
do_action('give_after_cc_fields', $form_id, $args); |
| 100 |
|
| 101 |
return ob_get_clean(); |
| 102 |
} |
| 103 |
} |
| 104 |
|