'default' => 'no'
),
- // Require Address Verification
+ // Require Full Address Verification
'address_verification' => array(
'title' => __('Require Address Verification', 'glm-merchant_e_solutions'),
'type' => 'checkbox',
- 'label' => __('Check to require valid address verification before charging credit card.', 'glm-merchant_e_solutions'),
+ 'label' => __('Check to require valid address and ZIP/Postal code verification before charging credit card.<br>Overrides ZIP match option below.', 'glm-merchant_e_solutions'),
+ 'default' => 'no'
+ ),
+
+ // Require ZIP Match
+ 'zip_verification' => array(
+ 'title' => __('Require ZIP Verification', 'glm-merchant_e_solutions'),
+ 'type' => 'checkbox',
+ 'label' => __('Check to require valid ZIP/Postal code verification before charging credit card.', 'glm-merchant_e_solutions'),
'default' => 'no'
),
wc_add_notice('GLM MeS Gateway: Running Address Verification', 'success');
}
- // Only run address verification test if selected
- if ($this->settings['address_verification'] == 'yes') {
+ // Only run address and/or ZIP verification test if selected
+ if ($this->settings['address_verification'] == 'yes' || $this->settings['zip_verification'] == 'yes') {
- $trans = new TpgSale($this->profile_id, $this->profile_key);
+ if (GLM_MES_DEBUG_VERBOSE) {
+ wc_add_notice('GLM MeS Gateway: Address Verification Requested', 'success');
+ }
- // Set transaction type to Address Verification Only
- $trans->TranType = "A";
+ $trans = new TpgSale($this->profile_id, $this->profile_key);
- $sendRequestData = true;
+ // Set transaction type to Address Verification Only
+ $trans->TranType = "A";
- break;
+ $sendRequestData = true;
+
+ break;
// otherwise, no AVS, so say we're OK to go
} else {
$response['auth_response_descr'] = "The address you entered does not seem to match the address for this credit card.
Please check your address and try again.<br>";
}
+ } elseif ($this->settings['zip_verification'] == 'yes') {
+ if ($response['avs_result'] == 'A' || !in_array($response['avs_result'], array('Z', 'Y', 'X'))) {
+ $auth = false;
+ $response['auth_response_descr'] = "The ZIP/Postal code you entered does not seem to match this credit card.
+ Please check your ZIP/Postal code and try again.<br>";
+ }
} else {
if (GLM_MES_DEBUG_VERBOSE) {
}
// Check if Address Verification is required
- if ($this->settings['address_verification'] == 'yes') {
+ if ($this->settings['zip_verification'] == 'yes' || $this->settings['address_verification'] == 'yes') {
// Try Address Verification
$response = $this->run_transaction('AVS');
// If AVS was successful - run sale
if ($response['success']) {
+
+ if (GLM_MES_DEBUG_VERBOSE) {
+ wc_add_notice('GLM MeS Gateway: Address Verification OK, running sale', 'success');
+ }
+
$response = $this->run_transaction('Sale', false);
}
} else {
// Tell the user we had a payment failure
-// THE VARIABLE DATA NEEDS TO BE APPENDED RATHER THAT INCLUDED. woothemes is not our method title
+ // THE VARIABLE DATA NEEDS TO BE APPENDED RATHER THAT INCLUDED. woothemes is not our method title
wc_add_notice(
__(
"<h4>We're sorry, there was a problem with your payment...</h4><p><b>Reason:</b> " .
- $response['auth_response_text'] .
- '</p><p>'.$response['auth_response_descr'],
+ $response['auth_response_descr']."</p>",
'woothemes'), 'error');
// Add a note to the customer order for reference