Commit cfe5ae00 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 through the activities and added one test to cover this method

Fix unit test
parent b04eeadf
......@@ -103,8 +103,7 @@ 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
method_id = self._getTypeBasedMethod("reportPaymentStatus").id
getattr(self.activate(), method_id)(response_dict=REQUEST.form)
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):
......@@ -99,3 +99,16 @@ business=business@sample.com""")
self.portal.portal_skins.custom.manage_delObjects([pt_id])
# flush skin cache
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', "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