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
137
Merge Requests
137
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
ed76588a
Commit
ed76588a
authored
1 year ago
by
Jérome Perrin
Committed by
Arnaud Fontaine
7 months ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paypal_secure_payment: python3 support
parent
f489b972
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
bt5/erp5_paypal_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PaypalService.py
...lateItem/portal_components/document.erp5.PaypalService.py
+9
-9
No files found.
bt5/erp5_paypal_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PaypalService.py
View file @
ed76588a
...
@@ -26,15 +26,18 @@
...
@@ -26,15 +26,18 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
import
zope
import
contextlib
from
six.moves.urllib.parse
import
urlencode
from
six.moves.urllib.parse
import
urlencode
from
six.moves.urllib.request
import
urlopen
,
Request
from
six.moves.urllib.request
import
urlopen
,
Request
import
zope.interface
from
zLOG
import
LOG
,
DEBUG
from
zLOG
import
LOG
,
DEBUG
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.interface.IPaymentService
import
IPaymentService
from
erp5.component.interface.IPaymentService
import
IPaymentService
@
zope
.
interface
.
implementer
(
IPaymentService
)
@
zope
.
interface
.
implementer
(
IPaymentService
)
class
PaypalService
(
XMLObject
):
class
PaypalService
(
XMLObject
):
"""Paypal Service for payment"""
"""Paypal Service for payment"""
...
@@ -57,10 +60,7 @@ class PaypalService(XMLObject):
...
@@ -57,10 +60,7 @@ class PaypalService(XMLObject):
"""See Payment Service Interface Documentation"""
"""See Payment Service Interface Documentation"""
def
_getFieldList
(
self
,
paypal_dict
):
def
_getFieldList
(
self
,
paypal_dict
):
field_list
=
[]
return
list
(
paypal_dict
.
items
())
for
k
,
v
in
paypal_dict
.
iteritems
():
field_list
.
append
((
k
,
v
))
return
field_list
def
navigate
(
self
,
REQUEST
=
None
,
**
kw
):
def
navigate
(
self
,
REQUEST
=
None
,
**
kw
):
"""See Payment Service Interface Documentation"""
"""See Payment Service Interface Documentation"""
...
@@ -96,13 +96,13 @@ class PaypalService(XMLObject):
...
@@ -96,13 +96,13 @@ class PaypalService(XMLObject):
param_dict
[
"cmd"
]
=
"_notify-validate"
param_dict
[
"cmd"
]
=
"_notify-validate"
if
"service"
in
param_dict
:
if
"service"
in
param_dict
:
param_dict
.
pop
(
"service"
)
param_dict
.
pop
(
"service"
)
param_list
=
urlencode
(
param_dict
)
param_list
=
urlencode
(
param_dict
)
.
encode
()
paypal_url
=
self
.
getLinkUrlString
()
paypal_url
=
self
.
getLinkUrlString
()
request
=
Request
(
paypal_url
,
param_list
)
request
=
Request
(
paypal_url
,
param_list
)
request
.
add_header
(
"Content-type"
,
"application/x-www-form-urlencoded"
)
request
.
add_header
(
"Content-type"
,
"application/x-www-form-urlencoded"
)
response
=
urlopen
(
request
)
with
contextlib
.
closing
(
urlopen
(
request
))
as
response
:
status
=
response
.
read
()
status
=
response
.
read
()
LOG
(
"PaypalService status"
,
DEBUG
,
status
)
LOG
(
"PaypalService status"
,
DEBUG
,
status
)
method_id
=
self
.
_getTypeBasedMethod
(
"reportPaymentStatus"
).
id
method_id
=
self
.
_getTypeBasedMethod
(
"reportPaymentStatus"
).
id
getattr
(
self
.
activate
(),
method_id
)(
response_dict
=
REQUEST
.
form
)
getattr
(
self
.
activate
(),
method_id
)(
response_dict
=
REQUEST
.
form
)
return
status
==
"VERIFIED"
return
status
==
b"VERIFIED"
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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