Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Please don't fork this or pull changes from this for now; it might break

Paython
=========

Expand Down
74 changes: 68 additions & 6 deletions paython/gateways/plugnpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -290,8 +343,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',
Expand Down Expand Up @@ -529,9 +582,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'):
Expand All @@ -550,4 +613,3 @@ def parse(self, raw_response, response_time):
logger.debug(debug_string)

return super(PlugnPay, self).standardize(response, self.RESPONSE_KEYS, response_time, approved)