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
Levin Zimmermann
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
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):
def
callWechatApi
(
self
,
URL
,
wechat_dict
):
portal
=
self
.
getPortalObject
()
base_url
=
portal
.
absolute_url
()
wechat_url
=
self
.
getLinkUrlString
()
if
self
.
getWechatMode
()
==
"SANDBOX"
:
key
=
self
.
getSandboxKey
()
elif
self
.
getWechatMode
()
==
"UNITTEST"
:
return
{
"result_code"
:
'SUCCESS'
,
"code_url"
:
'weixin://wxpay/bizpayurl?pr=AAAAA'
}
else
:
key
=
self
.
getServiceApiKey
()
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
)
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
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 @@
<string>
my_reference
</string>
<string>
my_wechat_mode
</string>
<string>
my_service_mch_id
</string>
<string>
my_wechat_spbill_create_ip
</string>
</list>
</value>
</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 @@
<string>
PRODUCTION
</string>
<string>
PRODUCTION
</string>
</tuple>
<tuple>
<string>
UNITTEST
</string>
<string>
UNITTEST
</string>
</tuple>
</list>
</value>
</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
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"StringField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_wechat_spbill_create_ip
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
<item>
<key>
<string>
required_not_found
</string>
</key>
<value>
<string>
Input is required but no input given.
</string>
</value>
</item>
<item>
<key>
<string>
too_long
</string>
</key>
<value>
<string>
Too much input was given.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Custom value, else it will use portal\'s ip.
</string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string>
text
</string>
</value>
</item>
<item>
<key>
<string>
max_length
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
IP of your server
</string>
</value>
</item>
<item>
<key>
<string>
truncate
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
unicode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</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