From 83855c548ef110dc07b3e7488b6f7124f516dd2b Mon Sep 17 00:00:00 2001 From: d10n Date: Tue, 18 Mar 2014 18:17:22 -0400 Subject: [PATCH 1/3] PlugnPay workaround: don't crash on invalid API avs-code response --- paython/gateways/plugnpay.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/paython/gateways/plugnpay.py b/paython/gateways/plugnpay.py index 1be9ac6..3d59b8f 100644 --- a/paython/gateways/plugnpay.py +++ b/paython/gateways/plugnpay.py @@ -290,8 +290,8 @@ class PlugnPay(PostGateway): 'resp-code-msg' : 'response_reason', 'resp-code' : 'response_reason_code', 'auth-code':'auth_code', - 'avs-code':'avs_response', - 'avs-code-msg':'avs_response_text', + 'avs-code':'avs_response', + 'avs-code-msg':'avs_response_text', 'orderID':'trans_id', 'card-amount':'amount', 'authtype':'trans_type', @@ -529,9 +529,19 @@ def parse(self, raw_response, response_time): # map AVS code to string based on `card-type` if response.has_key('avs-code'): if response['card-type'] in self.AVS_RESPONSE_KEYS: - response['avs-code-msg'] = self.AVS_RESPONSE_KEYS[response['card-type']][response['avs-code']] + # FIXME: PlugnPay workaround + # this + # response['avs-code-msg'] = self.AVS_RESPONSE_KEYS[response['card-type']][response['avs-code']] + if response['avs-code'] in self.AVS_RESPONSE_KEYS[response['card-type']]: + response['avs-code-msg'] = self.AVS_RESPONSE_KEYS[response['card-type']][response['avs-code']] + else: + response['avs-code-msg'] = 'invalid API response' else: # default to VISA AVS description - response['avs-code-msg'] = self.AVS_RESPONSE_KEYS['VISA'][response['avs-code']] + # response['avs-code-msg'] = self.AVS_RESPONSE_KEYS['VISA'][response['avs-code']] + if response['avs-code'] in self.AVS_RESPONSE_KEYS['VISA']: + response['avs-code-msg'] = self.AVS_RESPONSE_KEYS['VISA'][response['avs-code']] + else: + response['avs-code-msg'] = 'invalid API response' # simple response code description if response.has_key('sresp'): @@ -550,4 +560,3 @@ def parse(self, raw_response, response_time): logger.debug(debug_string) return super(PlugnPay, self).standardize(response, self.RESPONSE_KEYS, response_time, approved) - From 6671abfc0c1e66c87e6a7c2097e3ad86448d06b5 Mon Sep 17 00:00:00 2001 From: d10n Date: Tue, 18 Mar 2014 18:39:26 -0400 Subject: [PATCH 2/3] unstable notice --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cd1d143..a2eab96 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Please don't fork this or pull changes from this for now; it might break + Paython ========= From 5803d2bd361cdfeac706e3b37c01c4a0cd5dc50e Mon Sep 17 00:00:00 2001 From: d10n Date: Tue, 18 Mar 2014 19:54:44 -0400 Subject: [PATCH 3/3] Mercury response codes --- paython/gateways/plugnpay.py | 55 +++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/paython/gateways/plugnpay.py b/paython/gateways/plugnpay.py index 3d59b8f..9425586 100644 --- a/paython/gateways/plugnpay.py +++ b/paython/gateways/plugnpay.py @@ -272,7 +272,60 @@ class PlugnPay(PostGateway): 'N7' : 'CVV2 Value supplied is invalid', 'xx' : 'Undefined response', 'CV' : 'Card type verification error', - 'R1' : 'Stop recurring' + 'R1' : 'Stop recurring', + + # Mercury Response Codes + '001': 'Refer to Issuer', + '002': 'Refer to Issuer', + '003': 'Invalid to Merchant ID', + '004': 'Pick up card', + '005': 'Authorization declined', + '006': 'Reversal was successful', + '007': 'CVV failure', + '008': 'Approved with positive ID', + '012': 'Invalid transaction code', + '013': 'Invalid amount', + '014': 'Invalid account or Amex CID failure', + '019': 'Please retry', + '054': 'Invalid expiration date', + '055': 'Incorrect PIN', + '058': 'Merchant not setup for transaction code used', + '075': 'Maximum PIN number entry attempts exceeded', + '094': 'Transaction entered is a duplicate', + '998': 'Invalid account number or security code', + '0C1': 'System unavailable', + '0N1': 'The account number for a void or adjustment does not match stored value', + '0N2': 'The amount entered for a void or adjustment transaction does not match stored value', + '0N3': 'The item number entered for a void or adjustment transaction is incorrect', + '0N4': 'An adjustment or item review was attempted on a transaction previously voided or reversed', + '0N5': 'Terminal has not been balanced within time specified in the mercury Payments Merchant master file', + '0N6': 'Terminal has not been balanced within time specified in the master file, but merchant is setup to perform extra transactions before balancing', + '0N7': 'Override transaction is attempted on a non-duplicated transaction', + '0N8': 'Format of the transaction is incorrect', + '0NA': 'Reversal transaction is attempted on a transaction that is not in the open batch on the host', + '0NC': 'Approved but not captured (applies only to credit card transactions)', + '0NE': 'Approved but this EDC merchant is not setup to capture this card type', + '0NF': 'Acquiring Bank ID entered is incorrect', + '0P0': 'Transaction not supported by EFT Network or card issuer', + '0P1': 'Approved debit card transaction', + '0P2': 'mercury Payments Gateway is down', + '0P3': 'mercury Payments Gateway link timed out', + '0P4': 'mercury Payments Gateway cannot contact EFT network or EFT Group ID is incorrect', + '0P5': 'Merchant is not setup for debit on mercury Payments merchant master file', + '0P6': 'Debit card not on issuer file', + '0P7': 'EFT network cannot contact issuer', + '0P8': 'Card is not eligible for POS', + '0P9': 'Type of account entered cannot be accessed', + '0PA': 'No sharing arrangement for this card', + '0PB': 'mercury Payments Gateway financial institutio ID not setup', + '0S0': 'Match on SCAN file. Routing/transit number on the negative file', + '0S1': 'The license or ID number entered during a check authorization transaction is incorrect', + '0S2': 'State code entered is incorrect', + '0T1': 'EDC application down, try later', + '0T2': 'Debit application down, try later', + '0T3': 'SCAN application is down, try later', + '121': 'Exceeds withdrawal amount limit', + '123': 'Exceeds withdrawal frequency limit', } SIMPLE_STATUS_RESPONSE_KEYS = {