| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\PaymentGateways\Gateways\Stripe\Traits; |
| 4 |
|
| 5 |
/** |
| 6 |
* @since 2.19.0 |
| 7 |
*/ |
| 8 |
trait BECSMandateForm |
| 9 |
{ |
| 10 |
use FormFieldMarkup; |
| 11 |
|
| 12 |
public function getMandateFormHTML( $form_id, $args ) { |
| 13 |
ob_start(); |
| 14 |
|
| 15 |
$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
| 16 |
|
| 17 |
do_action( 'give_before_cc_fields', $form_id ); ?> |
| 18 |
|
| 19 |
<fieldset id="give_cc_fields" class="give-do-validate"> |
| 20 |
<legend> |
| 21 |
<?php esc_attr_e( 'Bank Account Info', 'give' ); ?> |
| 22 |
</legend> |
| 23 |
|
| 24 |
<?php |
| 25 |
if ( is_ssl() ) { |
| 26 |
?> |
| 27 |
<div id="give_secure_site_wrapper"> |
| 28 |
<span class="give-icon padlock"></span> |
| 29 |
<span><?php 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-bank-account-number-wrap" class="form-row form-row-responsive give-stripe-cc-field-wrap"> |
| 37 |
<label for="give-bank-account-number-field-<?php echo $id_prefix; ?>" class="give-label"> |
| 38 |
<?php esc_html_e( 'Bank Account', 'give' ); ?> |
| 39 |
<span class="give-required-indicator">*</span> |
| 40 |
<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'BSB Number and Account Number of your bank account.', 'give' ); ?>"></span> |
| 41 |
</label> |
| 42 |
<div |
| 43 |
id="give-stripe-becs-fields-<?php echo $id_prefix; ?>" |
| 44 |
class="give-stripe-becs-bank-account-field give-stripe-cc-field" |
| 45 |
data-hide_icon="<?php echo give_stripe_becs_hide_icon( $form_id ); ?>" |
| 46 |
data-icon_style="<?php echo give_stripe_get_becs_icon_style( $form_id ); ?>" |
| 47 |
></div> |
| 48 |
</div> |
| 49 |
<div class="form-row form-row-responsive give-stripe-becs-mandate-acceptance-text"> |
| 50 |
<?php |
| 51 |
if ( give_is_setting_enabled( give_get_option( 'stripe_becs_mandate_acceptance_option', 'enabled' ) ) ) { |
| 52 |
echo give_stripe_get_mandate_acceptance_text( 'becs' ); |
| 53 |
} |
| 54 |
?> |
| 55 |
</div> |
| 56 |
<?php |
| 57 |
/** |
| 58 |
* This action hook is used to display content after the Stripe BECS field. |
| 59 |
* |
| 60 |
* @param int $form_id Donation Form ID. |
| 61 |
* @param array $args List of additional arguments. |
| 62 |
* |
| 63 |
* @since 2.6.3 |
| 64 |
*/ |
| 65 |
do_action( 'give_stripe_after_becs_fields', $form_id, $args ); |
| 66 |
} |
| 67 |
?> |
| 68 |
</fieldset> |
| 69 |
<?php |
| 70 |
// Remove Address Fields if user has option enabled. |
| 71 |
$billing_fields_enabled = give_get_option( 'stripe_collect_billing' ); |
| 72 |
if ( ! $billing_fields_enabled ) { |
| 73 |
remove_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
| 74 |
} |
| 75 |
|
| 76 |
do_action( 'give_after_cc_fields', $form_id, $args ); |
| 77 |
|
| 78 |
$form = ob_get_clean(); |
| 79 |
|
| 80 |
return $form; |
| 81 |
} |
| 82 |
} |
| 83 |
|