[Checkins] SVN: zc.authorizedotnet/trunk/src/zc/authorizedotnet/ Hedge against invalid input.

Albertas Agejevas alga at pov.lt
Mon Nov 19 16:42:53 EST 2007


Log message for revision 81934:
  Hedge against invalid input.
  

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

-=-
Modified: zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt
===================================================================
--- zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt	2007-11-19 16:11:59 UTC (rev 81933)
+++ zc.authorizedotnet/trunk/src/zc/authorizedotnet/README.txt	2007-11-19 21:42:52 UTC (rev 81934)
@@ -70,9 +70,13 @@
     >>> result2 = cc.authorize(amount='2.00', exp_date='0530')
     >>> result2.card_type == None
     True
-   
 
+    >>> result2 = cc.authorize(amount='2.00', card_num='', exp_date='0530')
+    >>> result2.card_type == None
+    True
 
+
+
 Capturing Authorized Transactions
 ---------------------------------
 

Modified: zc.authorizedotnet/trunk/src/zc/authorizedotnet/processing.py
===================================================================
--- zc.authorizedotnet/trunk/src/zc/authorizedotnet/processing.py	2007-11-19 16:11:59 UTC (rev 81933)
+++ zc.authorizedotnet/trunk/src/zc/authorizedotnet/processing.py	2007-11-19 21:42:52 UTC (rev 81934)
@@ -157,7 +157,7 @@
         result = self.connection.sendTransaction(type=type, **kws)
         # get the card_type
         card_num = kws.get('card_num')
-        if card_num is not None:
+        if card_num is not None and len(card_num) >= 4:
             card_type = zc.creditcard.identifyCreditCardType(card_num[:4], len(card_num))
             result.card_type = card_type
         



More information about the Checkins mailing list