2016-03-01 17:09:29 +00:00
|
|
|
<?php
|
2018-03-09 18:44:37 +00:00
|
|
|
/**
|
|
|
|
* Class WC_Payment_Gateway_eCheck file.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\Gateways
|
|
|
|
*/
|
|
|
|
|
2016-03-01 17:09:29 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-03-09 18:44:37 +00:00
|
|
|
* Class for eCheck Payment Gateway
|
2016-03-01 17:09:29 +00:00
|
|
|
*
|
|
|
|
* @since 2.6.0
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Classes
|
2016-03-01 17:09:29 +00:00
|
|
|
*/
|
2018-03-09 12:57:59 +00:00
|
|
|
class WC_Payment_Gateway_ECheck extends WC_Payment_Gateway {
|
2016-03-01 17:09:29 +00:00
|
|
|
|
2016-03-01 17:24:32 +00:00
|
|
|
/**
|
2016-05-26 10:48:25 +00:00
|
|
|
* Builds our payment fields area - including tokenization fields for logged
|
|
|
|
* in users, and the actual payment fields.
|
2018-03-09 12:53:10 +00:00
|
|
|
*
|
2016-03-01 17:24:32 +00:00
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
2016-03-01 17:09:29 +00:00
|
|
|
public function payment_fields() {
|
2016-06-24 11:39:13 +00:00
|
|
|
if ( $this->supports( 'tokenization' ) && is_checkout() ) {
|
2016-03-01 18:14:34 +00:00
|
|
|
$this->tokenization_script();
|
2016-05-10 14:05:55 +00:00
|
|
|
$this->saved_payment_methods();
|
2016-05-26 10:48:25 +00:00
|
|
|
$this->form();
|
2016-03-01 17:09:29 +00:00
|
|
|
$this->save_payment_method_checkbox();
|
2016-05-26 10:48:25 +00:00
|
|
|
} else {
|
|
|
|
$this->form();
|
2016-03-01 17:09:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Outputs fields for entering eCheck information.
|
2018-03-09 12:53:10 +00:00
|
|
|
*
|
2016-03-01 17:09:29 +00:00
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
public function form() {
|
2016-05-17 20:37:10 +00:00
|
|
|
$fields = array();
|
2016-03-01 17:09:29 +00:00
|
|
|
|
|
|
|
$default_fields = array(
|
|
|
|
'routing-number' => '<p class="form-row form-row-first">
|
2018-04-04 14:45:40 +00:00
|
|
|
<label for="' . esc_attr( $this->id ) . '-routing-number">' . esc_html__( 'Routing number', 'woocommerce' ) . ' <span class="required">*</span></label>
|
2016-05-17 19:24:11 +00:00
|
|
|
<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" />
|
2016-03-01 17:09:29 +00:00
|
|
|
</p>',
|
|
|
|
'account-number' => '<p class="form-row form-row-wide">
|
2018-04-04 14:45:40 +00:00
|
|
|
<label for="' . esc_attr( $this->id ) . '-account-number">' . esc_html__( 'Account number', 'woocommerce' ) . ' <span class="required">*</span></label>
|
2016-03-01 17:09:29 +00:00
|
|
|
<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" />
|
|
|
|
</p>',
|
|
|
|
);
|
|
|
|
|
|
|
|
$fields = wp_parse_args( $fields, apply_filters( 'woocommerce_echeck_form_fields', $default_fields, $this->id ) );
|
|
|
|
?>
|
|
|
|
|
2016-05-24 16:52:32 +00:00
|
|
|
<fieldset id="<?php echo esc_attr( $this->id ); ?>-cc-form" class='wc-echeck-form wc-payment-form'>
|
2016-03-01 17:09:29 +00:00
|
|
|
<?php do_action( 'woocommerce_echeck_form_start', $this->id ); ?>
|
|
|
|
<?php
|
2018-03-09 12:53:10 +00:00
|
|
|
foreach ( $fields as $field ) {
|
2018-03-09 18:44:37 +00:00
|
|
|
echo $field; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
2018-03-09 12:53:10 +00:00
|
|
|
}
|
2016-03-01 17:09:29 +00:00
|
|
|
?>
|
|
|
|
<?php do_action( 'woocommerce_echeck_form_end', $this->id ); ?>
|
|
|
|
<div class="clear"></div>
|
2018-03-09 12:53:10 +00:00
|
|
|
</fieldset>
|
|
|
|
<?php
|
2016-03-01 17:09:29 +00:00
|
|
|
}
|
|
|
|
}
|