Here are the details for anyone interested. Please note that I did not write this code, I only worked on the specs and implementation into Freeform and front-end development, so I probably won’t be able to answer any in-depth questions.
This does the credit card transaction after the page validation.
This extension uses a freeform hook to grab data from Freeform, send it to EWAY and process the result. It stores most of the post variables in a session variable, and masks part of the CC number before passing it along to the database.
There are three files:
1. /system/extensions/ext.eway.php - The main extension for Eway. This creates an eway object and pulls in xml data functions from:
2. /system/extensions/eway/eway-payment.php - This is a helper library for accessing the EWAY Gateway.
3. /system/extensions/ext.ccpreprocessed.php uses a hook, to stop the CC number from being entered into the DB.
This enables us to have the full details of the users data entered into the DB before being sent onto E-Way. Then after the data has been stored in the DB the ext.eway.php code does the E-WAY transaction and updates the DB directly with the result.
To have a form use the extension it must have a hidden field with use_eway2_ext in it, and post the following fields ‘first_name’, ‘last_name’, ‘email’,’state’, ‘os_state’, ‘address1’,’address2’,’country’,’postcode,’trans_id’,’cardholder_name’,’credit_card_number’,’expiry_month’,’expiry_year’,’dollar_amount’.
Most of those fields are required by eway.
A session variable called “EWAY” is set with a value of OK if the transaction was successful, and an error message if it was not successful.
To make the transactions go live set the $use_live_server variable to true in this file. /system/extensions/eway/eway-payment.php
We chose to have the cc number obscured, so the entries in the DB look like this: ######XXXXXXX### (where # is a number and X is an obscured number).
PLEASE NOTE: This will probably only work with these patches.
Also, to make the form action https instead of http, you will need to use one of these methods.
eway.tgz (File Size: 5KB - Downloads: 89)