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
140
Merge Requests
140
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
4eeaeb3c
Commit
4eeaeb3c
authored
Feb 14, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paypal_secure_payment: python3 support
parent
9afd49ee
Changes
1
Show 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 @
4eeaeb3c
...
...
@@ -26,15 +26,18 @@
# 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.request
import
urlopen
,
Request
import
zope.interface
from
zLOG
import
LOG
,
DEBUG
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.interface.IPaymentService
import
IPaymentService
@
zope
.
interface
.
implementer
(
IPaymentService
)
class
PaypalService
(
XMLObject
):
"""Paypal Service for payment"""
...
...
@@ -57,10 +60,7 @@ class PaypalService(XMLObject):
"""See Payment Service Interface Documentation"""
def
_getFieldList
(
self
,
paypal_dict
):
field_list
=
[]
for
k
,
v
in
paypal_dict
.
iteritems
():
field_list
.
append
((
k
,
v
))
return
field_list
return
list
(
paypal_dict
.
items
())
def
navigate
(
self
,
REQUEST
=
None
,
**
kw
):
"""See Payment Service Interface Documentation"""
...
...
@@ -96,13 +96,13 @@ class PaypalService(XMLObject):
param_dict
[
"cmd"
]
=
"_notify-validate"
if
"service"
in
param_dict
:
param_dict
.
pop
(
"service"
)
param_list
=
urlencode
(
param_dict
)
param_list
=
urlencode
(
param_dict
)
.
encode
()
paypal_url
=
self
.
getLinkUrlString
()
request
=
Request
(
paypal_url
,
param_list
)
request
.
add_header
(
"Content-type"
,
"application/x-www-form-urlencoded"
)
response
=
urlopen
(
request
)
with
contextlib
.
closing
(
urlopen
(
request
))
as
response
:
status
=
response
.
read
()
LOG
(
"PaypalService status"
,
DEBUG
,
status
)
method_id
=
self
.
_getTypeBasedMethod
(
"reportPaymentStatus"
).
id
getattr
(
self
.
activate
(),
method_id
)(
response_dict
=
REQUEST
.
form
)
return
status
==
"VERIFIED"
\ No newline at end of file
return
status
==
b"VERIFIED"
\ 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