Commit b1f80057 authored by Łukasz Nowak's avatar Łukasz Nowak

Revert "Allow to manipulate freely sent dict."

This reverts commit e1356f85.
parent e1356f85
...@@ -47,36 +47,35 @@ class PayzenService(XMLObject): ...@@ -47,36 +47,35 @@ class PayzenService(XMLObject):
return self._getTypeBasedMethod("abortPayment")(**kw) return self._getTypeBasedMethod("abortPayment")(**kw)
# proposed methods # proposed methods
def getFormString(self, document, content_dict=None): def getFormString(self, document, **kw):
"""Returns unterminated form for current document """Returns unterminated form for current document
The responsiblity of the caller is to finish the form.""" The responsiblity of the caller is to finish the form."""
self.Base_checkConsistency() self.Base_checkConsistency()
if content_dict is None: content_kw = dict()
content_dict = dict() content_kw['vads_action_mode'] = self.getPayzenVadsActionMode()
content_dict['vads_action_mode'] = self.getPayzenVadsActionMode() content_kw['vads_amount'] = int(document.getTotalPrice() * 100)
content_dict['vads_amount'] = int(document.getTotalPrice() * 100)
integration_tool = self.restrictedTraverse(self.getIntegrationSite()) integration_tool = self.restrictedTraverse(self.getIntegrationSite())
content_dict['vads_currency'] = integration_tool.getMappingFromCategory( content_kw['vads_currency'] = integration_tool.getMappingFromCategory(
'resource/currency_module/%s' % document.getPriceCurrencyReference() 'resource/currency_module/%s' % document.getPriceCurrencyReference()
).split('/')[-1] ).split('/')[-1]
content_dict['vads_ctx_mode'] = self.getPayzenVadsCtxMode() content_kw['vads_ctx_mode'] = self.getPayzenVadsCtxMode()
content_dict['vads_page_action'] = self.getPayzenVadsPageAction() content_kw['vads_page_action'] = self.getPayzenVadsPageAction()
content_dict['vads_payment_config'] = document\ content_kw['vads_payment_config'] = document\
.Base_getPayzenServicePaymentConfig() .Base_getPayzenServicePaymentConfig()
content_dict['vads_site_id'] = self.getServiceUsername() content_kw['vads_site_id'] = self.getServiceUsername()
# date as YYYYMMDDHHMMSS # date as YYYYMMDDHHMMSS
content_dict['vads_trans_date'] = document.getStartDate().strftime( content_kw['vads_trans_date'] = document.getStartDate().strftime(
'%Y%m%d%H%M%S') '%Y%m%d%H%M%S')
content_dict['vads_trans_id'] = document.Base_getPayzenTransId() content_kw['vads_trans_id'] = document.Base_getPayzenTransId()
content_dict['vads_version'] = self.getPayzenVadsVersion() content_kw['vads_version'] = self.getPayzenVadsVersion()
# all data are completed, now it is time to create signature # all data are completed, now it is time to create signature
sorted_keys = content_dict.keys() sorted_keys = content_kw.keys()
sorted_keys.sort() sorted_keys.sort()
signature = '' signature = ''
form = '<FORM METHOD="POST" ACTION="%s">\n' % self.getLinkUrlString() form = '<FORM METHOD="POST" ACTION="%s">\n' % self.getLinkUrlString()
for k in sorted_keys: for k in sorted_keys:
v = str(content_dict[k]) v = str(content_kw[k])
signature += v + '+' signature += v + '+'
form += '<INPUT TYPE="HIDDEN" NAME="%s" VALUE="%s">\n' % (k, v) form += '<INPUT TYPE="HIDDEN" NAME="%s" VALUE="%s">\n' % (k, v)
signature += self.getServicePassword() signature += self.getServicePassword()
......
19 18
\ 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