Commit b4c6d186 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_secure_payment: Migrate Tool and Interface from filesystem.

parent ce827903
Pipeline #10622 failed with stage
in 0 seconds
...@@ -31,9 +31,9 @@ from urllib import urlencode ...@@ -31,9 +31,9 @@ from urllib import urlencode
from urllib2 import urlopen, Request from urllib2 import urlopen, Request
from zLOG import LOG, DEBUG from zLOG import LOG, DEBUG
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces 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
class PaypalService(XMLObject): class PaypalService(XMLObject):
"""Paypal Service for payment""" """Paypal Service for payment"""
...@@ -41,7 +41,7 @@ class PaypalService(XMLObject): ...@@ -41,7 +41,7 @@ class PaypalService(XMLObject):
meta_type = 'Paypal Service' meta_type = 'Paypal Service'
portal_type = 'Paypal Service' portal_type = 'Paypal Service'
security = ClassSecurityInfo() security = ClassSecurityInfo()
zope.interface.implements(interfaces.IPaymentService) zope.interface.implements(IPaymentService)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
import zope import zope
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
import hashlib import hashlib
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
...@@ -258,11 +258,12 @@ finally: ...@@ -258,11 +258,12 @@ finally:
del(os.environ['TZ']) del(os.environ['TZ'])
time.tzset() time.tzset()
from erp5.component.interface.IPaymentService import IPaymentService
class PayzenService(XMLObject, PayzenSOAP): class PayzenService(XMLObject, PayzenSOAP):
meta_type = 'Payzen Service' meta_type = 'Payzen Service'
portal_type = 'Payzen Service' portal_type = 'Payzen Service'
zope.interface.implements(interfaces.IPaymentService) zope.interface.implements(IPaymentService)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
############################################################################## ##############################################################################
""" """
Products.ERP5SecurePayment.interfaces.payment_service erp5.component.interface.IPaymentService
""" """
from zope.interface import Interface from zope.interface import Interface
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IPaymentService</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5SecurePayment.interfaces.payment_service</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IPaymentService</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -33,9 +33,10 @@ ...@@ -33,9 +33,10 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value> <string>Payment Tool goals are to provide a unique interface to buy/sell on ERP5 instances.\n
<none/> \n
</value> You need to have a Payement Gateway with reference egal to "default" to make payment.\n
Other reference can be used for specific purpose.</string> </value>
</item> </item>
<item> <item>
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
......
...@@ -27,16 +27,10 @@ ...@@ -27,16 +27,10 @@
# #
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Permissions import ManagePortal
from Products.ERP5Type.Globals import DTMLFile
from Products.ERP5SecurePayment import _dtmldir
from Products import ERP5Security from Products import ERP5Security
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from zLOG import LOG
class SecurePaymentTool(BaseTool): class SecurePaymentTool(BaseTool):
""" """
...@@ -48,11 +42,6 @@ class SecurePaymentTool(BaseTool): ...@@ -48,11 +42,6 @@ class SecurePaymentTool(BaseTool):
meta_type = 'ERP5 Secure Payment Tool' meta_type = 'ERP5 Secure Payment Tool'
portal_type = 'Secure Payment Tool' portal_type = 'Secure Payment Tool'
# Declarative Security
security = ClassSecurityInfo()
security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile('explainPaymentTool', _dtmldir )
def find(self, service_reference="default"): def find(self, service_reference="default"):
"""Search a payment service by reference""" """Search a payment service by reference"""
if service_reference: if service_reference:
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Tool Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SecurePaymentTool</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5SecurePayment.Tool.SecurePaymentTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tool.erp5.SecurePaymentTool</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Tool Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
interface.erp5.IPaymentService
\ No newline at end of file
tool.erp5.SecurePaymentTool
\ No newline at end of file
import zope import zope
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
import random, string, hashlib, urllib2, socket import random, string, hashlib, urllib2, socket
...@@ -15,7 +15,7 @@ class WechatException(Exception): ...@@ -15,7 +15,7 @@ class WechatException(Exception):
def __init__(self, msg): def __init__(self, msg):
super(WechatException, self).__init__(msg) super(WechatException, self).__init__(msg)
from erp5.component.interface.IPaymentService import IPaymentService
class WechatService(XMLObject): class WechatService(XMLObject):
meta_type = 'Wechat Service' meta_type = 'Wechat Service'
portal_type = 'Wechat Service' portal_type = 'Wechat Service'
...@@ -23,7 +23,7 @@ class WechatService(XMLObject): ...@@ -23,7 +23,7 @@ class WechatService(XMLObject):
ORDER_URL = "/pay/unifiedorder" # Wechat unified order API ORDER_URL = "/pay/unifiedorder" # Wechat unified order API
QUERY_URL = "/pay/orderquery" QUERY_URL = "/pay/orderquery"
zope.interface.implements(interfaces.IPaymentService) zope.interface.implements(IPaymentService)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Francois-Xavier Algrain <fxalgrain@tiolive.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
"""
ERP5 Secure Payment is a product containing everything needed to do secure payment on ERP5
"""
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import sys
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals())
from Tool import SecurePaymentTool
# Define object classes and tools
object_classes = ()
portal_tools = (SecurePaymentTool.SecurePaymentTool,
)
content_classes = ()
content_constructors = ()
# Finish installation
def initialize(context):
import Document
initializeProduct(context, this_module, globals(),
document_module=Document,
document_classes=document_classes,
object_classes=object_classes,
portal_tools=portal_tools,
content_constructors=content_constructors,
content_classes=content_classes)
##############################################################################
#
# Copyright (c) 2006-2010 Nexedi SA and Contributors. All Rights Reserved.
# Ivan Tyagov <ivan@nexedi.com>
# Lukasz Nowak <luke@nexedi.com>
#
# Contains secret information.
#
##############################################################################
# The path of modulev2.cgi for Paybox.
PAYBOX_MODULEV2_CGI = '/var/lib/erp5/modulev2.cgi'
# The path of the public key for Paybox.
PAYBOX_PUBLIC_KEY = '/var/lib/erp5/paybox_pubkey.pem'
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<h3>Explain Payment Tool</h3>
<p>
Payment Tool goals are to provide a unique interface to buy/sell on ERP5 instances.
</p>
<p>
You need to have a Payement Gateway with reference egal to "default" to make payment.
Other reference can be used for specific purpose.
</p>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment