Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
cb523ac3
Commit
cb523ac3
authored
May 13, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_advanced_ecommerce: add wechat payment
parent
4fe39328
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
734 additions
and
3 deletions
+734
-3
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_checkWechatPaymentStatus.py
...advanced_ecommerce/WebSection_checkWechatPaymentStatus.py
+1
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_checkWechatPaymentStatus.xml
...dvanced_ecommerce/WebSection_checkWechatPaymentStatus.xml
+70
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_finalizeShopping.py
...ns/erp5_advanced_ecommerce/WebSection_finalizeShopping.py
+2
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_finalizeShopping.xml
...s/erp5_advanced_ecommerce/WebSection_finalizeShopping.xml
+1
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPayment.xml
.../erp5_advanced_ecommerce/WebSection_viewWechatPayment.xml
+109
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPayment/your_wechat_payment.xml
...erce/WebSection_viewWechatPayment/your_wechat_payment.xml
+322
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPaymentWidget.xml
...advanced_ecommerce/WebSection_viewWechatPaymentWidget.xml
+58
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPaymentWidget.zpt
...advanced_ecommerce/WebSection_viewWechatPaymentWidget.zpt
+73
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_description.png.png
...merce/advanced_ecommerce_image/wechat_description.png.png
+0
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_description.png.xml
...merce/advanced_ecommerce_image/wechat_description.png.xml
+36
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_image.png.png
...d_ecommerce/advanced_ecommerce_image/wechat_image.png.png
+0
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_image.png.xml
...d_ecommerce/advanced_ecommerce_image/wechat_image.png.xml
+36
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_layout/cart_box.xml
...advanced_ecommerce/advanced_ecommerce_layout/cart_box.xml
+26
-1
No files found.
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_checkWechatPaymentStatus.py
0 → 100644
View file @
cb523ac3
raise
NotImplementedError
(
'You should override this script'
)
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_checkWechatPaymentStatus.xml
0 → 100644
View file @
cb523ac3
<?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>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_finalizeShopping.py
View file @
cb523ac3
...
...
@@ -38,4 +38,5 @@ for amount in sale_order.getAggregatedAmountList():
# clean up shopping cart
context
.
WebSection_resetShoppingCart
()
# Display nice message
context
.
Base_redirect
(
'SaleOrder_viewThankYouMessage'
)
if
not
batch_mode
:
context
.
Base_redirect
(
'SaleOrder_viewThankYouMessage'
)
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_finalizeShopping.xml
View file @
cb523ac3
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
batch_mode=False
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPayment.xml
0 → 100644
View file @
cb523ac3
<?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>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPayment/your_wechat_payment.xml
0 → 100644
View file @
cb523ac3
This diff is collapsed.
Click to expand it.
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPaymentWidget.xml
0 → 100644
View file @
cb523ac3
<?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>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_viewWechatPaymentWidget.zpt
0 → 100644
View file @
cb523ac3
<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
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_description.png.png
0 → 100644
View file @
cb523ac3
7 KB
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_description.png.xml
0 → 100644
View file @
cb523ac3
<?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>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_image.png.png
0 → 100644
View file @
cb523ac3
7.08 KB
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_image/wechat_image.png.xml
0 → 100644
View file @
cb523ac3
<?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>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/advanced_ecommerce_layout/cart_box.xml
View file @
cb523ac3
...
...
@@ -9,7 +9,9 @@
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
<list>
<string>
enabled
</string>
</list>
</value>
</item>
<item>
...
...
@@ -50,6 +52,12 @@
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
...
...
@@ -69,6 +77,10 @@
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
cart_box
</string>
</value>
...
...
@@ -87,4 +99,17 @@
</dictionary>
</pickle>
</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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment