Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Boxiang Sun
slapos.core
Commits
b6d5296f
Commit
b6d5296f
authored
Sep 23, 2019
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Generate QRCode base on the code_url which returned by Wechat
parent
3c54323f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
11 deletions
+69
-11
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Base_generateWechatQRCodeFromCodeURL.py
...scription_request/Base_generateWechatQRCodeFromCodeURL.py
+2
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Base_generateWechatQRCodeFromCodeURL.xml
...cription_request/Base_generateWechatQRCodeFromCodeURL.xml
+62
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
...est/SubscriptionRequestModule_requestSubscriptionProxy.py
+5
-11
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Base_generateWechatQRCodeFromCodeURL.py
0 → 100644
View file @
b6d5296f
# inspired by Pack_generateCode128BarcodeImage in sanef-evl project
return
context
.
Base_generateBarcodeImage
(
'qrcode'
,
code_url
)
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Base_generateWechatQRCodeFromCodeURL.xml
0 → 100644
View file @
b6d5296f
<?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>
code_url
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_generateWechatQRCodeFromCodeURL
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
View file @
b6d5296f
...
@@ -3,27 +3,20 @@ from DateTime import DateTime
...
@@ -3,27 +3,20 @@ from DateTime import DateTime
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
raise
Unauthorized
# You always needs a user here
# You always needs a user here
person
,
person_is_new
=
context
.
SubscriptionRequest_createUser
(
email
,
user_input_dict
[
'name'
])
person
,
person_is_new
=
context
.
SubscriptionRequest_createUser
(
email
,
user_input_dict
[
'name'
])
web_site
=
context
.
getWebSiteValue
()
web_site
=
context
.
getWebSiteValue
()
# Check if user is already exist, otherwise redirect to ask confirmation
# order.js seems use SubscriptionRequestModule_requestSubscriptionProxy abused...
# if payment mode not selected, ask user to confirm and select one.
# In the first time, order.js call SubscriptionRequestModule_requestSubscriptionProxy
if
not
payment_mode
:
# which the "payment_mode" is not selected yet.
# which will use payzen by default
# we should always let user confirm and select payment mode
if
confirmation_required
:
# if confirmation_required and not person_is_new:
base_url
=
web_site
.
absolute_url
()
base_url
=
web_site
.
absolute_url
()
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
"%s/#order_confirmation?name=%s&email=%s&amount=%s&subscription_reference=%s"
%
(
"%s/#order_confirmation?name=%s&email=%s&amount=%s&subscription_reference=%s"
%
(
base_url
,
base_url
,
person
.
getTitle
(),
person
.
getTitle
(),
person
.
getDefaultEmailText
()
,
email
,
user_input_dict
[
"amount"
],
user_input_dict
[
"amount"
],
subscription_reference
))
subscription_reference
))
...
@@ -53,10 +46,11 @@ if batch_mode:
...
@@ -53,10 +46,11 @@ if batch_mode:
if
payment_mode
==
"wechat"
:
if
payment_mode
==
"wechat"
:
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
code_url
=
portal
.
Base_getWechatCodeURL
(
subscription_request
.
getId
(),
payment
.
PaymentTransaction_getTotalPayablePrice
(),
user_input_dict
[
"amount"
])
code_url
=
portal
.
Base_getWechatCodeURL
(
subscription_request
.
getId
(),
payment
.
PaymentTransaction_getTotalPayablePrice
(),
user_input_dict
[
"amount"
])
code_url
=
"weixin://wxpay/bizpayurl/up?pr=NwY5Mz9&groupid=00"
web_site
=
context
.
getWebSiteValue
()
web_site
=
context
.
getWebSiteValue
()
base_url
=
web_site
.
absolute_url
()
base_url
=
web_site
.
absolute_url
()
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
"%s/#wechat_payment?amount=%s
"
%
(
base_url
,
user_input_dict
[
"amount"
]
))
"%s/#wechat_payment?amount=%s
&code_url=%s"
%
(
base_url
,
user_input_dict
[
"amount"
],
code_url
))
def
wrapRedirectWithShadow
(
payment_transaction
,
web_site
):
def
wrapRedirectWithShadow
(
payment_transaction
,
web_site
):
return
payment_transaction
.
PaymentTransaction_redirectToManualPayzenPayment
(
web_site
)
return
payment_transaction
.
PaymentTransaction_redirectToManualPayzenPayment
(
web_site
)
...
...
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