[Checkins] SVN: zc.authorizedotnet/trunk/src/zc/authorizedotnet/ Demonstrated a way to unalias transactions with an invoice_num field.

Albertas Agejevas alga at pov.lt
Thu May 3 15:41:50 EDT 2007


Log message for revision 75082:
  Demonstrated a way to unalias transactions with an invoice_num field.
  

Changed:
  U   zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt
  U   zc.authorizedotnet/trunk/src/zc/authorizedotnet/tests.py

-=-
Modified: zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt
===================================================================
--- zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt	2007-05-03 19:37:47 UTC (rev 75081)
+++ zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt	2007-05-03 19:41:49 UTC (rev 75082)
@@ -153,19 +153,27 @@
 The first transaction will work.
 
     >>> result = cc.authorize(amount='3.00', card_num='4007000000027',
-    ...                       exp_date='0530')
+    ...                       exp_date='0530', invoice_num='123')
     >>> result.response
     'approved'
 
 A duplicate transaction will fail with an appropriate message.
 
     >>> result2 = cc.authorize(amount='3.00', card_num='4007000000027',
-    ...                       exp_date='0530')
+    ...                       exp_date='0530', invoice_num='123')
     >>> result2.response
     'error'
     >>> result2.response_reason
     'A duplicate transaction has been submitted.'
 
+Similar transactions can be unaliased by including a unique invoice_num
+field:
+
+    >>> result3 = cc.authorize(amount='3.00', card_num='4007000000027',
+    ...                        exp_date='0530', invoice_num='124')
+    >>> result3.response
+    'approved'
+
 The default window size is 120 seconds, but any other value (including 0) can
 be provided by passing ``duplicate_window`` to the transaction method.
 

Modified: zc.authorizedotnet/trunk/src/zc/authorizedotnet/tests.py
===================================================================
--- zc.authorizedotnet/trunk/src/zc/authorizedotnet/tests.py	2007-05-03 19:37:47 UTC (rev 75081)
+++ zc.authorizedotnet/trunk/src/zc/authorizedotnet/tests.py	2007-05-03 19:41:49 UTC (rev 75082)
@@ -131,15 +131,17 @@
                            ' address provided does not match billing address'
                            ' of cardholder.')
 
-        if (amount, card_num) in in_process_server.seen_auths:
+        invoice_num = fields.getvalue('x_invoice_num')
+        txn_hash = (amount, card_num, invoice_num)
+        if txn_hash in in_process_server.seen_auths:
             response_code = '3'
             reason_text = 'A duplicate transaction has been submitted.'
 
         out = self.makeOut(response_code, reason_text, approval_code,
                            trans_id, amount)
 
-        if (amount, card_num) not in in_process_server.seen_auths:
-            in_process_server.seen_auths.append( (amount, card_num) )
+        if txn_hash not in in_process_server.seen_auths:
+            in_process_server.seen_auths.append(txn_hash)
             in_process_server.info[trans_id] = 'Authorized/Pending Capture'
 
         return out



More information about the Checkins mailing list