From a12c770ca5035d46f910c53d00d1368286641af1 Mon Sep 17 00:00:00 2001 From: gdetrez Date: Sat, 7 Oct 2006 13:24:22 +0200 Subject: [PATCH] page de retour paypal darcs-hash:20061007112422-f46e9-cd3ab12eb69267ed9e7aa58c45eca09051d8daec.gz --- intranet/pages/factures.py | 7 +++++-- intranet/pages/monCompte.py | 29 ++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/intranet/pages/factures.py b/intranet/pages/factures.py index 4cb65025..e62cee6c 100755 --- a/intranet/pages/factures.py +++ b/intranet/pages/factures.py @@ -6,7 +6,7 @@ # Description: # # Affiche la liste des factures et l'historique de débits/crédits de l'adhérent. # # Informations: # -# # +# # # Pages: # # index:liste des factures # # historique: historique des débits/crédits # @@ -40,7 +40,10 @@ class root: } for art in f.articles()] facture['montant'] = f.total() facture['paypal'] = f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False), - businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org")) + businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"), + return_page = "https://intranet.crans.org/monCompte/paypalReturn", + cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel", + ) facture['payee'] = f.recuPaiement() listeFactures.append(facture) diff --git a/intranet/pages/monCompte.py b/intranet/pages/monCompte.py index 968aa9e6..971d27eb 100755 --- a/intranet/pages/monCompte.py +++ b/intranet/pages/monCompte.py @@ -192,11 +192,14 @@ class monCompte: combien = float(combien) # arrondissage-tronquage : combien = float(int(combien*100)/100.0) + # nombre positif + if combien < 0: + raise ValueError except Exception: return { 'template' :'MonCompteRechargePaypal2', 'standalone' :True, - 'values' :{'error':"Le montant doit être un nombre !", 'combien':combien}, + 'values' :{'error':"Le montant doit être un nombre positif !", 'combien':combien}, } f.ajoute({'nombre': 1, 'code': 'SOLDE', 'designation': 'Credit du compte impression (intranet)', 'pu': combien}) cherrypy.session['freshFacture'] = f @@ -222,16 +225,28 @@ class monCompte: 'template' :'MonCompteRechargePaypal4', 'standalone' :True, 'values' :{'lienPaypal' : f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False), - businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"))}, + businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"), + return_page = "https://intranet.crans.org/monCompte/paypalReturn", + cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel", + )}, } rechargerCompteImpression.exposed = True - - - - - + def paypalReturn(self): + return { + 'template' :'MonComptePaypalReturn', + 'standalone' :True, + 'values' :{}, + } + paypalReturn.exposed = True + def paypalCancel(self): + return { + 'template' :'MonComptePaypalCancel', + 'standalone' :True, + 'values' :{}, + } + paypalCancel.exposed = True