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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
f64940ab
Commit
f64940ab
authored
Aug 11, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_wechat_secure_payment: Extend Wechat implement so we can test it
See merge request
nexedi/erp5!1480
parents
93f1017d
23ddbe61
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
316 additions
and
3 deletions
+316
-3
bt5/erp5_wechat_secure_payment/DocumentTemplateItem/portal_components/document.erp5.WechatService.py
...lateItem/portal_components/document.erp5.WechatService.py
+9
-3
bt5/erp5_wechat_secure_payment/PropertySheetTemplateItem/portal_property_sheets/WechatService/wechat_spbill_create_ip_property.xml
...sheets/WechatService/wechat_spbill_create_ip_property.xml
+38
-0
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view.xml
...l_skins/erp5_wechat_secure_payment/WechatService_view.xml
+1
-0
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view/my_wechat_mode.xml
...chat_secure_payment/WechatService_view/my_wechat_mode.xml
+4
-0
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view/my_wechat_spbill_create_ip.xml
...payment/WechatService_view/my_wechat_spbill_create_ip.xml
+264
-0
No files found.
bt5/erp5_wechat_secure_payment/DocumentTemplateItem/portal_components/document.erp5.WechatService.py
View file @
f64940ab
...
@@ -118,16 +118,22 @@ class WechatService(XMLObject):
...
@@ -118,16 +118,22 @@ class WechatService(XMLObject):
def
callWechatApi
(
self
,
URL
,
wechat_dict
):
def
callWechatApi
(
self
,
URL
,
wechat_dict
):
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
base_url
=
portal
.
absolute_url
()
wechat_url
=
self
.
getLinkUrlString
()
wechat_url
=
self
.
getLinkUrlString
()
if
self
.
getWechatMode
()
==
"SANDBOX"
:
if
self
.
getWechatMode
()
==
"SANDBOX"
:
key
=
self
.
getSandboxKey
()
key
=
self
.
getSandboxKey
()
elif
self
.
getWechatMode
()
==
"UNITTEST"
:
return
{
"result_code"
:
'SUCCESS'
,
"code_url"
:
'weixin://wxpay/bizpayurl?pr=AAAAA'
}
else
:
else
:
key
=
self
.
getServiceApiKey
()
key
=
self
.
getServiceApiKey
()
nonce_str
=
self
.
generateRandomStr
()
nonce_str
=
self
.
generateRandomStr
()
wechat_spbill_create_ip
=
self
.
getWechatSpbillCreateIp
()
if
not
wechat_spbill_create_ip
:
base_url
=
portal
.
absolute_url
()
result
=
urlparse
(
base_url
)
result
=
urlparse
(
base_url
)
spbill_create_ip
=
socket
.
gethostbyname
(
result
.
netloc
)
spbill_create_ip
=
socket
.
gethostbyname
(
result
.
netloc
)
else
:
spbill_create_ip
=
socket
.
gethostbyname
(
wechat_spbill_create_ip
)
# Construct parameter for calling the Wechat payment URL
# Construct parameter for calling the Wechat payment URL
wechat_dict
[
'appid'
]
=
self
.
getServiceAppid
()
wechat_dict
[
'appid'
]
=
self
.
getServiceAppid
()
...
...
bt5/erp5_wechat_secure_payment/PropertySheetTemplateItem/portal_property_sheets/WechatService/wechat_spbill_create_ip_property.xml
0 → 100644
View file @
f64940ab
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
wechat_spbill_create_ip_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
wechat_mode
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view.xml
View file @
f64940ab
...
@@ -99,6 +99,7 @@
...
@@ -99,6 +99,7 @@
<string>
my_reference
</string>
<string>
my_reference
</string>
<string>
my_wechat_mode
</string>
<string>
my_wechat_mode
</string>
<string>
my_service_mch_id
</string>
<string>
my_service_mch_id
</string>
<string>
my_wechat_spbill_create_ip
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view/my_wechat_mode.xml
View file @
f64940ab
...
@@ -243,6 +243,10 @@
...
@@ -243,6 +243,10 @@
<string>
PRODUCTION
</string>
<string>
PRODUCTION
</string>
<string>
PRODUCTION
</string>
<string>
PRODUCTION
</string>
</tuple>
</tuple>
<tuple>
<string>
UNITTEST
</string>
<string>
UNITTEST
</string>
</tuple>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
bt5/erp5_wechat_secure_payment/SkinTemplateItem/portal_skins/erp5_wechat_secure_payment/WechatService_view/my_wechat_spbill_create_ip.xml
0 → 100644
View file @
f64940ab
This diff is collapsed.
Click to expand it.
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