collective.pfg.payment

by Taito Horiuchi last modified Apr 19, 2011 11:54 PM

Extends PloneFormGen to payment form.

Project Description

Introduction

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.

Currently tested with

  • Plone-3.3.5
  • Plone-4.1b2
  • Products.PloneFormGen-1.6.0

Example use case

  1. On Plone site, input some price amount on form.
  2. Confirm the amount and go to payment page outside of Plone.
  3. Process the payment.
  4. Go back to Plone site.

General Setup

Once the package is quickinstalled, you need to configure authentication code calculation from Site Setup >> Payment Config

MAC Code
This code is provided by payment provider.
Fields
Input field names which will be used for the calculation line by line.
Separator
Input separator between field values if necessary.
Capital
Check this if calculated authentication code need to be upper cases.

You may configure payment settings locally to Form Folders.

Tested HTML Interfaces and their configurations

Verkkomakust S1 (Finland)

MAC Code
6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ

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

Separator
| (Vertical bar)
Capital
Checked

Example use case

  1. 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.
  2. 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.

  3. Create another Form: FormFolder2

    Edit >> Overrides >> Custom Form Action

    https://payment.verkkomaksut.fi/

    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.

  4. 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')

  1. Create another Form: FormFolder3

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.

Changelog

0.2.0 (2011-04-16)

  • Added local payment configuration for multiple payment processors.

0.1.1 (2011-04-15)

  • Capital check fixed to be updated in Payment Config page.

0.1.0 (2011-04-15)

  • Initial release

Installation

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
    

Credits

  • Pekka Saari from the Finnish Association for Nature Conservation (Suomen Luonnonsuojeluliitto) who uses this package in their site: http://www.sll.fi

Self-Certification

[ ] Internationalized

[X] Unit tests

[X] End-user documentation

[X] Internal documentation (documentation, interfaces, etc.)

[ ] Existed and maintained for at least 6 months

[X] Installs and uninstalls cleanly

[X] Code structure follows best practice

Current Release

No stable release available yet.

All Releases

Version Released Description Compatibility Licenses Status
0.2.0 Added local payment configuration for multiple payment processors. More about this release…
Plone 4
Plone 3
GPL pre-release
0.1.1 Fixed Capital check on Payment Config. More about this release…
Plone 4
Plone 3
GPL pre-release
0.1.0 More about this release… GPL pre-release