[getpaid commit] r2684 - Cleaning up source and moving parts to PloneGetPaid branch

0 views
Skip to first unread message

codesite...@google.com

unread,
Jun 9, 2009, 12:10:51 PM6/9/09
to getpaid...@groups.google.com
Author: mi...@redinnovation.com
Date: Tue Jun 9 09:09:57 2009
New Revision: 2684

Removed:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/profiles/
Modified:
getpaid.paymentprocessors/trunk/README.txt

getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/admin.py

getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/overrides.zcml
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/configure.zcml
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/directives.py
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/registry.py
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/base.py

getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/test_zcml.py

Log:
Cleaning up source and moving parts to PloneGetPaid branch

Modified: getpaid.paymentprocessors/trunk/README.txt
==============================================================================
--- getpaid.paymentprocessors/trunk/README.txt (original)
+++ getpaid.paymentprocessors/trunk/README.txt Tue Jun 9 09:09:57 2009
@@ -1,20 +1,27 @@
This is initial code for supporting multiple payment processors on getpaid
site.

-This code is unfinished - do not touch until ask permission, ok? :)
+Purpose
+-------
+
+This package provides generic payment processor registration methods.
Though the code itself is without Plone dependencies,
+payment processor code is documented here.

Installation
------------

As the last GetPaid plug in, add ''getpaid.paymentprocessers'' egg to
your ''zcml'' direction in ''buildout.cfg''.

+Use branch
https://getpaid.googlecode.com/svn/Products.PloneGetPaid/branches/multiplepaymentprocessors
as Products.PloneGetPaid::
+
+ cd src
+ rm -rf Products.PloneGetPaid
+ svn co
https://getpaid.googlecode.com/svn/Products.PloneGetPaid/branches/multiplepaymentprocessors
Products.PloneGetPaid
+

Architecture
------------

-Payment processor logic code is registered as usual.
-
-To enable multiple payment processor support in the user interface,
-payment processors register several views::
+Payment processors are registered using a ZCML directive.

<paymentprocessors:registerProcessor
name="dummy"
@@ -23,7 +30,68 @@

thank_you_view="getpaid.paymentprocessors.tests.dummies.DummyThankYou"
/>

-To see available registration options, please read directives.py /
IRegisterPaymentProcessorDirective.
+Each view is the view name what is used to render the corresponding part.
Those must map to registered <browser:page> objects.
+
+To see available directive attributes, please read directives.py /
IRegisterPaymentProcessorDirective.
+
+Payment processor registry is available in
getpaid.paymentprocessors.registry.paymentProcessorRegistry. This registry
+holds the data of registered payment processor code objects. Active
payment processors are determined by Products.PloneGetPaid.
+
+Payment processors are described by Entry objects which simply hold the
information provided by IRegisterPaymentProcessorDirective.
+
+To get active payment processors call::
+
+ from Products.PloneGetPaid import payment
+
+ processors = payment.getActivePaymentProcessors(context) # context = any
Plone site object
+
+UI drop ins
+-----------
+
+selection_view
+==============
+
+This is a <tr> element which is rendered on the checkout payment method
selection page. It contains three columns:
+
+ - Name/logo, preferably an image <button>
+
+ - Description
+
+ - Plain text <button> "Use this method"
+
+There is context variable "processor" available which referse to
registered Entry object of the payment processors.
+
+<button> elements must have name which can be obtained from the context::
+
+other views
+===========
+
+Other UI drop ins are normal <browser:page> views.
+
+Checkout
+--------
+
+A checkout wizard contains a step "checkout-payment-method" which allows
the user to select the wanted payment method.
+
+This
+
+Administration
+--------------
+
+GetPaid admin interface has page "" where the site manager can enable
payment processors and enter to the payment processor settings pages.
+
+Each payment processor setting page must be uniquely named. This goes
against the prior GetPaid best practice to have just one page.
+
+Active payment processor names are stored in portal_properties as
LinesField::
+
+ portal_properties.payment_processor_properties.enabled_processors
+
+
+Testing
+-------
+
+Non-plone related functionality is tested in
getpaid.paymentprocessors.tests. This mainly involves testing ZCML validy.

+Plone related functionality is tested in
Products.PloneGetPaid.tests.test_payment_processors.

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/admin.py
==============================================================================
---
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/admin.py
(original)
+++
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/admin.py
Tue Jun 9 09:09:57 2009
@@ -22,7 +22,7 @@

from Products.PloneGetPaid import interfaces, pkg_home

-from getpaid.paymentprocessors.registry import paymentProcessorUIRegistry
+from getpaid.paymentprocessors.registry import paymentProcessorRegistry

import Products.PloneGetPaid.browser.admin as base
import Products.PloneGetPaid.interfaces as igetpaid
@@ -77,7 +77,7 @@

