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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
francois
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
Show 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:
SOAP protocol is assumed as untrusted and dangerous, users of those methods
are encouraged to log such messages for future debugging."""
def
_check_transcationInfoSignature
(
self
,
data
):
"""Checks transactionInfo signature
Can raise.
"""
received_sorted_keys
=
[
'errorCode'
,
'extendedErrorCode'
,
'transactionStatus'
,
'shopId'
,
'paymentMethod'
,
'contractNumber'
,
'orderId'
,
'orderInfo'
,
'orderInfo2'
,
'orderInfo3'
,
'transmissionDate'
,
...
...
@@ -44,25 +47,22 @@ else:
'refundDevise'
,
'litige'
,
'timestamp'
]
signature
=
''
for
k
in
received_sorted_keys
:
try
:
v
=
getattr
(
data
,
k
)
except
AttributeError
:
# not transmitted: just add +
signature
+=
'+'
else
:
if
k
in
[
'transmissionDate'
,
'presentationDate'
,
'cardExpirationDate'
,
'markDate'
,
'authDate'
,
'captureDate'
]:
# crazyiness again
v
=
getattr
(
data
,
k
,
None
)
if
v
is
None
:
# empty or not transmitted: add as empty string
v
=
''
elif
k
in
[
'transmissionDate'
,
'presentationDate'
,
'cardExpirationDate'
,
'markDate'
,
'authDate'
,
'captureDate'
]
\
or
isinstance
(
v
,
datetime
.
datetime
):
# dates (or field like dates) shall be converted to YYYYMMDD
if
isinstance
(
v
,
datetime
.
datetime
):
v
=
v
.
strftime
(
'%Y%m%d'
)
else
:
# defensive: maybe date-like field is represented not as datetime?
v
=
time
.
strftime
(
'%Y%m%d'
,
time
.
strptime
(
str
(
v
),
'%Y-%m-%d %H:%M:%S'
))
if
v
is
not
None
:
# convert to string (there could be ints, longs, etc)
v
=
str
(
v
)
else
:
# empty transmitted: just add +
v
=
''
signature
+=
v
+
'+'
signature
+=
self
.
getServicePassword
()
signature
=
hashlib
.
sha1
(
signature
).
hexdigest
()
...
...
bt5/erp5_payzen_secure_payment/bt/revision
View file @
eca31be5
33
\ No newline at end of file
34
\ 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