Hi,
Based on prior discussion on this list I have been trying to wrap my mind
around the following problem
1) Some payment processors host checkout @@review-and-pay page on the
external payment processor web site - the user is usually taken here by a
form submit/HTTP redirect
2) If multiple payment processors are present the checkout wizard must know
whether there is internal payment processor specific @@review-and-pay page
or should the user go some other server
Effectively: checkout wizard pages must include some condition to pick
wizard step content from many alternatives
Following is my proposal how to solve this:
1) IWizardStep has method isActive() to determine whether step is "active"
based on external conditions (context) and prior wizard choices
(wizard.data)
2) Multiple IWizardStep can be registered with the same
name(@@review-and-pay) - we use zope.component subscriber pattern instead of
zope.component adapter pattern by allowing multiple registrations with the
same name
3) IWizardSteps are evaluated in the order of egg/ZCML registration -
looping through all registered subscribers and picking the first one which
thinks it's active
4) The first IWizardStep where isActive() evaluates to true is picked.
Effectively: GoogleCheckoutStep is registered as @@review-and-pay with
isActive(wizard.data) which checks whether the @@choose-payment-processor
step set the wizard.data.payment_method == "google_checkout"). If
wizard.data.payment_method != "google_checkout" pick default
@@review-and-pay page
5) Payment processor specific wizard steps HTTP redirects or Javascript
redirects to external payment page (Google checkout)
Problems: This pattern does not yet solve 1) dynamically inserting and
removing wizard steps 2) Dynamically settings wizard.next_step
Below my code sketch:
class IWizardConditionalStep(IWizardStep):
""" Allow dynamic reconfiguration of executed wizard steps.
The step content can be overridden based on external conditions
and conditions in the wizard data (prior user choices).
Conditional steps are registered using zope.component subscriber
pattern.
Difference betwen IWizardStep and IWizardConditionalStep is
that IWizardConditionalStep is registered using subscriber pattern
instread of multiadapter pattern, allowing us to define
several, non-conflicting, adapters for the same step name.
"""
def isActive():
""" Should this wizard step be evaluated.
Conditional steps are evaluated in the order eggs/ZCML
have been registered. Firstly registered conditional step returning
True on isActive() takes priority.
Use self.wizard.data and self.wizard.context to read condition
input.
@return True: This step overrides the step defined in the wizard
controllor workflow
@return False: Bubble through and pick some other step version
(default)
"""
--
Mikko Ohtamaa
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"getpaid-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/getpaid-dev?hl=en
-~----------~----~----~----~------~----~------~--~---