|
5 | 5 | * Description: A simple plugin for helping develop/debug WooCommerce & extensions |
6 | 6 | * Author: SkyVerge |
7 | 7 | * Author URI: http://www.skyverge.com |
8 | | - * Version: 0.7.1-dev |
| 8 | + * Version: 0.8.0 |
9 | 9 | * Text Domain: woocommerce-dev-helper |
10 | 10 | * Domain Path: /i18n/languages/ |
11 | 11 | * |
@@ -76,6 +76,9 @@ public function __construct() { |
76 | 76 | // add the testing gateway |
77 | 77 | add_filter( 'woocommerce_payment_gateways', array( $this, 'add_bogus_gateway' ) ); |
78 | 78 |
|
| 79 | + // filter default Elavon test card |
| 80 | + add_filter( 'woocommerce_elavon_credit_card_default_values', array( $this, 'change_elavon_test_values' ), 10, 2 ); |
| 81 | + |
79 | 82 | // use forwarded URLs: this needs to be done as early as possible in order to set the $_SERVER['HTTPS'] var |
80 | 83 | require_once( $this->get_plugin_path() . '/includes/class-wc-dev-helper-use-forwarded-urls.php' ); |
81 | 84 | $this->use_forwarded_urls = new WC_Dev_Helper_Use_Forwarded_URLs(); |
@@ -130,12 +133,32 @@ function wc_dev_get_session() { |
130 | 133 | * @param array $gateways all available WC gateways |
131 | 134 | * @return array updated gateways |
132 | 135 | */ |
133 | | - function add_bogus_gateway( $gateways ) { |
| 136 | + public function add_bogus_gateway( $gateways ) { |
134 | 137 | $gateways[] = 'WC_Bogus_Gateway'; |
135 | 138 | return $gateways; |
136 | 139 | } |
137 | 140 |
|
138 | 141 |
|
| 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 | + |
139 | 162 | /** |
140 | 163 | * Include required files |
141 | 164 | * |
|
0 commit comments