Skip to content

Commit 4582dfe

Browse files
authored
Merge branch 'master' into forward-fixes
2 parents 1f5345a + e0763b4 commit 4582dfe

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.1-dev
8+
* Version: 0.8.0
99
* Text Domain: woocommerce-dev-helper
1010
* Domain Path: /i18n/languages/
1111
*
@@ -76,6 +76,9 @@ public function __construct() {
7676
// add the testing gateway
7777
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_bogus_gateway' ) );
7878

79+
// filter default Elavon test card
80+
add_filter( 'woocommerce_elavon_credit_card_default_values', array( $this, 'change_elavon_test_values' ), 10, 2 );
81+
7982
// use forwarded URLs: this needs to be done as early as possible in order to set the $_SERVER['HTTPS'] var
8083
require_once( $this->get_plugin_path() . '/includes/class-wc-dev-helper-use-forwarded-urls.php' );
8184
$this->use_forwarded_urls = new WC_Dev_Helper_Use_Forwarded_URLs();
@@ -130,12 +133,32 @@ function wc_dev_get_session() {
130133
* @param array $gateways all available WC gateways
131134
* @return array updated gateways
132135
*/
133-
function add_bogus_gateway( $gateways ) {
136+
public function add_bogus_gateway( $gateways ) {
134137
$gateways[] = 'WC_Bogus_Gateway';
135138
return $gateways;
136139
}
137140

138141

142+
/**
143+
* Changes the Elavon default payment form values.
144+
*
145+
* @since 0.8.0
146+
*
147+
* @param string[] $defaults the gateway form defaults
148+
* @param \WC_Gateway_Elavon_Converge_Credit_Card $gateway gateway instance
149+
* @return string[] update default values
150+
*/
151+
public function change_elavon_test_values( $defaults, $gateway ) {
152+
153+
if ( $gateway->is_test_environment() ) {
154+
$defaults['expiry'] = '12/19';
155+
$defaults['account-number'] = '4124939999999990';
156+
}
157+
158+
return $defaults;
159+
}
160+
161+
139162
/**
140163
* Include required files
141164
*

0 commit comments

Comments
 (0)