Commit 2f63699e authored by Łukasz Nowak's avatar Łukasz Nowak

Reformat.

parent 878eae7d
...@@ -59,22 +59,29 @@ service = None\n ...@@ -59,22 +59,29 @@ service = None\n
def addTicket(transaction):\n def addTicket(transaction):\n
portal = transaction.getPortalObject()\n portal = transaction.getPortalObject()\n
ticket = portal.portal_catalog.getResultValue(portal_type=\'Support Request\',\n ticket = portal.portal_catalog.getResultValue(portal_type=\'Support Request\',\n
default_source_project_uid=transaction.getUid(), validation_state=\'validated\')\n default_source_project_uid=transaction.getUid(),\n
validation_state=\'validated\')\n
tag = \'ticket_creation_%s\' % transaction.getUid()\n tag = \'ticket_creation_%s\' % transaction.getUid()\n
activate_kw={\'tag\': tag}\n activate_kw={\'tag\': tag}\n
if ticket is None and portal.portal_activities.countMessageWithTag(tag) == 0:\n if ticket is None and \\\n
portal.portal_activities.countMessageWithTag(tag) == 0:\n
ticket = portal.support_request_module.newContent(\n ticket = portal.support_request_module.newContent(\n
portal_type=\'Support Request\',\n portal_type=\'Support Request\',\n
source_project_uid=transaction.getUid(),\n source_project_uid=transaction.getUid(),\n
activate_kw=activate_kw)\n activate_kw=activate_kw)\n
ticket.validate(comment=\'New automatic ticket for %s\' % transaction.getTitle())\n ticket.validate(comment=\'New automatic ticket for %s\' % \\\n
transaction.getTitle())\n
return ticket\n return ticket\n
return None\n return None\n
\n \n
try:\n try:\n
service = portal.portal_secure_payments.find()\n service = portal.portal_secure_payments.find()\n
except ValueError, e:\n except ValueError, e:\n
portal.system_event_module.newContent(title=\'Transaction %s cannot be updated, because of service error: %s\' % (context.getTitle(), e), portal_type=\'Payzen Event\', source_value=service, destination_value=context).confirm()\n portal.system_event_module.newContent(\n
title=\'Transaction %s cannot be updated, because of service error: %s\' % \\\n
(context.getTitle(), e), portal_type=\'Payzen Event\',\n
source_value=service, destination_value=context)\\\n
.confirm()\n
return\n return\n
\n \n
def createRequestManualPaymentTicket(transaction):\n def createRequestManualPaymentTicket(transaction):\n
...@@ -85,15 +92,19 @@ def createRequestManualPaymentTicket(transaction):\n ...@@ -85,15 +92,19 @@ def createRequestManualPaymentTicket(transaction):\n
if ticket is not None:\n if ticket is not None:\n
tag = \'site_message_creation_%s\' % transaction.getUid()\n tag = \'site_message_creation_%s\' % transaction.getUid()\n
activate_kw={\'tag\': tag}\n activate_kw={\'tag\': tag}\n
site_message = portal.portal_catalog.getResultValue(portal_type=\'Site Message\',\n site_message = portal.portal_catalog.getResultValue(\n
default_follow_up_uid=ticket.getUid())\n portal_type=\'Site Message\', default_follow_up_uid=ticket.getUid())\n
if site_message is None and portal.portal_activities.countMessageWithTag(tag) == 0:\n if site_message is None and \\\n
site_message = portal.event_module.newContent(portal_type=\'Site Message\',\n portal.portal_activities.countMessageWithTag(tag) == 0:\n
site_message = portal.event_module.newContent(\n
portal_type=\'Site Message\',\n
start_date=DateTime(),\n start_date=DateTime(),\n
destination_uid=transaction.getDestinationSectionUid(),\n destination_uid=transaction.getDestinationSectionUid(),\n
follow_up=ticket.getRelativeUrl(),\n follow_up=ticket.getRelativeUrl(),\n
source_uid=transaction.getSourceSectionUid(),\n source_uid=transaction.getSourceSectionUid(),\n
text_content=\'Please pay your payment by clicking <a href="%s/AccountingTransaction_startPayment">here</a>.\' % transaction.getRelativeUrl(),\n text_content=\'Please pay your payment by clicking <a \'\\\n
\'href="%s/AccountingTransaction_startPayment">here</a>.\' % \\\n
transaction.getRelativeUrl(),\n
activate_kw=activate_kw)\n activate_kw=activate_kw)\n
site_message.start(comment=\'Requested manual payment.\')\n site_message.start(comment=\'Requested manual payment.\')\n
\n \n
...@@ -115,20 +126,22 @@ if state == \'confirmed\':\n ...@@ -115,20 +126,22 @@ if state == \'confirmed\':\n
context.start(comment=comment)\n context.start(comment=comment)\n
\n \n
elif state == \'started\':\n elif state == \'started\':\n
transaction_id = portal.restrictedTraverse(portal.portal_preferences.getPreferredPayzenIntegrationSite()\\\n transaction_id = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredPayzenIntegrationSite()\n
).getMappingFromCategory(\'causality/%s\' % context.getRelativeUrl())\n ).getMappingFromCategory(\'causality/%s\' % context.getRelativeUrl())\n
if transaction_id != \'Causality/%s\' % context.getRelativeUrl():\n if transaction_id != \'Causality/%s\' % context.getRelativeUrl():\n
transaction_id = transaction_id.split(\'/\')[1]\n transaction_id = transaction_id.split(\'/\')[1]\n
else:\n else:\n
transaction_id = None\n transaction_id = None\n
\n \n
if transaction_id is None:\n if transaction_id is None:\n
# manual payment shall be done\n # manual payment shall be done\n
# check if there is open ticket if not open it\n # check if there is open ticket if not open it\n
createRequestManualPaymentTicket(context)\n createRequestManualPaymentTicket(context)\n
else:\n else:\n
# so the payment is registered in payzen\n # so the payment is registered in payzen\n
portal.system_event_module.newContent(title=\'Transaction %s Payzen status update\' % context.getTitle(),\n portal.system_event_module.newContent(\n
title=\'Transaction %s Payzen status update\' % context.getTitle(),\n
portal_type=\'Payzen Event\',\n portal_type=\'Payzen Event\',\n
source_value=service,\n source_value=service,\n
destination_value=context).updateStatus()\n destination_value=context).updateStatus()\n
......
74 75
\ 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