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
Noah Brackenbury
erp5
Commits
e5b9bfac
Commit
e5b9bfac
authored
Oct 06, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement getFormString.
parent
5e770080
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
2 deletions
+179
-2
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
...yzen_secure_payment/DocumentTemplateItem/PayzenService.py
+35
-1
bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml
...zen_secure_payment/Base_getPayzenServicePaymentConfig.xml
+74
-0
bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml
...kins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml
+69
-0
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 @
e5b9bfac
import
zope
import
hashlib
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.XMLObject
import
XMLObject
...
...
@@ -47,7 +48,40 @@ class PayzenService(XMLObject):
# proposed methods
def
getFormString
(
self
,
document
,
**
kw
):
"""Returns form string of against passed document"""
"""Returns unterminated form for current document
The responsiblity of the caller is to finish the form."""
self
.
Base_checkConsistency
()
content_kw
=
dict
()
content_kw
[
'vads_action_mode'
]
=
self
.
getPayzenVadsActionMode
()
content_kw
[
'vads_amount'
]
=
int
(
document
.
getTotalPrice
()
*
100
)
integration_tool
=
self
.
restrictedTraverse
(
self
.
getIntegrationSite
())
content_kw
[
'vads_currency'
]
=
integration_tool
.
getMappingFromCategory
(
'resource/currency_module/%s'
%
document
.
getPriceCurrencyReference
()
).
split
(
'/'
)[
-
1
]
content_kw
[
'vads_ctx_mode'
]
=
self
.
getPayzenVadsCtxMode
()
content_kw
[
'vads_page_action'
]
=
self
.
getPayzenVadsPageAction
()
content_kw
[
'vads_payment_config'
]
=
document
\
.
Base_getPayzenServicePaymentConfig
()
content_kw
[
'vads_site_id'
]
=
self
.
getServiceUsername
()
# date as YYYYMMDDHHMMSS
content_kw
[
'vads_trans_date'
]
=
document
.
getStartDate
().
strftime
(
'%Y%m%d%H%M%S'
)
content_kw
[
'vads_trans_id'
]
=
document
.
Base_getPayzenTransId
()
content_kw
[
'vads_version'
]
=
self
.
getPayzenVadsVersion
()
# all data are completed, now it is time to create signature
sorted_keys
=
content_kw
.
keys
()
sorted_keys
.
sort
()
signature
=
''
form
=
'<FORM METHOD="POST" ACTION="%s">
\
n
'
%
self
.
getLinkUrlString
()
for
k
in
sorted_keys
:
v
=
str
(
content_kw
[
k
])
signature
+=
v
+
'+'
form
+=
'<INPUT TYPE="HIDDEN" NAME="%s" VALUE="%s">
\
n
'
%
(
k
,
v
)
signature
+=
self
.
getServicePassword
()
form
+=
'<INPUT TYPE="HIDDEN" NAME="signature" VALUE="%s">'
%
\
hashlib
.
sha1
(
signature
).
hexdigest
()
return
form
def
getSignature
(
self
,
document
):
"""Returns signature for current document"""
...
...
bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml
0 → 100644
View file @
e5b9bfac
<?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>
_body
</string>
</key>
<value>
<string>
"""Returns vads_payment_config for current document\n
\n
Default implementation returns single payment operation (SINGLE)\n
\n
It is possible to configure it on application level.\n
"""\n
\n
return "SINGLE"\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getPayzenServicePaymentConfig
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml
0 → 100644
View file @
e5b9bfac
<?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>
_body
</string>
</key>
<value>
<string>
"""Script shall return payzen compatible transaction id"""\n
\n
return context.getReference()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getPayzenTransId
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_payzen_secure_payment/bt/revision
View file @
e5b9bfac
17
\ No newline at end of file
18
\ 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