Forums / Developer / Here is an ez3 e-commerce payment gateway solution... almost (help!)

Here is an ez3 e-commerce payment gateway solution... almost (help!)

Author Message

Sol Millin

Monday 21 April 2003 3:58:56 am

I've just about 'cracked it'. (read on... if you're interested in making the ez3 shop talk to a payment gateway)

All that remains is to know how to populate the html form to the payment gateway with the data from the order header (customer names, total amount including VAT, etc.)

I don't know enough about template variables and template functions yet.

HELP!!

Description of ez3 shop processing

Assume shopping site is at www.demo.ez3

The first I did was create in admin, a standard workflow (I called mine 'eWay Connect').

In the triggers section of admin I then edited triggers and selected this workflow for the trigger 'Shop/Checkout/before'.

Go into www.demo.ez3/index.php, select the shop and select a few items into your shopping cart.

http://www.demo.ez3/index.php/shop/confirmorder/
is the URI which has the confirm button in it which when pressed will invoke the checkout URI
With existing ez3 templates, and with the rules used within index.php, because the shop is section 5 of demo,
design\demo\override\templates\pagelayout_section_5.tpl
is invoked with the embedded main body
{$module_result.content}
being the output of:
design\standard\templates\shop\confirmorder.tpl
In addition, before execution kernel\shop\confirmorder.php is also 'automatically' invoked and processed as part of the tpl output.

When the 'Confirm' button is selected by the user

http://www.demo.ez3/index.php/shop/checkout/
is invoked.
Index.php interprets this URI as, load pagelayout_section_5.tpl and embeds/executes the code found at URI /kernel/shop/checkout.php
However, there is a database trigger already existing in demo as follows:
Field name Data description
id 1 Trigger id
name Pre_checkout Name of trigger
module shop Invoke ..\kernel\shop\module when
trigger executed
function checkout ..\kernel\shop\checkout.php function
to invoke when trigger executed
connect_type b before
workflow_id 2 eWay connect workflow

As part of this execution (prior to display to the client) ez3 fetches and processes the template associated with the pre_checkout trigger, which is
design\standard\templates\workflow\eventtype\result\event_ezcheckout.tpl

Why? Well, I suppose there are internal rules within ez3 that say something like this:
Is an event associated with the URI shop/checkout? Yes there is.
Is it a pre or post event? It's a pre checkout event. Ah ha!
The template associated with this event is searched for, initially in
design\demo\override\templates\workflow\eventtype\result\event_ezcheckout.tpl
If this does not exist, use the template to be found at
design\standard\templates\workflow\eventtype\result\event_ezcheckout.tpl
and displays the results in the main body of pagelayout_section_5.tpl (ie {$module_result.content} ) as per the other internal rules of ez3.
It is now necessary to understand how to access the order total and customer details to allow them to be passed to the payment gateway (in my case eWay)
A form needs to be included in the 'override' ezcheckout.tpl in the appropriate demo/override directory, that uses the HTTP POST method which replaces the little dummy one delivered with ezcheckout.tpl in the standard ez3 directory which displays heading 'Check Out' and an empty text field and button labeled 'next'.
The following code fragment is an example of what is required:

<table border="1" width="70%" cellspacing="0" cellpadding="5" bordercolor="#000080">
<tr>
<td width="22%" valign="top"><p class="subtitle"><a href="http://www.eway.com.au" target="_blank"><img alt="eWAY - a total e commerce solution" border="0" height="91" src="http://www.eway.com.au/images/logos/eway.gif" width="200"></a></p></td>
<td width="78%" valign="top" bgcolor="#ffffff"> <form method="post" action="https://www.eway.com.au/gateway/payment.asp">
<input type="hidden" name="ewayCustomerID" value="87654321">
<input type="hidden" name="ewayTotalAmount" value="10">
<input type="hidden" name="ewayCustomerFirstName" value="Roxarne">
<input type="hidden" name="ewayCustomerLastName" value="Paton">
<input type="hidden" name="ewayCustomerEmail" value="sales@eway.com.au">
<input type="hidden" name="ewayCustomerAddress" value="18 Mayne Street Parkes NSW">
<input type="hidden" name="ewayCustomerPostcode" value="2870">
<input type="hidden" name="ewayCustomerInvoiceDescription" value="ASP code e-postcard">
<input type="hidden" name="ewayCustomerInvoiceRef" value="webactive002">
<input type="hidden" name="ewayURL" value="http://www.demo.ez3">
<input type="hidden" name="ewaySiteTitle" value="myez3Site">

