[views] fix cmcic_info stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 28 Nov 2010 21:45:17 +0100
branchstable
changeset 20 a6b01c4dfc9d
parent 19 5aa11338ecaa
child 21 d2049bf0b385
[views] fix cmcic_info
views.py
--- a/views.py	Tue Nov 09 23:00:23 2010 +0100
+++ b/views.py	Sun Nov 28 21:45:17 2010 +0100
@@ -42,6 +42,7 @@
     rules = [
         (rgx('/cmcic_info'), dict(vid='cmcic_info')),
         ]
+
 ## views
 
 class CmcicInfoView(StartupView):
@@ -53,7 +54,7 @@
         self.w(u'<h1>CM-CIC p@iement</h1>')
         tpe = get_tpe(self._cw)
         self.w(u'<table>')
-        for attr in ['numero','version','code_societe','url_paiement','url_ok','url_ko']:
+        for attr in ['version','tpe_number','tpe_company','server_url','return_url']:
             self.w(u'<tr><td>%s</td><td>%s</td></tr>' % (attr, getattr(tpe, attr)))
         self.w(u'</table>')
 
@@ -98,14 +99,12 @@
         if tpe.is_valid_msg(msg, mac):
             self.info('cmcic received valid message %s %s' % (repr(rep.reference), repr(rep.return_code)))
             if rep.return_code == "Annulation":
-                # Payment has been refused
+                # Payment was rejected
                 # The payment may be accepted later
-                # put your code here (email sending / Database update)
                 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)
+                # Payment was accepted
                 comment = u'payed by %(brand)s on %(date)s, auth %(numauto)s' % rep.as_dict()
                 try:
                     self.appli.repo.shopcart_checkout(int(rep.reference), comment)
@@ -116,17 +115,13 @@
 
             #*** ONLY FOR MULTIPART PAYMENT ***#
             elif rep.return_code.startswith("paiement_pf"):
-                # Payment has been accepted on the productive server for the part #N
-                # return code is like paiement_pf[#N]
-                # put your code here (email sending / Database update)
-                # You have the amount of the payment part in Rpeification['montantech']
+                # Payment part #N was accepted
+                # return code is paiement_pf[#N], amount in Rpeification['montantech']
                 pass
 
             elif rep.return_code.startswith("Annulation_pf"):
-                # Payment has been refused on the productive server for the part #N
-                # return code is like Annulation_pf[#N]
-                # put your code here (email sending / Database update)
-                # You have the amount of the payment part in Repification['montantech']
+                # Payment part #N was rejected
+                # return code is Annulation_pf[#N], amount in Repification['montantech']
                 pass
         else:
             self.warning("cmcic received invalid message %s %s" % (repr(rep.reference), repr(rep.return_code)))