This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Here is an ez3 e-commerce payment...
expandshrink

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

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

Monday 21 April 2003 12:58:56 pm - 9 replies

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

Modified on Tuesday 22 April 2003 1:18:19 am by Sol Millin

Monday 21 April 2003 2:12:03 pm

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.

Monday 21 April 2003 10:33:36 pm

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

--
geo

Wednesday 23 April 2003 9:29:31 am

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

--SP

Monday 28 April 2003 9: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. happy.gif Emoticon 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?)

Thursday 01 May 2003 12:15:00 pm

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

Monday 08 September 2003 12:58:00 pm

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

Monday 08 September 2003 4:20:34 pm

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.

Modified on Monday 08 September 2003 4:28:22 pm by Francisco Altea

Tuesday 09 September 2003 10:20:00 am

Have a read of this thread:

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

Paul

Saturday 24 July 2004 7:38:49 am

Hi Sol,

Did you every get your shop processing through eway?

cheers
tim

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from