bacs
7 months ago
cheque
7 months ago
cod
3 months ago
paypal
1 month ago
class-wc-payment-gateway-cc.php
1 year ago
class-wc-payment-gateway-echeck.php
1 year ago
class-wc-payment-gateway-echeck.php
74 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class WC_Payment_Gateway_eCheck file. |
| 4 | * |
| 5 | * @package WooCommerce\Gateways |
| 6 | */ |
| 7 | |
| 8 | use Automattic\WooCommerce\Enums\PaymentGatewayFeature; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Class for eCheck Payment Gateway |
| 16 | * |
| 17 | * @since 2.6.0 |
| 18 | * @package WooCommerce\Classes |
| 19 | */ |
| 20 | class WC_Payment_Gateway_ECheck extends WC_Payment_Gateway { |
| 21 | |
| 22 | /** |
| 23 | * Builds our payment fields area - including tokenization fields for logged |
| 24 | * in users, and the actual payment fields. |
| 25 | * |
| 26 | * @since 2.6.0 |
| 27 | */ |
| 28 | public function payment_fields() { |
| 29 | if ( $this->supports( PaymentGatewayFeature::TOKENIZATION ) && is_checkout() ) { |
| 30 | $this->tokenization_script(); |
| 31 | $this->saved_payment_methods(); |
| 32 | $this->form(); |
| 33 | $this->save_payment_method_checkbox(); |
| 34 | } else { |
| 35 | $this->form(); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Outputs fields for entering eCheck information. |
| 41 | * |
| 42 | * @since 2.6.0 |
| 43 | */ |
| 44 | public function form() { |
| 45 | $fields = array(); |
| 46 | |
| 47 | $default_fields = array( |
| 48 | 'routing-number' => '<p class="form-row form-row-first"> |
| 49 | <label for="' . esc_attr( $this->id ) . '-routing-number">' . esc_html__( 'Routing number', 'woocommerce' ) . ' <span class="required">*</span></label> |
| 50 | <input id="' . esc_attr( $this->id ) . '-routing-number" class="input-text wc-echeck-form-routing-number" type="text" maxlength="9" autocomplete="off" placeholder="•••••••••" name="' . esc_attr( $this->id ) . '-routing-number" /> |
| 51 | </p>', |
| 52 | 'account-number' => '<p class="form-row form-row-wide"> |
| 53 | <label for="' . esc_attr( $this->id ) . '-account-number">' . esc_html__( 'Account number', 'woocommerce' ) . ' <span class="required">*</span></label> |
| 54 | <input id="' . esc_attr( $this->id ) . '-account-number" class="input-text wc-echeck-form-account-number" type="text" autocomplete="off" name="' . esc_attr( $this->id ) . '-account-number" maxlength="17" /> |
| 55 | </p>', |
| 56 | ); |
| 57 | |
| 58 | $fields = wp_parse_args( $fields, apply_filters( 'woocommerce_echeck_form_fields', $default_fields, $this->id ) ); |
| 59 | ?> |
| 60 | |
| 61 | <fieldset id="<?php echo esc_attr( $this->id ); ?>-cc-form" class='wc-echeck-form wc-payment-form'> |
| 62 | <?php do_action( 'woocommerce_echeck_form_start', $this->id ); ?> |
| 63 | <?php |
| 64 | foreach ( $fields as $field ) { |
| 65 | echo $field; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped |
| 66 | } |
| 67 | ?> |
| 68 | <?php do_action( 'woocommerce_echeck_form_end', $this->id ); ?> |
| 69 | <div class="clear"></div> |
| 70 | </fieldset> |
| 71 | <?php |
| 72 | } |
| 73 | } |
| 74 |