<p><input type="submit" value="Process Secure Credit Card Transaction using eWAY" name="submit"></p>
</form>
</td>
</tr>
</table>
As may be seen, this array is POST'ed using https to the eway URI, namely:
https://www.eWAY.com.au/gateway/payment.asp
This all works, believe it or not.
It displays correctly in www.demo.ez3 in the checkout screen.
It connects correctly with eway via an https connection
eway processes it correctly, and returns to www.demo.ez3
however...

My final problem is:

HOW DO I POPULATE THE EWAY VARIABLES WITH THE ORDER HEADER AND TOTAL VARIABLES SUCH AS {$order.total_inc_vat} which is available and used in design\standard\templates\shop\confirmorder.tpl

All help would be greatly appreciated.

With many thanks,

Sol Millin
byron bay
australia

James Smith

Monday 21 April 2003 5:12:03 am

Great work, hope you get it sorted. EZ is a great CMS, but it is not realy set up for commerce gateways. A shop is not functional without a payment gateway. I have a feeling that commerce ez contracted clients had their shops set up for them, otherwise they would probably give back to the community how they did it, which is normal open source practice.

The forums are surprisingly quiet on this important subject.

geovanni rosetto

Monday 21 April 2003 1:33:36 pm

James,
There is lots of greed when it becomes to sharing things, and code it's not an exception.

--
geo

Sergiy Pushchin

Wednesday 23 April 2003 12:29:31 am

We will write a tutorial for this. And after that it will be very eazy to write your own gateways.

--SP

Claire Lin

Monday 28 April 2003 12:33:23 pm

If possible, can you inform me when the tutorial will be available? Waiting time seems to pass faster when one know what to expect. :) If the tutotial will not be available soon, can anyone on the ez team gives some quick pointers as to how to use variables in the basket object? I tried to simply copy and past some template variables in the basket template file, but they are not accessible. It appears that I need add php files and include necessary librarys (the question is: what are necessar?)

Jørgen Skogstad

Thursday 01 May 2003 3:15:00 am

Yeah .. would love it if you could share information on this. We were actually thinking of implementing a mechanism to export the order in a xml format .. which is ready for import into our billing system (Mamut Enterprise for those Norwegians out there). Not hard.. but still .. a nice to have feature .. for those running those kind of sites.

.. of course; online payment gatewaying would be an aditional feature!

This kind of documentation would be ideal for the wiki, right??

Kindest,
Jørgen Skogstad

krish harry

Monday 08 September 2003 3:58:00 am

When are you planning to release tutorials? Please do help / suggest.

Francisco Altea

Monday 08 September 2003 7:20:34 am

I guess people can upload their contributions to whatever payment solutions they might come up with. But first when will the documentation come out? I was looking around at the e-commerce sites in the reference sections and most of the sites are using ez 2.2 and I was wondering if anybody know which payment modules these sites are using? Maybe these guys can contribute their payment modules to the open source community.

Paul Forsyth

Tuesday 09 September 2003 1:20:00 am

Have a read of this thread:

http://ez.no/content/view/full/31650/

Paul

Tim Madden

Friday 23 July 2004 10:38:49 pm

Hi Sol,

Did you every get your shop processing through eway?

cheers
tim

eZ debug

Timing: Jan 18 2025 02:54:03
Script start
Timing: Jan 18 2025 02:54:03
Module start 'content'
Timing: Jan 18 2025 02:54:03
Module end 'content'
Timing: Jan 18 2025 02:54:03
Script end

Main resources:

Total runtime0.8585 sec
Peak memory usage4,096.0000 KB
Database Queries231

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.0859180.7969
Module start 'content' 0.00610.7187 769.8828890.2656
Module end 'content' 0.72480.1336 1,660.1484353.2734
Script end 0.8584  2,013.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4775210.0002
Check MTime0.00150.1711210.0001
Mysql Total
Database connection0.00090.106910.0009
Mysqli_queries0.751887.57292310.0033
Looping result0.00230.26632290.0000
Template Total0.829596.620.4148
Template load0.00220.254920.0011
Template processing0.827396.372320.4137
Template load and register function0.00010.012810.0001
states
state_id_array0.00060.075410.0006
state_identifier_array0.00070.084920.0004
Override
Cache load0.00210.24471170.0000
Sytem overhead
Fetch class attribute can translate value0.00130.1492110.0001
Fetch class attribute name0.00100.1148120.0001
XML
Image XML parsing0.00520.6071110.0005
class_abstraction
Instantiating content class attribute0.00000.0021120.0000
General
dbfile0.01001.1613330.0003
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
19content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 43
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs