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
1
Issues
1
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
erp5
Commits
eca31be5
Commit
eca31be5
authored
Oct 21, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and add some comments.
parent
95420164
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
...yzen_secure_payment/DocumentTemplateItem/PayzenService.py
+19
-19
bt5/erp5_payzen_secure_payment/bt/revision
bt5/erp5_payzen_secure_payment/bt/revision
+1
-1
No files found.
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
View file @
eca31be5
...
@@ -26,6 +26,9 @@ else:
...
@@ -26,6 +26,9 @@ else:
SOAP protocol is assumed as untrusted and dangerous, users of those methods
SOAP protocol is assumed as untrusted and dangerous, users of those methods
are encouraged to log such messages for future debugging."""
are encouraged to log such messages for future debugging."""
def
_check_transcationInfoSignature
(
self
,
data
):
def
_check_transcationInfoSignature
(
self
,
data
):
"""Checks transactionInfo signature
Can raise.
"""
received_sorted_keys
=
[
'errorCode'
,
'extendedErrorCode'
,
received_sorted_keys
=
[
'errorCode'
,
'extendedErrorCode'
,
'transactionStatus'
,
'shopId'
,
'paymentMethod'
,
'contractNumber'
,
'transactionStatus'
,
'shopId'
,
'paymentMethod'
,
'contractNumber'
,
'orderId'
,
'orderInfo'
,
'orderInfo2'
,
'orderInfo3'
,
'transmissionDate'
,
'orderId'
,
'orderInfo'
,
'orderInfo2'
,
'orderInfo3'
,
'transmissionDate'
,
...
@@ -44,26 +47,23 @@ else:
...
@@ -44,26 +47,23 @@ else:
'refundDevise'
,
'litige'
,
'timestamp'
]
'refundDevise'
,
'litige'
,
'timestamp'
]
signature
=
''
signature
=
''
for
k
in
received_sorted_keys
:
for
k
in
received_sorted_keys
:
try
:
v
=
getattr
(
data
,
k
,
None
)
v
=
getattr
(
data
,
k
)
if
v
is
None
:
except
AttributeError
:
# empty or not transmitted: add as empty string
# not transmitted: just add +
v
=
''
signature
+=
'+'
elif
k
in
[
'transmissionDate'
,
'presentationDate'
,
'cardExpirationDate'
,
else
:
'markDate'
,
'authDate'
,
'captureDate'
]
\
if
k
in
[
'transmissionDate'
,
'presentationDate'
,
'cardExpirationDate'
,
or
isinstance
(
v
,
datetime
.
datetime
):
'markDate'
,
'authDate'
,
'captureDate'
]:
# dates (or field like dates) shall be converted to YYYYMMDD
# crazyiness again
if
isinstance
(
v
,
datetime
.
datetime
):
if
isinstance
(
v
,
datetime
.
datetime
):
v
=
v
.
strftime
(
'%Y%m%d'
)
v
=
v
.
strftime
(
'%Y%m%d'
)
else
:
v
=
time
.
strftime
(
'%Y%m%d'
,
time
.
strptime
(
str
(
v
),
'%Y-%m-%d %H:%M:%S'
))
if
v
is
not
None
:
v
=
str
(
v
)
else
:
else
:
# empty transmitted: just add +
# defensive: maybe date-like field is represented not as datetime?
v
=
''
v
=
time
.
strftime
(
'%Y%m%d'
,
time
.
strptime
(
str
(
v
),
signature
+=
v
+
'+'
'%Y-%m-%d %H:%M:%S'
))
# convert to string (there could be ints, longs, etc)
v
=
str
(
v
)
signature
+=
v
+
'+'
signature
+=
self
.
getServicePassword
()
signature
+=
self
.
getServicePassword
()
signature
=
hashlib
.
sha1
(
signature
).
hexdigest
()
signature
=
hashlib
.
sha1
(
signature
).
hexdigest
()
return
signature
==
data
.
signature
return
signature
==
data
.
signature
...
...
bt5/erp5_payzen_secure_payment/bt/revision
View file @
eca31be5
33
34
\ No newline at end of file
\ No newline at end of file
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