@return: Iterable of Processor objects
"""
- return paymentProcessorUIRegistry.getProcessors()
+ return papaymentProcessorRegistryProcessors()

def processForm(self):
""" Manage HTTP post """
@@ -85,7 +85,7 @@

# Add some level of safety
for a in actived:
- if not a in paymentProcessorUIRegistry.getNames():
+ if not a in paympaymentProcessorRegistrymes():
raise RuntimeError("Tried to enable unsupported
processor %s" % a)


self.context.portal_properties.payment_processor_properties.enabled_processors
= actived

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/overrides.zcml
==============================================================================
---
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/overrides.zcml
(original)
+++
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/browser/overrides.zcml
Tue Jun 9 09:09:57 2009
@@ -2,55 +2,5 @@
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:five="http://namespaces.zope.org/five">

- <!-- Override checkout wizard to prompt a page to choose a payment
method -->
- <browser:page
- for="*"
- name="getpaid-checkout-wizard"
- class=".selector.PaymentMethodSelectionView"
- template="templates/payment_method_selection.pt"
- permission="zope2.View"
- />
-
- <!-- Override thank you page to redirect the request to the right
payment method thank you page -->
- <browser:page
- for="*"
- name="getpaid-thank-you"
- class=".selector.ThankYouView"
- attribute="render"
- permission="zope2.View"
- />
-
- <!-- Management Payment Options Editing - Change payment processor
selection from dropdown to multiple choice -->
- <browser:page
- for="getpaid.core.interfaces.IStore"
- name="manage-getpaid-payment-options"
- class=".admin.PaymentOptions"
- permission="cmf.ManagePortal"
- menu="getpaid_settings"
- title="Payment Options"
- allowed_attributes="site_url"
- />
-
- <!-- Choose payment processor which settings to edit -->
- <browser:page
- for="getpaid.core.interfaces.IStore"
- name="manage-getpaid-payment-processor"
- class=".admin.PaymentProcessorsConfigurationView"
- permission="cmf.ManagePortal"
- menu="getpaid_settings"
- title="Payment Processors"
- template="templates/choose_payment_processors_settings.pt"
- />
-
- <!-- Management Payment Processor Editing -->
- <browser:page
- for="getpaid.core.interfaces.IStore"
- name="manage-getpaid-payment-processor-options"
- class=".admin.PaymentProcessor"
- permission="cmf.ManagePortal"
- menu="getpaid_settings"
- title="Payment Processor Settings"
- />
-

</configure>

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/configure.zcml
==============================================================================
---
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/configure.zcml
(original)
+++
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/configure.zcml
Tue Jun 9 09:09:57 2009
@@ -4,15 +4,5 @@

<include file="meta.zcml" />

- <include package=".browser" />
-
- <!-- Register the installation GenericSetup extension profile -->
- <genericsetup:registerProfile
- name="default"
- title="Multiple payment processor support"
- directory="profiles/default"
- description=""
- provides="Products.GenericSetup.interfaces.EXTENSION"
- />
-
+
</configure>

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/directives.py
==============================================================================
--- getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/directives.py
(original)
+++ getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/directives.py
Tue Jun 9 09:09:57 2009
@@ -31,7 +31,7 @@

import getpaid.core

-from registry import Entry, paymentProcessorUIRegistry
+from registry import paymentProcessorRegistry, Entry

class IRegisterPaymentProcessorDirective(Interface):
""" Register payment processor with the global registry.
@@ -72,6 +72,5 @@
if not
getpaid.core.interfaces.IPaymentProcessor.implementedBy(processor):
raise ConfigurationError("Payment processor directive does not
implement IPaymentProcessor interface:" + str(processor))

-
- paymentProcessorUIRegistry.register(entry)
+ paymentProcessorRegistry.register(entry)


Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/registry.py
==============================================================================
--- getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/registry.py
(original)
+++ getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/registry.py
Tue Jun 9 09:09:57 2009
@@ -61,7 +61,7 @@
view = self._getViewByName(context, request, self.settings_view)
return view

-class PaymentProcessorUIRegistry:
+class PaymentProcessorRegistry:
""" Payment processor configuration data holder.

For possible parameters, see
directives.IRegisterPaymentProcessorDirective
@@ -90,6 +90,6 @@
""" Return payment processor registry entry by its name. """
return self.registry[name]

-paymentProcessorUIRegistry = PaymentProcessorUIRegistry()
+paymentProcessorRegistry = PaymentProcessorRegistry()

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/base.py
==============================================================================
--- getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/base.py
(original)
+++ getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/base.py
Tue Jun 9 09:09:57 2009
@@ -12,9 +12,7 @@
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneGetPaid.tests.base import PloneGetPaidTestCase

-from getpaid.paymentprocessors.registry import paymentProcessorUIRegistry
-
-@onsetup
+from getpaid.paymentprocessors.registry import
paymentProcessorRegistry@onsetup
def setup_package():
fiveconfigure.debug_mode = True
import getpaid.paymentprocessors
@@ -32,7 +30,7 @@
def afterSetUp( self ):
""" Since ZCML loads happen process life cycle, we need to unload
ZCML on every step """
PloneGetPaidTestCase.afterSetUp(self)
- paymentProcessorUIRegistry.clear()
+ papaymentProcessorRegistryar()


def loadDummyZCML(self, string):

Modified:
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/test_zcml.py
==============================================================================
---
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/test_zcml.py
(original)
+++
getpaid.paymentprocessors/trunk/getpaid/paymentprocessors/tests/test_zcml.py
Tue Jun 9 09:09:57 2009
@@ -5,9 +5,7 @@
from Products.Five import zcml
from zope.configuration.exceptions import ConfigurationError

-from getpaid.paymentprocessors.registry import paymentProcessorUIRegistry
-
-
+from getpaid.paymentprocessors.registry import paymentProcessorRegistry
configure_zcml = '''
<configure
xmlns="http://namespaces.zope.org/zope"
@@ -51,7 +49,7 @@
zcml.load_string(configure_zcml)

# See that our processor got registered
- self.assertEqual(len(paymentProcessorUIRegistry.registry.items()),
1)
+ self.assertEqual(len(papaymentProcessorRegistryistry.items()), 1)

def test_bad_processor(self):
""" Check that ZCML entry which has bad processor declaration is
caught """

Reply all
Reply to author
Forward
0 new messages