|
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.0 |
| 8 | + * Version: 0.8.0 |
9 | 9 | * Text Domain: woocommerce-dev-helper |
10 | 10 | * Domain Path: /i18n/languages/ |
11 | 11 | * |
@@ -73,6 +73,9 @@ public function __construct() { |
73 | 73 |
|
74 | 74 | // add the testing gateway |
75 | 75 | 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 ); |
76 | 79 | } |
77 | 80 |
|
78 | 81 |
|
@@ -124,12 +127,32 @@ function wc_dev_get_session() { |
124 | 127 | * @param array $gateways all available WC gateways |
125 | 128 | * @return array updated gateways |
126 | 129 | */ |
127 | | - function add_bogus_gateway( $gateways ) { |
| 130 | + public function add_bogus_gateway( $gateways ) { |
128 | 131 | $gateways[] = 'WC_Bogus_Gateway'; |
129 | 132 | return $gateways; |
130 | 133 | } |
131 | 134 |
|
132 | 135 |
|
| 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 | + |
133 | 156 | /** |
134 | 157 | * Include required files |
135 | 158 | * |
|
0 commit comments