Commit 907335ab authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify PayZen interface.

Allow to reuse existing ID and allow PayZen to inform user, that transaction
is already registered.

Allow to work on already confirmed Payment Transaction - just do not try to
confirm it again.

Set start date a bit later.
parent 338d54ec
......@@ -62,15 +62,13 @@ system_event_kw = {\n
}\n
system_event = portal.system_event_module.newContent(title=\'User navigation script\', **system_event_kw)\n
\n
today = DateTime().toZone(\'UTC\').asdatetime().strftime(\'%Y%m%d\')\n
now = DateTime()\n
today = now.toZone(\'UTC\').asdatetime().strftime(\'%Y%m%d\')\n
transaction_id = str(portal.portal_ids.generateNewId(\n
id_group=\'%s_%s\' % (service.getRelativeUrl(), today),\n
id_generator=\'uid\')).zfill(6)\n
\n
mapping_id = \'%s_%s\' % (today, transaction_id)\n
if not integration_site.getMappingFromCategory(\'causality/%s\' % context.getRelativeUrl()) == \'Causality/%s\' % context.getRelativeUrl():\n
system_event.confirm(comment=\'Transaction already mapped in integration tool.\')\n
return \'There was system issue\'\n
try:\n
integration_site.getCategoryFromMapping(\'Causality/%s\' % mapping_id, create_mapping_line=True, create_mapping=True)\n
except ValueError:\n
......@@ -80,13 +78,16 @@ else:\n
system_event.confirm(comment=\'Key %s already found!\' % mapping_id)\n
return \'There was system issue\'\n
\n
context.activate().PaymentTransaction_confirm()\n
if context.getStartDate() is None:\n
context.setStartDate(now)\n
if context.getSimulationState() != \'confirmed\':\n
context.activate().PaymentTransaction_confirm()\n
\n
payzen_dict = {}\n
payzen_dict.update(\n
vads_currency=integration_site.getMappingFromCategory(\'resource/currency_module/%s\' % context.getResourceReference()).split(\'/\')[-1],\n
vads_amount=str(int(round((context.PaymentTransaction_getTotalPayablePrice() * -100), 0))),\n
vads_trans_date=context.getStartDate().toZone(\'UTC\').asdatetime().strftime(\'%Y%m%d%H%M%S\'),\n
vads_trans_date=now.toZone(\'UTC\').asdatetime().strftime(\'%Y%m%d%H%M%S\'),\n
vads_trans_id=transaction_id,\n
vads_language=\'en\',\n
)\n
......
54
\ No newline at end of file
55
\ 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