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