Commit 03e358bc authored by Gabriel Monnerat's avatar Gabriel Monnerat

clean up reportPaymentStatus function on PaypalService to call...

clean up reportPaymentStatus function on PaypalService to call PaypalService_reportPaymentStatus script regardless of the outcome of the status and added one test to cover this method
parent 3717426e
......@@ -103,8 +103,6 @@ class PaypalService(XMLObject):
request.add_header("Content-type", "application/x-www-form-urlencoded")
response = urlopen(request)
status = response.read()
method = self._getTypeBasedMethod("reportPaymentStatus")
LOG("PaypalService status", DEBUG, status)
if method and status == "VERIFIED":
method(REQUEST=REQUEST)
return True
\ No newline at end of file
self._getTypeBasedMethod("reportPaymentStatus")(REQUEST=REQUEST)
return status == "VERIFIED"
\ No newline at end of file
......@@ -26,7 +26,7 @@
##############################################################################
import random
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, get_request
def getMessageList(o):
......@@ -98,4 +98,17 @@ business=business@sample.com""")
finally:
self.portal.portal_skins.custom.manage_delObjects([pt_id])
# flush skin cache
self.portal.changeSkin(None)
\ No newline at end of file
self.portal.changeSkin(None)
def test_reportPaymentStatus(self):
script_id = "Base_paymentResponse"
custom_skin = self.portal.portal_skins.custom
custom_skin.manage_addProduct['PythonScripts']\
.manage_addPythonScript(id=script_id)
script = custom_skin[script_id]
script.ZPythonScript_edit('**kw', "if kw.has_key('cmd'):\n return 'VERIFIED'")
self.tic()
script_absolute_url = script.absolute_url()
self.service.edit(link_url_string=script_absolute_url)
response = self.service.reportPaymentStatus(get_request())
self.assertTrue(response)
\ No newline at end of file
2
\ No newline at end of file
3
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment