Commit 24a927d1 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: drop unused scripts

parent 4f4501a5
""" 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_transaction_url)s?page=slap_payment_result&result=%(result)s")
base_substitution_dict = {
"url" : base_url,
"payment_transaction_url": payment_transaction_url,
"result": "contact_us"
}
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>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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_redirectToManualContactUsPayment</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
payment_mode = context.getPaymentMode()
entity = context.getDestinationSectionValue()
def wrapWithShadow(entity, invoice):
return entity.Entity_createPaymentTransaction([invoice])
payment = entity.Person_restrictMethodAsShadowUser(
shadow_document=entity,
callable_object=wrapWithShadow,
argument_list=[entity, context])
if web_site is None:
web_site = context.getWebSiteValue()
total_price = entity.Person_restrictMethodAsShadowUser(
shadow_document=entity,
callable_object=payment.PaymentTransaction_getTotalPayablePrice,
argument_list=[])
if total_price >= 0:
return payment.PaymentTransaction_redirectToManualFreePayment(web_site=web_site)
if payment_mode == "wechat":
if payment.Base_getWechatServiceRelativeUrl():
return payment.PaymentTransaction_redirectToManualWechatPayment(web_site=web_site)
elif payment_mode == "payzen":
if payment.Base_getPayzenServiceRelativeUrl():
return payment.PaymentTransaction_redirectToManualPayzenPayment(web_site=web_site)
return payment.PaymentTransaction_redirectToManualContactUsPayment(web_site=web_site)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>id</string> </key>
<value> <string>SaleInvoiceTransaction_redirectToManualSlapOSPayment</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