This package is inteded to integrate html payment form which happens outside of Plone as easy as possible by using forms and adapters generated by PloneFormGen.
Once the package is quickinstalled, you need to configure authentication code calculation from Site Setup >> Payment Config
You may configure payment settings locally to Form Folders.
Fields
MERCHANT_ID
AMOUNT
ORDER_NUMBER
REFERENCE_NUMBER
ORDER_DESCRIPTION
CURRENCY
RETURN_ADDRESS
CANCEL_ADDRESS
PENDING_ADDRESS
NOTIFY_ADDRESS
TYPE
CULTURE
PRESELECTED_METHOD
MODE
VISIBLE_METHODS
GROUP
Create Form where payment process starts: FormFolder1
Edit >> Overrides >> Custom Success Action
traverse_to:string:formfolder2
- formfolder2 is the next form where the confirmation happens.
Add Decimal Field with id named AMOUNT.
Plone automatically set id from title, but with lower cases. To set id upper cases, you may need to change it, for example from Contents tab.
Optionally if you want to send email or show results after the successful payment, add Custom Script Adapter here and describe to script body something like:
items = dict( AMOUNT=request.form["AMOUNT"], topic=request.form["topic"] ) request.SESSION.set("collective.pfg.payment", items)This means that AMOUNT and topic fields are stored in session and can be displayed after the successful payment.
Create another Form: FormFolder2
Edit >> Overrides >> Custom Form Action
View >> Actions >> Make Order Number Aware
Change the numbering behavior if necessary.
Here you may set the payment configuration locally. This will overrides global configuration.
Add all of the next fields with String Field.
MERCHANT_ID
AMOUNT
ORDER_NUMBER
REFERENCE_NUMBER
ORDER_DESCRIPTION
CURRENCY
RETURN_ADDRESS
CANCEL_ADDRESS
PENDING_ADDRESS
NOTIFY_ADDRESS
TYPE
CULTURE
PRESELECTED_METHOD
MODE
VISIBLE_METHODS
GROUP
AUTHCODE
The field ids must be upper cases.
These fields below needs to be configured
- MERCHANT_ID
- Edit >> Default
13466
- ORDER_NUMBER
- Edit >> Overrides >> Default Expression
python:here.restrictedTraverse('number')()
- CURRENCY
- Edit >> Default
EUR
- RETURN_ADDRESS
- Edit >> Overrides >> Default Expression
string:${portal_url}/formfolder3/thank-you/@@payment-succeeded
- Assuming that FormFolder3 will be created under plone root.
- If field values are not necessary to be sent by e-mail or displayed after successful payment, you can give different address here and FormFolder3 is not necessary.
- CANCEL_ADDRESS
- Edit >> Overrides >> Default Expression
string:${portal_url}/formfolder1
- Assuming that FormFolder1 is created under plone root.
- NOTIFY_ADDRESS
- Edit >> Overrides >> Default Expression
string:${portal_url}
- TYPE
- Edit >> Default
S1
- CULTURE
- Edit >> Default
fi_FI
- MODE
- Edit >> Default
1
- AUTHCODE
- Edit >> Overrides >> Default Expression
python:here.restrictedTraverse('auth-code')
In case e-mails need to be sent and field values displayed after the successful payment.
We use thank-you page automatically created under FormFolder3.
To show the field values, you need to add or copy the original field which were in FormFolder1 to this FormFolder.
- The type of field need to be the same as the original one.
- For example, if you want to show topic and AMOUNT, String Field with id topic and Decimal Number Field with id AMOUNT need to be added under FormFolder3.
Use zc.buildout and the plone.recipe.zope2instance recipe to manage packages:
Add collective.pfg.payment to the list of eggs to install, e.g.:
[buildout] ... eggs = ... collective.pfg.payment
Re-run buildout, e.g. with:
$ ./bin/buildout