bugfix
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 24 Jun 2010 15:39:31 +0200
changeset 8 42b28c015239
parent 7 8d329af23dd9
child 9 39c1be3c4ed0
bugfix
views.py
--- a/views.py	Wed Jun 23 20:41:33 2010 +0200
+++ b/views.py	Thu Jun 24 15:39:31 2010 +0200
@@ -77,11 +77,14 @@
         except Exception, exc:
             print exc
             ack = 1
-        return 'version=%s\ncdr=%s' % (tpe.version, ack)
+        ret = 'version=2\ncdr=%s' % ack
+        print 'cmcic returning', ret
+        return ret
 
 
     def handle_msg(self, tpe):
         params = dict(self._cw.form)
+        print params
         rep = tpe.read_paymentresponse(params)
         msg, mac = tpe.paymentresponse_msg(rep)
         if tpe.is_valid_msg(msg, mac):
@@ -89,18 +92,19 @@
                 # Payment has been refused
                 # The payment may be accepted later
                 # put your code here (email sending / Database update)
-                print 'cmcic', rep.reference, rep.return_code
+                print 'cmcic received', rep.reference, rep.return_code
                 return 0
 
             elif rep.return_code in ("payetest", "paiement"):
                 # Payment has been accepeted on the productive server
                 # put your code here (email sending / Database update)
-                print 'cmcic', rep.reference, rep.return_code
+                print 'cmcic received', rep.reference, rep.return_code
                 comment = u'payed by %(brand)s on %(date)s, auth %(numauto)s' % rep.as_dict()
                 try:
                     self.appli.repo.shopcart_checkout(rep.reference, comment)
                     return 0
                 except ValidationError, exc:
+                    print 'cmcic raised exception trying to checkout cart', exc
                     return 1
 
             #*** ONLY FOR MULTIPART PAYMENT ***#
@@ -118,5 +122,5 @@
                 # You have the amount of the payment part in Repification['montantech']
                 print 'cmcic', rep.reference, rep.return_code
         else:
-            print "cmcic: the HMAC doesn't match."
+            print "cmcic received invalid message (the HMAC doesn't match)."
         return 1