get_description() ) { echo '

' . wp_kses_post( $gateway->get_description() ) . '

'; } $payment_method_defaults = array( 'account-number' => '', 'exp-month' => '', 'exp-year' => '', 'csc' => '', ); %%IF SUPPORTS TEST-PAYMENT-METHOD%% // for the demo environment, display a notice and supply a default test payment method if ( $gateway->is_test_environment() ) { echo '

' . __( 'TEST MODE ENABLED', %%TEXT DOMAIN%% ) . '

'; $payment_method_defaults = array( 'account-number' => '4111111111111111', 'exp-month' => '1', 'exp-year' => date( 'Y' ) + 1, 'csc' => '123', ); } %%ENDIF SUPPORTS TEST-PAYMENT-METHOD%% %%IF SUPPORTS TOKENIZATION%% // tokenization is allowed if tokenization is enabled on the gateway $tokenization_allowed = $gateway->tokenization_enabled(); // on the pay page there is no way of creating an account, so disallow tokenization for guest customers if ( $tokenization_allowed && is_checkout_pay_page() && ! is_user_logged_in() ) { $tokenization_allowed = false; } $tokens = array(); $default_new_card = true; if ( $tokenization_allowed && is_user_logged_in() ) { $tokens = $gateway->get_payment_tokens( get_current_user_id() ); foreach ( $tokens as $token ) { if ( $token->is_default() ) { $default_new_card = false; break; } } } %%ENDIF SUPPORTS TOKENIZATION%% // load the payment fields template file wc_get_template( 'checkout/%%GATEWAY ID DASHERIZED%%-payment-fields.php', array( 'payment_method_defaults' => $payment_method_defaults, 'enable_csc' => $gateway->csc_enabled(), %%IF SUPPORTS TOKENIZATION%% 'tokens' => $tokens, 'tokenization_allowed' => $tokenization_allowed, 'tokenization_forced' => $gateway->tokenization_forced(), 'default_new_card' => $default_new_card, %%ENDIF SUPPORTS TOKENIZATION%% ), '', $gateway->get_plugin()->get_plugin_path() . '/templates/' ); } } %%IF SUPPORTS TOKENIZATION%% if ( ! function_exists( 'woocommerce_%%GATEWAY ID%%_show_my_payment_methods' ) ) { /** * Pluggable function to render the gateway tokenized credit card payment methods on * the My Account page * * @since 1.0.0 * @param %%GATEWAY CLASS%% $gateway gateway class */ function woocommerce_%%GATEWAY ID%%_show_my_payment_methods( $gateway ) { $user_id = get_current_user_id(); // get available saved payment methods $tokens = $gateway->get_payment_tokens( $user_id ); // load the My Account - My Cards template file wc_get_template( 'myaccount/%%GATEWAY ID DASHERIZED%%-my-cards.php', array( 'gateway' => $gateway, 'tokens' => $tokens, ), '', $gateway->get_plugin()->get_plugin_path() . '/templates/' ); // Add confirm javascript when deleting payment methods ob_start(); ?> $( 'a.js-wc-%%GATEWAY ID DASHERIZED%%-delete-payment-method' ).click( function( e ) { if ( ! confirm( '') ) { e.preventDefault(); } } ); get_description() ) { echo '

' . wp_kses_post( $gateway->get_description() ) . '

'; } $payment_method_defaults = array( 'account-number' => '', 'routing-number' => '', 'drivers-license-number' => '', 'drivers-license-state' => '', %%IF SUPPORTS CHECK-FIELD-ACCOUNT-TYPE%% 'account-type' => '', %%ENDIF SUPPORTS CHECK-FIELD-ACCOUNT-TYPE%% %%IF SUPPORTS CHECK-FIELD-CHECK-NUMBER%% 'check-number' => '', %%ENDIF SUPPORTS CHECK-FIELD-CHECK-NUMBER%% ); %%IF SUPPORTS TEST-PAYMENT-METHOD%% // for the demo environment, display a notice and supply a default test payment method if ( $gateway->is_test_environment() ) { echo '

' . __( 'TEST MODE ENABLED', %%TEXT DOMAIN%% ) . '

'; $payment_method_defaults = array( 'account-number' => '', 'routing-number' => '', 'drivers-license-number' => '1234', 'drivers-license-state' => 'MA', %%IF SUPPORTS CHECK-FIELD-ACCOUNT-TYPE%% 'account-type' => 'checking', %%ENDIF SUPPORTS CHECK-FIELD-ACCOUNT-TYPE%% %%IF SUPPORTS CHECK-FIELD-CHECK-NUMBER%% 'check-number' => '1', %%ENDIF SUPPORTS CHECK-FIELD-CHECK-NUMBER%% ); } %%ENDIF SUPPORTS TEST-PAYMENT-METHOD%% %%IF SUPPORTS TOKENIZATION%% // tokenization is allowed if tokenization is enabled on the gateway $tokenization_allowed = $gateway->tokenization_enabled(); // on the pay page there is no way of creating an account, so disallow tokenization for guest customers if ( $tokenization_allowed && is_checkout_pay_page() && ! is_user_logged_in() ) { $tokenization_allowed = false; } $tokens = array(); $default_new_account = true; if ( $tokenization_allowed && is_user_logged_in() ) { $tokens = $gateway->get_payment_tokens( get_current_user_id() ); foreach ( $tokens as $token ) { if ( $token->is_default() ) { $default_new_account = false; break; } } } %%ENDIF SUPPORTS TOKENIZATION%% // load the payment fields template file wc_get_template( 'checkout/%%GATEWAY ID DASHERIZED CHECKS%%-payment-fields.php', array( 'payment_method_defaults' => $payment_method_defaults, 'sample_check_image_url' => WC_HTTPS::force_https_url( $gateway->get_plugin()->get_plugin_url() ) . '/' . $gateway->get_plugin()->get_framework_image_path() . 'example-check.png', 'states' => WC()->countries->get_states( 'US' ), %%IF SUPPORTS TOKENIZATION%% 'tokens' => $tokens, 'tokenization_allowed' => $tokenization_allowed, 'tokenization_forced' => $gateway->tokenization_forced(), 'default_new_account' => $default_new_account, %%ENDIF SUPPORTS TOKENIZATION%% ), '', $gateway->get_plugin()->get_plugin_path() . '/templates/' ); } } %%IF SUPPORTS TOKENIZATION%% if ( ! function_exists( 'woocommerce_%%GATEWAY ID CHECKS%%_show_my_payment_methods' ) ) { /** * Pluggable function to render the gateway tokenized checking account payment methods on * the My Account page * * @since 1.0.0 * @param %%GATEWAY CLASS%% $gateway gateway class */ function woocommerce_%%GATEWAY ID CHECKS%%_show_my_payment_methods( $gateway ) { $user_id = get_current_user_id(); // get available saved payment methods $tokens = $gateway->get_payment_tokens( $user_id ); // load the My Account - My Accounts template file wc_get_template( 'myaccount/%%GATEWAY ID DASHERIZED CHECKS%%-my-accounts.php', array( 'gateway' => $gateway, 'tokens' => $tokens, ), '', $gateway->get_plugin()->get_plugin_path() . '/templates/' ); // Add confirm javascript when deleting payment methods ob_start(); ?> $( 'a.js-wc-%%GATEWAY ID DASHERIZED CHECKS%%-delete-payment-method' ).click( function( e ) { if ( ! confirm( '') ) { e.preventDefault(); } } );