Commit 9693a2a6 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Add script to redirect when payment is Free

      This is used to Sales website when a Invitation token is provided and it will be used when request button will be available on logged user website.
parent a296ad59
""" Return a dict with vads_urls required for payzen."""
if web_site is None:
web_site = context.getWebSiteValue()
if context.PaymentTransaction_getTotalPayablePrice() > 0:
# This script cannot be used if Payment has a value to pay
raise ValueError("Payment Transaction has a non zero total")
base_url = web_site.absolute_url()
payment_transaction_url = context.getRelativeUrl()
base = web_site.getLayoutProperty("configuration_payment_url_template",
"%(url)s/#/%(payment)s?page=slap_payment_result&result=%(result)s")
base_substitution_dict = {
"url" : base_url,
"payment": payment_transaction_url,
"result": "free"
}
redirect_url = base % base_substitution_dict
return context.REQUEST.RESPONSE.redirect(redirect_url)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>web_site=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaymentTransaction_redirectToManualFreePayment</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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