Commit 4bcc3c50 authored by Łukasz Nowak's avatar Łukasz Nowak

Implement navigate.

Allow to pass page_template which will be run in context of temporary object
with all required parameters.

Delegate responsiblity of dynamic data preparation to caller, check only service
parent 00c2198e
......@@ -2,6 +2,8 @@ import zope
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Document import newTempDocument
import hashlib
class PayzenService(XMLObject):
meta_type = 'Payzen Service'
......@@ -22,13 +24,37 @@ class PayzenService(XMLObject):
"""See Payment Service Interface Documentation"""
def navigate(self, REQUEST=None, **kw):
"""Navigation not implemented assumes that POST is done directly to the website thus there is
no need to provide "proxy" method.
raise NotImplementedError('Method will not be implemented')
def navigate(self, page_template, REQUEST=None, **kw):
"""Returns configured template used to do the payment"""
temp_document = newTempDocument(self, 'id')
field_list = [
('vads_action_mode', self.getPayzenVadsActionMode()),
('vads_ctx_mode', self.getPayzenVadsCtxMode()),
('vads_page_action', self.getPayzenVadsPageAction()),
('vads_payment_config', 'SINGLE'),
('vads_site_id', self.getServiceUsername()),
('vads_version', self.getPayzenVadsVersion())
# fetch all prepared vads_ values and remove them from dict
for k in kw.copy():
if k.startswith('vads_'):
field_list.append((k, kw.pop(k)))
signature = ''
for k, v in field_list:
signature += v + '+'
signature += self.getServicePassword()
signature = hashlib.sha1(signature).hexdigest()
field_list.append(('signature', signature))
# append the rest of transmitted parameters page template
return getattr(temp_document, page_template)()
def notifySuccess(self, REQUEST=None, **kw):
"""See Payment Service Interface Documentation"""
\ No newline at end of file
\ 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