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
Roque
slapos.core
Commits
aa9aa37e
Commit
aa9aa37e
authored
Mar 11, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_payzen: Allow projects to custom the expected html
See merge request
nexedi/slapos.core!498
parents
e00424c1
845c8759
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
101 deletions
+87
-101
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
...m/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
+84
-77
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
.../portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
+3
-24
No files found.
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
View file @
aa9aa37e
...
@@ -16,6 +16,84 @@ vads_url_return = 'http://example.org/return'
...
@@ -16,6 +16,84 @@ vads_url_return = 'http://example.org/return'
class
TestSlapOSPayzenInterfaceWorkflow
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPayzenInterfaceWorkflow
(
SlapOSTestCaseMixinWithAbort
):
slapos_payzen_html
=
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>title</title>
</head>
<body onload="document.payment.submit();">
<form action="%(action)s" id="payment" method="POST" name="payment">
<input name="signature" type="hidden" value="%(signature)s"></input>
<input name="vads_action_mode" type="hidden" value="INTERACTIVE"></input>
<input name="vads_amount" type="hidden" value="%(vads_amount)s"></input>
<input name="vads_contrib" type="hidden" value="ERP5"></input>
<input name="vads_ctx_mode" type="hidden" value="TEST"></input>
<input name="vads_currency" type="hidden" value="%(vads_currency)s"></input>
<input name="vads_language" type="hidden" value="%(vads_language)s"></input>
<input name="vads_order_id" type="hidden" value="%(vads_order_id)s"></input>
<input name="vads_page_action" type="hidden" value="PAYMENT"></input>
<input name="vads_payment_config" type="hidden" value="SINGLE"></input>
<input name="vads_site_id" type="hidden" value="%(vads_site_id)s"></input>
<input name="vads_trans_date" type="hidden" value="%(vads_trans_date)s"></input>
<input name="vads_trans_id" type="hidden" value="%(vads_trans_id)s"></input>
<input name="vads_url_cancel" type="hidden" value="%(vads_url_cancel)s"></input>
<input name="vads_url_error" type="hidden" value="%(vads_url_error)s"></input>
<input name="vads_url_referral" type="hidden" value="%(vads_url_referral)s"></input>
<input name="vads_url_refused" type="hidden" value="%(vads_url_refused)s"></input>
<input name="vads_url_return" type="hidden" value="%(vads_url_return)s"></input>
<input name="vads_url_success" type="hidden" value="%(vads_url_success)s"></input>
<input name="vads_version" type="hidden" value="V2"></input>
<center>
<input type="submit" value="Click to pay"></input>
</center>
</form>
</body>
</html>'''
def
_simulatePaymentTransaction_getTotalPayablePrice
(
self
):
def
_simulatePaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -195,84 +273,13 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
...
@@ -195,84 +273,13 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
.
_getFieldList
(
data_dict
)
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
.
_getFieldList
(
data_dict
)
data_dict
[
'action'
]
=
'https://secure.payzen.eu/vads-payment/'
data_dict
[
'action'
]
=
'https://secure.payzen.eu/vads-payment/'
expected_html_page
=
lxml
.
html
.
tostring
(
if
getattr
(
self
,
"custom_slapos_payzen_html"
,
None
):
lxml
.
html
.
fromstring
(
slapos_payzen_html
=
self
.
custom_slapos_payzen_html
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
else
:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
slapos_payzen_html
=
self
.
slapos_payzen_html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>title</title>
</head>
<body onload="document.payment.submit();">
<form action="%(action)s" id="payment" method="POST" name="payment">
<input name="signature" type="hidden" value="%(signature)s"></input>
<input name="vads_action_mode" type="hidden" value="INTERACTIVE"></input>
<input name="vads_amount" type="hidden" value="%(vads_amount)s"></input>
<input name="vads_contrib" type="hidden" value="ERP5"></input>
expected_html_page
=
lxml
.
html
.
tostring
(
lxml
.
html
.
fromstring
(
slapos_payzen_html
%
data_dict
),
method
=
'c14n'
)
<input name="vads_ctx_mode" type="hidden" value="TEST"></input>
<input name="vads_currency" type="hidden" value="%(vads_currency)s"></input>
<input name="vads_language" type="hidden" value="%(vads_language)s"></input>
<input name="vads_order_id" type="hidden" value="%(vads_order_id)s"></input>
<input name="vads_page_action" type="hidden" value="PAYMENT"></input>
<input name="vads_payment_config" type="hidden" value="SINGLE"></input>
<input name="vads_site_id" type="hidden" value="%(vads_site_id)s"></input>
<input name="vads_trans_date" type="hidden" value="%(vads_trans_date)s"></input>
<input name="vads_trans_id" type="hidden" value="%(vads_trans_id)s"></input>
<input name="vads_url_cancel" type="hidden" value="%(vads_url_cancel)s"></input>
<input name="vads_url_error" type="hidden" value="%(vads_url_error)s"></input>
<input name="vads_url_referral" type="hidden" value="%(vads_url_referral)s"></input>
<input name="vads_url_refused" type="hidden" value="%(vads_url_refused)s"></input>
<input name="vads_url_return" type="hidden" value="%(vads_url_return)s"></input>
<input name="vads_url_success" type="hidden" value="%(vads_url_success)s"></input>
<input name="vads_version" type="hidden" value="V2"></input>
<center>
<input type="submit" value="Click to pay"></input>
</center>
</form>
</body>
</html>'''
%
data_dict
),
method
=
'c14n'
)
# Event message state
# Event message state
event_message_list
=
event
.
contentValues
(
portal_type
=
"Payzen Event Message"
)
event_message_list
=
event
.
contentValues
(
portal_type
=
"Payzen Event Message"
)
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
View file @
aa9aa37e
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenWorkflow
</string>
</value>
<value>
<string>
testSlapOSPayzenWorkflow
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
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