2016-03-01 17:09:29 +00:00
|
|
|
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* eCheck Payment Gateway
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
* @package WooCommerce/Classes
|
|
|
|
* @author WooThemes
|
|
|
|
*/
|
2016-04-29 14:28:09 +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
|
|
|
/**
|
|
|
|
* Builds our payment fields area - including tokenization fields and the actualy payment fields.
|
|
|
|
* If tokenization is displayed, just the fields will be displayed.
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
2016-03-01 17:09:29 +00:00
|
|
|
public function payment_fields() {
|
|
|
|
$display_tokenization = $this->supports( 'tokenization' ) && is_checkout();
|
|
|
|
|
|
|
|
if ( $display_tokenization ) {
|
2016-03-01 18:14:34 +00:00
|
|
|
$this->tokenization_script();
|
2016-05-10 14:05:55 +00:00
|
|
|
$this->saved_payment_methods();
|
2016-03-01 17:09:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->form();
|
|
|
|
|
|
|
|
if ( $display_tokenization ) {
|
|
|
|
$this->save_payment_method_checkbox();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Outputs fields for entering eCheck information.
|
|
|
|
* @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">
|
|
|
|
<label for="' . esc_attr( $this->id ) . '-routing-number">' . __( '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">
|
|
|
|
<label for="' . esc_attr( $this->id ) . '-account-number">' . __( 'Account Number', 'woocommerce' ) . ' <span class="required">*</span></label>
|
|
|
|
<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 ) );
|
|
|
|
?>
|
|
|
|
|
|
|
|
<fieldset id="<?php echo esc_attr( $this->id ); ?>-cc-form" class='wc-echeck-form'>
|
|
|
|
<?php do_action( 'woocommerce_echeck_form_start', $this->id ); ?>
|
|
|
|
<?php
|
|
|
|
foreach ( $fields as $field ) {
|
|
|
|
echo $field;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php do_action( 'woocommerce_echeck_form_end', $this->id ); ?>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</fieldset><?php
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|