Commit d6ba33c8 authored by Romain Courteaud's avatar Romain Courteaud

Wrap the script with the shadow user.

parent 46d8dd2d
...@@ -53,29 +53,39 @@ ...@@ -53,29 +53,39 @@
<value> <string># TODO: Return configured web page in case of system issues.\n <value> <string># TODO: Return configured web page in case of system issues.\n
from ZTUtils import make_query\n from ZTUtils import make_query\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n \n
transaction_date, transaction_id = context.PaymentTransaction_getPayzenId()\n def wrapWithShadow(payment_transaction, person_relative_url):\n
if transaction_id is not None:\n transaction_date, transaction_id = payment_transaction.PaymentTransaction_getPayzenId()\n
message = context.Base_translateString("Payment already registered.")\n if transaction_id is not None:\n
return context.getWebSiteValue().Base_redirect(keep_items={\'portal_status_message\': message})\n message = payment_transaction.Base_translateString("Payment already registered.")\n
return web_site.Base_redirect(keep_items={\'portal_status_message\': message})\n
\n \n
callback_websection = context.getWebSiteValue().payzen_callback\n system_event = payment_transaction.PaymentTransaction_createPayzenEvent(\n
query = make_query(dict(transaction=context.getRelativeUrl()))\n title=\'User navigation script for %s\' % payment_transaction.getTitle(),\n
destination_section=person_relative_url,\n
)\n
\n \n
system_event = context.PaymentTransaction_createPayzenEvent(\n web_site = context.getWebSiteValue()\n
title=\'User navigation script for %s\' % context.getTitle()\n callback_websection = web_site.payzen_callback\n
)\n query = make_query(dict(transaction=payment_transaction.getRelativeUrl()))\n
system_event.generateManualPaymentPage(\n system_event.generateManualPaymentPage(\n
vads_url_cancel=\'%s?%s\' % (callback_websection.cancel.absolute_url(), query),\n vads_url_cancel=\'%s?%s\' % (callback_websection.cancel.absolute_url(), query),\n
vads_url_error=\'%s?%s\' % (callback_websection.error.absolute_url(), query),\n vads_url_error=\'%s?%s\' % (callback_websection.error.absolute_url(), query),\n
vads_url_referral=\'%s?%s\' % (callback_websection.referral.absolute_url(), query),\n vads_url_referral=\'%s?%s\' % (callback_websection.referral.absolute_url(), query),\n
vads_url_refused=\'%s?%s\' % (callback_websection.refused.absolute_url(), query),\n vads_url_refused=\'%s?%s\' % (callback_websection.refused.absolute_url(), query),\n
vads_url_success=\'%s?%s\' % (callback_websection.success.absolute_url(), query),\n vads_url_success=\'%s?%s\' % (callback_websection.success.absolute_url(), query),\n
vads_url_return=\'%s?%s\' % (getattr(callback_websection, \'return\').absolute_url(), query),\n vads_url_return=\'%s?%s\' % (getattr(callback_websection, \'return\').absolute_url(), query),\n
)\n )\n
\n \n
return system_event.contentValues(\n return system_event.contentValues(\n
portal_type="Payzen Event Message")[0].getTextContent()\n portal_type="Payzen Event Message")[0].getTextContent()\n
\n
\n
return person.Person_restrictMethodAsShadowUser(\n
shadow_document=person,\n
callable_object=wrapWithShadow,\n
argument_list=[context, person.getRelativeUrl()])\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
19 20
\ 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