Commit 8b2a1731 authored by Xiaowu Zhang's avatar Xiaowu Zhang

Wechat payment

See merge request !1123
parents 4ec60c39 5feaeac4
Pipeline #9447 failed with stage
in 0 seconds
<?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>trade_no,**kw</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>WebSection_checkWechatPaymentStatus</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -38,4 +38,5 @@ for amount in sale_order.getAggregatedAmountList(): ...@@ -38,4 +38,5 @@ for amount in sale_order.getAggregatedAmountList():
# clean up shopping cart # clean up shopping cart
context.WebSection_resetShoppingCart() context.WebSection_resetShoppingCart()
# Display nice message # Display nice message
context.Base_redirect('SaleOrder_viewThankYouMessage') if not batch_mode:
context.Base_redirect('SaleOrder_viewThankYouMessage')
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>batch_mode=False</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_wechat_payment</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewWechatPayment</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewWechatPayment</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewWechatPaymentWidget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:define="payment_url python: request.get('payment_url', '');
price python: int(request.get('price', '0')) / 100.0;
trade_no python: request.get('trade_no', '')
" >
<p>请使用微信扫描下方二维码来完成支付</p>
<input id='trade_no' type="hidden" tal:attributes="value python: trade_no">
<h2 style="float:left;">支付 <span tal:content="python: price"></span> 元</h2>
<div style="clear:both"></div>
<div style="position:absolute;left:50%;">
<div class='qr_code' position='relative'>
<div class="qr_code_wrapper" style="line-height: 300px;
display:none;
text-align: center;
position: absolute;
font-size: 14px;
color: #fff;
background: rgba(0,0,0,.6);
width: 300px;
height: 300px;
cursor: pointer;">
<span style='display: block;font-size: 14px;color: #fff;margin-top: 10px;'>请点击继续</span>
</div>
<img class="wechat_qrcode" width="294" style="border: 1px solid grey;"
tal:attributes="src python:'Base_generateBarcodeImage?barcode_type=qrcode&data=%s' % payment_url">
</div>
<img src="advanced_ecommerce_image/wechat_description.png" width="300">
</div>
<script>
$(document).ready(function() {
var timer = 0,
wrapper = $(".qr_code_wrapper"),
trade_no = $('#trade_no').val(),
loop;
function restartCheckingIfNeeded() {
timer += 1;
if (timer > 40) {
wrapper.css("display", "block");
} else {
console.log('restart')
setTimeout(checkPaymentStatus, 3000);
}
}
function checkPaymentStatus(){
$.ajax({
url:'WebSection_checkWechatPaymentStatus',
data:{
trade_no: trade_no
},
success:function(result_dict){
result_dict = JSON.parse(result_dict);
if (result_dict['status'] == 'success') {
window.location.href="SaleOrder_viewThankYouMessage";
} else if (result_dict['status'] == 'cancelled') {
window.location.href="?portal_status_message=订单已取消"
} else {
restartCheckingIfNeeded();
}
},
error: function (error){
console.log(error);
restartCheckingIfNeeded();
}
});
}
checkPaymentStatus()
wrapper.click(function() {
timer = 0;
wrapper.css("display", "none");
setTimeout(checkPaymentStatus, 3000)
});
});
</script>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>wechat_description.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>86</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>260</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>wechat_image.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>86</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>103</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<item> <item>
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list/> <list>
<string>enabled</string>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -50,6 +52,12 @@ ...@@ -50,6 +52,12 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -69,6 +77,10 @@ ...@@ -69,6 +77,10 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>cart_box</string> </value> <value> <string>cart_box</string> </value>
...@@ -87,4 +99,17 @@ ...@@ -87,4 +99,17 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: not request.get(\'payment_url\', None) and len(here.SaleOrder_getShoppingCartItemList())</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>WC</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>WC</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>wechat</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Wechat</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test023WechatPayment</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Front Page</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Front Page</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/ZuiteAdvancedECommerce_CommonTemplate/macros/login_as_super_user" />
<tr>
<td>openAndWait</td>
<td>${base_url}/PurchasePackingList_deliver</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Done</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tal:block metal:use-macro="here/ZuiteAdvancedECommerce_CommonTemplate/macros/logout" />
<tal:block metal:use-macro="here/ZuiteAdvancedECommerce_CommonTemplate/macros/reset_shopcart" />
<tr>
<td>setTimeout</td>
<td>300000</td>
<td></td>
</tr>
<tr>
<td>openAndWait</td>
<td>${base_url}/web_site_module/ecommerce_example</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="header_login"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(@href, "test_normal_product")]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//select[@name="field_your_buy_quantity"]</td>
<td>2</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Add to cart"]</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Added to cart.</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//td[@class="cart_middle"]//div[contains(text(), "280")]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//div[@class="left"]//div[contains(@class, "checkout")]//a[contains(@href, "cart")]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[contains(@class, "shopping_cart_renderer")]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="wechat"]</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Shopping Cart Updated</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Update Shipping Method"]</td>
<td>
</tr>
<tr>
<td>check</td>
<td>//input[@value="service_module/test_deliver_mode"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Update Shipping Method"]</td>
<td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Confirm Order"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="__ac_name"]</td>
<td>1</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="__ac_password"]</td>
<td>1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Login"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@value="Proceed to Payment"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//img[@class="wechat_qrcode"]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//span[contains(text(), '282.0')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='qr_code_wrapper' and contains(@style,'display: block')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@class='qr_code_wrapper' and contains(@style,'display: block')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//div[@class='qr_code_wrapper' and contains(@style,'display: block')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='qr_code_wrapper' and contains(@style,'display: none')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -125,9 +125,7 @@ ...@@ -125,9 +125,7 @@
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <value> <string>2</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
...@@ -306,7 +304,7 @@ ...@@ -306,7 +304,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>983.33462.55055.26197</string> </value> <value> <string>983.57486.40881.52155</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -324,7 +322,7 @@ ...@@ -324,7 +322,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1588089266.61</float> <float>1589446600.14</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -99,6 +99,10 @@ ...@@ -99,6 +99,10 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>no_loyalty_reward_paypal</string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value>
...@@ -113,11 +117,13 @@ ...@@ -113,11 +117,13 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Sale Trade Condition</string> </value> <value> <string>Sale Trade Condition</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>test_sale_trade_condition</string> </value>
</item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <value> <string>2</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
...@@ -296,7 +302,7 @@ ...@@ -296,7 +302,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>983.31553.28432.33262</string> </value> <value> <string>983.57486.40881.52155</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -314,7 +320,7 @@ ...@@ -314,7 +320,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1587975634.77</float> <float>1589446592.66</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Payment Condition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>payment_mode/wechat</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_payment_condition</string> </value>
</item>
<item>
<key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Payment Condition</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1589444608.09</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/test_sale_trade_condition</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -452,6 +452,7 @@ ...@@ -452,6 +452,7 @@
<value> <value>
<tuple> <tuple>
<string>paypal</string> <string>paypal</string>
<string>wechat</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -572,9 +573,7 @@ ...@@ -572,9 +573,7 @@
</item> </item>
<item> <item>
<key> <string>site_delivery_message_template</string> </key> <key> <string>site_delivery_message_template</string> </key>
<value> <value> <string>test_deliver_info</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>site_loyalty_agreement_template</string> </key> <key> <string>site_loyalty_agreement_template</string> </key>
...@@ -582,21 +581,21 @@ ...@@ -582,21 +581,21 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>site_loyalty_explanation_template</string> </key>
<value> <string>test_loyalty_explanation</string> </value>
</item>
<item> <item>
<key> <string>site_map_section_parent</string> </key> <key> <string>site_map_section_parent</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>site_message_template</string> </key> <key> <string>site_message_template</string> </key>
<value> <value> <string>test_site_warning</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>site_payment_message_template</string> </key> <key> <string>site_payment_message_template</string> </key>
<value> <value> <string>test_payment_info</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>site_product_individual_variation</string> </key> <key> <string>site_product_individual_variation</string> </key>
...@@ -610,9 +609,7 @@ ...@@ -610,9 +609,7 @@
</item> </item>
<item> <item>
<key> <string>site_return_message_template</string> </key> <key> <string>site_return_message_template</string> </key>
<value> <value> <string>test_return_info</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>skin_selection_name</string> </key> <key> <string>skin_selection_name</string> </key>
...@@ -848,7 +845,7 @@ ...@@ -848,7 +845,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>super_user</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -862,7 +859,7 @@ ...@@ -862,7 +859,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>983.26197.28731.24251</string> </value> <value> <string>983.57522.65528.2594</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -880,7 +877,7 @@ ...@@ -880,7 +877,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1587654313.75</float> <float>1589446316.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
payment_mode = payment_mode.lower()
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.ERP5Site_getAuthenticatedMemberPersonValue()
context.WebSection_persistShoppingCart(shopping_cart, person) sale_order = context.WebSection_persistShoppingCart(shopping_cart, person)
if payment_mode == 'paypal':
return context.Base_redirect('view', return context.Base_redirect('view',
keep_items={ keep_items={
"portal_status_message": "payment confirmed" "portal_status_message": "payment confirmed"
}) })
if payment_mode == 'wechat':
return context.Base_redirect('wechat_payment',
keep_items={
'trade_no':sale_order.getReference().encode('utf-8'),
'price': int(round((shopping_cart.SaleOrder_getFinalPrice() * 100), 0)),
'payment_url': 'weixin'
})
...@@ -29,3 +29,5 @@ sale_trade_condition_module/test_loyalty_reward_paypal/** ...@@ -29,3 +29,5 @@ sale_trade_condition_module/test_loyalty_reward_paypal/**
service_module/test_loyalty_discount service_module/test_loyalty_discount
service_module/test_loyalty_using_point service_module/test_loyalty_using_point
service_module/test_loyalty_collect_point service_module/test_loyalty_collect_point
sale_trade_condition_module/test_wechat_sale_trade_condition
sale_trade_condition_module/test_wechat_sale_trade_condition/**
\ No newline at end of file
currency_module/test_eur currency_module/test_eur
organisation_module/test_warehouse organisation_module/test_warehouse
portal_categories/colour** portal_categories/colour**
portal_categories/payment_mode/wechat
portal_categories/product_line/shipping/post portal_categories/product_line/shipping/post
portal_categories/size/paris** portal_categories/size/paris**
portal_tests/advanced_ecommerce_zuite portal_tests/advanced_ecommerce_zuite
...@@ -20,6 +21,8 @@ sale_trade_condition_module/test_loyalty_reward_paypal ...@@ -20,6 +21,8 @@ sale_trade_condition_module/test_loyalty_reward_paypal
sale_trade_condition_module/test_loyalty_reward_paypal/** sale_trade_condition_module/test_loyalty_reward_paypal/**
sale_trade_condition_module/test_sale_trade_condition sale_trade_condition_module/test_sale_trade_condition
sale_trade_condition_module/test_sale_trade_condition/** sale_trade_condition_module/test_sale_trade_condition/**
sale_trade_condition_module/test_wechat_sale_trade_condition
sale_trade_condition_module/test_wechat_sale_trade_condition/**
service_module/test_deliver_mode service_module/test_deliver_mode
service_module/test_deliver_mode/** service_module/test_deliver_mode/**
service_module/test_loyalty_collect_point service_module/test_loyalty_collect_point
......
...@@ -248,10 +248,10 @@ class WechatService(XMLObject): ...@@ -248,10 +248,10 @@ class WechatService(XMLObject):
'In Navigate', error=False) 'In Navigate', error=False)
portal = self.getPortalObject() portal = self.getPortalObject()
base_url = portal.absolute_url() base_url = wechat_dict.pop('base_url', '%s/#wechat_payment' % portal.absolute_url())
return self.REQUEST.RESPONSE.redirect( return self.REQUEST.RESPONSE.redirect(
"%s/#wechat_payment?trade_no=%s&price=%s&payment_url=%s" % ( "%s?trade_no=%s&price=%s&payment_url=%s" % (
base_url, base_url,
wechat_dict['out_trade_no'], wechat_dict['out_trade_no'],
wechat_dict['total_fee'], wechat_dict['total_fee'],
......
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