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
Labels
Merge Requests
143
Merge Requests
143
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
2bad96ee
Commit
2bad96ee
authored
Feb 14, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
payzen_secure_payment: python3 support
parent
f7a1bd67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
...lateItem/portal_components/document.erp5.PayzenService.py
+1
-1
bt5/erp5_payzen_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PayzenSecurePayment.py
...ortal_components/test.erp5.testERP5PayzenSecurePayment.py
+6
-6
No files found.
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
View file @
2bad96ee
...
@@ -141,7 +141,7 @@ class PayzenService(XMLObject, PayzenREST):
...
@@ -141,7 +141,7 @@ class PayzenService(XMLObject, PayzenREST):
v
=
str
(
v
)
v
=
str
(
v
)
signature
+=
v
+
'+'
signature
+=
v
+
'+'
signature
+=
self
.
getServicePassword
()
signature
+=
self
.
getServicePassword
()
return
hashlib
.
sha1
(
signature
).
hexdigest
()
return
hashlib
.
sha1
(
signature
.
encode
(
'utf-8'
)
).
hexdigest
()
def
_getFieldList
(
self
,
payzen_dict
):
def
_getFieldList
(
self
,
payzen_dict
):
payzen_dict
.
update
(
payzen_dict
.
update
(
...
...
bt5/erp5_payzen_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PayzenSecurePayment.py
View file @
2bad96ee
...
@@ -112,19 +112,19 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
...
@@ -112,19 +112,19 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
def
test_getSignature_dict_simple
(
self
):
def
test_getSignature_dict_simple
(
self
):
self
.
assertEqual
(
self
.
assertEqual
(
self
.
service
.
_getSignature
({
'key'
:
'value'
},
[
'key'
]),
self
.
service
.
_getSignature
({
'key'
:
'value'
},
[
'key'
]),
sha1
(
'value+'
+
self
.
service_password
)
sha1
(
(
'value+'
+
self
.
service_password
).
encode
()
)
)
)
def
test_getSignature_dict_key_sort
(
self
):
def
test_getSignature_dict_key_sort
(
self
):
self
.
assertEqual
(
self
.
assertEqual
(
self
.
service
.
_getSignature
({
'key'
:
'value'
,
'key1'
:
'value1'
},
[
'key'
,
self
.
service
.
_getSignature
({
'key'
:
'value'
,
'key1'
:
'value1'
},
[
'key'
,
'key1'
]),
'key1'
]),
sha1
(
'value+value1+'
+
self
.
service_password
)
sha1
(
(
'value+value1+'
+
self
.
service_password
).
encode
()
)
)
)
self
.
assertEqual
(
self
.
assertEqual
(
self
.
service
.
_getSignature
({
'key'
:
'value'
,
'key1'
:
'value1'
},
[
'key1'
,
self
.
service
.
_getSignature
({
'key'
:
'value'
,
'key1'
:
'value1'
},
[
'key1'
,
'key'
]),
'key'
]),
sha1
(
'value1+value+'
+
self
.
service_password
)
sha1
(
(
'value1+value+'
+
self
.
service_password
).
encode
()
)
)
)
def
test_getSignature_dict_date_as_datetime
(
self
):
def
test_getSignature_dict_date_as_datetime
(
self
):
...
@@ -132,7 +132,7 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
...
@@ -132,7 +132,7 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
d
=
{
'key'
:
now
}
d
=
{
'key'
:
now
}
self
.
assertEqual
(
self
.
assertEqual
(
self
.
service
.
_getSignature
(
d
,
[
'key'
]),
self
.
service
.
_getSignature
(
d
,
[
'key'
]),
sha1
(
now
.
strftime
(
'%Y%m%d'
)
+
'+'
+
self
.
service_password
)
sha1
(
(
now
.
strftime
(
'%Y%m%d'
)
+
'+'
+
self
.
service_password
).
encode
()
)
)
)
# dict was updated
# dict was updated
self
.
assertEqual
(
d
[
'key'
],
now
)
self
.
assertEqual
(
d
[
'key'
],
now
)
...
@@ -154,8 +154,8 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
...
@@ -154,8 +154,8 @@ class TestERP5PayzenSecurePayment(TestERP5PayzenSecurePaymentMixin):
self
.
portal
.
changeSkin
(
None
)
self
.
portal
.
changeSkin
(
None
)
try
:
try
:
result
=
self
.
service
.
navigate
(
pt_id
,
{
"key"
:
'value'
})
result
=
self
.
service
.
navigate
(
pt_id
,
{
"key"
:
'value'
})
signature
=
sha1
(
'value+INTERACTIVE+ERP5+TEST+REGISTER+SINGLE+0123456+V2+'
signature
=
sha1
(
(
'value+INTERACTIVE+ERP5+TEST+REGISTER+SINGLE+0123456+V2+'
+
self
.
service_password
)
+
self
.
service_password
)
.
encode
())
self
.
assertEqual
(
result
,
"""key=key value=value
self
.
assertEqual
(
result
,
"""key=key value=value
key=signature value=%s
key=signature value=%s
key=vads_action_mode value=INTERACTIVE
key=vads_action_mode value=INTERACTIVE
...
...
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