Skip to content

Commit e0763b4

Browse files
committed
Filter Elavon default payment form values
1 parent 561ebd0 commit e0763b4

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

woocommerce-dev-helper.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: A simple plugin for helping develop/debug WooCommerce & extensions
66
* Author: SkyVerge
77
* Author URI: http://www.skyverge.com
8-
* Version: 0.7.0
8+
* Version: 0.8.0
99
* Text Domain: woocommerce-dev-helper
1010
* Domain Path: /i18n/languages/
1111
*
@@ -73,6 +73,9 @@ public function __construct() {
7373

7474
// add the testing gateway
7575
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_bogus_gateway' ) );
76+
77+
// filter default Elavon test card
78+
add_filter( 'woocommerce_elavon_credit_card_default_values', array( $this, 'change_elavon_test_values' ), 10, 2 );
7679
}
7780

7881

@@ -124,12 +127,32 @@ function wc_dev_get_session() {
124127
* @param array $gateways all available WC gateways
125128
* @return array updated gateways
126129
*/
127-
function add_bogus_gateway( $gateways ) {
130+
public function add_bogus_gateway( $gateways ) {
128131
$gateways[] = 'WC_Bogus_Gateway';
129132
return $gateways;
130133
}
131134

132135

136+
/**
137+
* Changes the Elavon default payment form values.
138+
*
139+
* @since 0.8.0
140+
*
141+
* @param string[] $defaults the gateway form defaults
142+
* @param \WC_Gateway_Elavon_Converge_Credit_Card $gateway gateway instance
143+
* @return string[] update default values
144+
*/
145+
public function change_elavon_test_values( $defaults, $gateway ) {
146+
147+
if ( $gateway->is_test_environment() ) {
148+
$defaults['expiry'] = '12/19';
149+
$defaults['account-number'] = '4124939999999990';
150+
}
151+
152+
return $defaults;
153+
}
154+
155+
133156
/**
134157
* Include required files
135158
*

0 commit comments

Comments
 (0)