Page 1 of 1

Barclays ePDQ Payments/Gateway

Posted: Sun Oct 11, 2009 6:30 am
by pezza
Hi,

I am just running the demo at the moment, and cannot seem to see where i can add a "custom" gateway.

I currently use Barclays ePDQ and would need to ensure that i can link my custom routines, including payment update status etc if i decided to migrate to AbleCommerce.

Can anyone advise if it is possible to select a custom gateway, or how i would integrate ePDQ in to AbleCommerce?

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Mon Oct 12, 2009 3:29 am
by mazhar
Please read following topic about Gateway integration
http://wiki.ablecommerce.com/index.php/ ... nt_Gateway

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Jan 26, 2010 10:02 am
by pezza
Hi, thanks for the rply.

I have read this, but unfortunately am still a little confused :oops:

I have the Barclays ePDQ integration guide, but this just gives me ASP.NET code to handle an encryption script and a response handling script. How would i integrate this code by using the guide referred to in your last post?

ePDQ is a CPI interface and payment processing is handled by sending the customer off to ePDQ server and then passes the customer back to my site. Would this still be achieved by using the guide that you mentioned?

I am just a little confused as to whether using this guide means that i don't even need to use any of the code referred to in the Barclays Guide, or whether i still have to include these additional pages :(

How exactly do i implement the options in the guide in your post, and also how do i go about compiling it all? Apologies for the ignorance here, but I am new to all this. With my existing cart, which is ASP, i just had to select Custom in the Admin section and then include the 2 payment routines in custom payin and payout templates, so i guess this is all handled differently.

At a pure guess, i presume that this guide enables a custom gateway to be added within the admin where i can then use this to configure all of the required settings? This obviously sounds better but unfortunately i am just not understanding how i implement all of these changes, such as extending and compiling.

Not many people appear to include Barclays ePDQ with their shopping cart which surprises me actually as surely Barclays is a major processor and gateway? Are there any plans to include this gateway in future releases?

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Thu Jan 28, 2010 1:05 pm
by mazhar
Well on abstract level there could be two type of payment integrations one from within your own website and second could be to redirect user to some custom provider for processing and then it returns back to the original website along with response data.

In your case as you need to send customer to a third party provider you need to use the gateway code in a different way. Implement the UI related config form etc for your custom gateway but don't implement other functions for example supported transactions should return None so that ablecommerce never automatically calls it against an order.

Then implement some custom function that takes order and then generates the post data. The generated data could depend upon the way your custom provider wants it you can read their integration manual for exact style but most cases its through posting data in hidden fields on HTML form. For example if its the case where you have to use form then you can create HTML form with hidden field having correct names as required by provider.

On payments screen you put some button and when some one clicks on this button to pay you can query your Payment Gateway manually by passing it current order object it will return you the HTML form to be posted. Posting the form will redirect you to third party website. You will be redirect back to your website after processing the payments on configured links. You can use generic handlers as you callback links and process response against different payment events.

Re: Barclays ePDQ Payments/Gateway

Posted: Thu Jan 28, 2010 3:29 pm
by pezza
Thanks Mazhar,

Now i am even more confused :-)

So, I need to locate the payment form and add a button to it (or customise it in accordance with the integration guide).

There are 2 scripts provided by the integration guide, one is an encryption script and the other is a response handling script.

The encryption script has the code behind (VB) and appears to have #Region etc and the generation of the post data and there is then an ASPX VB section that appears to be the HTML bit that includes the hidden values and submit button.

The second script, response handling script also has the #Region section and then the rest appears to handle the POST data sent back from ePDQ but this seems to create a text file and then uses WriteLine's to put the data in to the created text file.

I guess my questions now, are:

1) Do these 2 scripts appear to handle the whole process?
2) How do i get to the encryption page/load the encryption? Would I have to link in to it from an ablecommerce page that already exists?
3) How would i get the POST data returned from ePDQ to update the DB itself and to update any payment status or other required ablecommerce data?
4) Are there still sections of your gateway integration guide that i would need to implement in addition to all of this, or would that not be used at all?

At a rough guess, i am assuming that i need to include a routine in some sort of existing ablecommerce page that calls the encryption and includes the button to proceed and send the customer to the gateway processor. ePDQ would then handle all of the transaction authorisation and credit card detail handling. I also know that information is stored within the ePDQ store Admin software that i specify which page the POST data should be returned to, and this also stores the "expected" page that the customer should be getting sent from. I presume that is where i would specify my second script page as the POST Data return page. Then somehow i would need to amend this script so that it posts directly to the database rather than piping it out to a text file? Would there be a Thank You page that i somehow need to link in to that simply confirms payment has been made and shows the transaction details?

Apologies again for my lack of understanding, but am i at least correct with the process?

How do i then piece it all together?

I really appreciate any help with this, as it certainly doesn't sound straight forward :-( I can see that all or most of the code has been done, but i am just struggling wondering how it all pieces together :-(

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Mon Feb 01, 2010 4:43 pm
by pezza
Hi,

What are the existing pages that trigger the payment authorisation and the transaction details back in? Are there any existing pages that i can look at that handle the status of the transaction, especially when the customer is passed back to the site?

Maybe i can get some understanding from reading the code myself to see from what page i would use the encryption script to send the customer to ePDQ, and the Thank You / Confirmation page that the customer would need to be passed back to.

It would also be useful, as hopefully i can see code from other gateways to see how they handle the update to the database, so that when the transaction details are passed back to the response handling code, i can then get it to update the DB. Then when Barclays pass the customer back to the Thank You page, the order should be retrieved.

I am really hoping that somebody can help me here, as without being able to implement ePDQ, i cannot consider the cart :-(

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 02, 2010 11:31 am
by pezza
Hi,

I have just noticed a post in the Good reference area. One of the replies in here mentions that PayPal is a good example of a method requiring processing by a third party site.

Would the PayPal pages be a good starting point for achieving my integration for ePDQ? If so, is PayPal source code available? What would i need to do differently (other than the specific parameters required by ePDQ)?

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 02, 2010 12:51 pm
by mazhar
Would the PayPal pages be a good starting point for achieving my integration for ePDQ? If so, is PayPal source code available? What would i need to do differently (other than the specific parameters required by ePDQ)?
Paypal module makes use of redirecting customer to PayPal website for payment processing so yes its different from gateways that operate from within website. But I can't say anything that its a good starting point to get you ePDQ gateway done because I don't know what ePDQ requires for a successful integration. Secondly PayPal code is not open source and is available in source code purchase of AbleCommerce. My suggestion s to spend some time with integration documents of ePDQ and drill down how it aspects data and what is returned response. Then see how they get input data, for example via HTML forms or XML. And finally how you can pass data to them and grab there return respond and update your order.

Re: Barclays ePDQ Payments/Gateway

Posted: Wed Feb 03, 2010 4:54 pm
by pezza
Ok, so i have my code that encrypts the order details and then sends the post data to EPDQ. The code for this is as follows...

Code: Select all


Code Behind
VB

Public Class Example
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "
    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub
#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
	
       'The Following Creates the WebClient Object
        Dim web As New System.Net.WebClient()

       'The Header Content Type is then set 
        web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

       'PostData is then declared as data type Byte and populated with the post data 
        Dim PostData As Byte() = System.Text.Encoding.ASCII.GetBytes("clientid=[clientid]&password=[password]&oid=[orderid]&chargetype=PreAuth&currencycode=826&total=[total]")

        'The Web object is then used to upload the postdata to the Encryption URL and the response is stored in the Response variable
        Dim Response As Byte() = web.UploadData("https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e", "POST", PostData)

        'The response from the post is then converted from Type Byte to String and stored in the session variable
        Session("Response") = (System.Text.Encoding.ASCII.GetString(Response))

    End Sub
 End Class




ASPX
VB

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Example.aspx.vb" Inherits="WebProject1.Example"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Example</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
		<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0">
	</HEAD>
	<body MS_POSITIONING="FlowLayout">
                                     'The Session Variable is then output to the FORM and on form submit is posted to the CPI 
		<FORM action="https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdq.e" method="post">
			<%= session("Response") %>
			<INPUT type="hidden" name="returnurl" value="http://www.store.co.uk/">
			<INPUT type="hidden" name="merchantdisplayname" value="My Store">
			<INPUT TYPE="submit" VALUE="purchase">
		</FORM>
	</body>
</HTML>
These are obviously the example values and will need updating to include the details that i need to send, and therefore i need to know what the variable names would be.

I am assuming that this either needs to be added to the final page of the checkout where the customer would be clicking on "Submit Payment" or some sort of reference would need to be added to that final page to launch this if it was in its own seperate page. The thing with my current shopping cart is that when i select "Custom Payment Method" in the Admin side, it then knows to call/trigger the contents of an _INCPayOut_.asp page, which includes the above code, so the trigger is already done for me. This is where i am struggling, as i don't know which page i need to amend to include this code or include a call to load the page. Also do I need to add something in to the Admin so that it then knows to call my custom routine, similar to my existing ASP cart?

From the point where this code is triggered, and the ubmit button is pressed, the control is then handed over to ePDQ site where any customer data included in the code is passed over and the remaining card and customer details are collected. After the payment has been processed, the response is posted to my "response handling page". The sample script for the response handling script is as follows...

Code: Select all


Code Behind

Public Class Response
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim fs, fname, path, timestamp

        If Request.ServerVariables("request_method") = "POST" Then

            fs = Server.CreateObject("Scripting.FileSystemObject")

            path = "c:\" 'set your logfile directory path here
            timestamp = Day(Date.Now) & "-" & Month(Date.Now) & "-" & Year(Date.Now)
            timestamp = timestamp & "--" & Hour(Now) & "-" & Minute(Now) & "-" & Second(Now)

            fname = fs.CreateTextFile(path & timestamp & "-" & Request.Form("oid") & ".log", True)

            fname.WriteLine("OrderID - " & Request.Form("oid"))
            fname.WriteLine("Transaction Status - " & Request.Form("transactionstatus"))
            fname.WriteLine("Total - " & Request.Form("total"))
            fname.WriteLine("ClientID - " & Request.Form("clientid"))
            fname.WriteLine("Transaction Time Stamp - " & Request.Form("datetime"))
            fname.Close()

            fname = Nothing
            fs = Nothing
        End If
    End Sub
End Class

As you can see, this appears to be recording the data in a text file, however i need to amend this section so that it updates the order in the db with the result of the transaction, but this is also where i am stuck as i don't know how able commerce is expecting the result and how to tell it the result. Can this be handled by this script or does it need to be done as a trigger within the Admin? If so, how?

At the same time as the payment is processed and the response it returned, ePDQ sends the customer back to whichever page i specify in the first encryption code as the "returnurl". This would presumably be some sort of Thank You page. Again, i would need to know what that page is in AbleCommerce, if it actually exists. If not i guess i will have to create my own Thank You page. I suppose i would also need something on this to retrieve back the order details based on the "oid" that was returned by ePDQ when it returned the customer.

So, i am still unsure on how to:

1) Call the Encryption Script (either by calling it as a seperate page or including the code in one of AbleCommerce's checkout pages)
2) Which existing page should i use to do this
3) How do i update the order when the transaction status is posted back (instead of writing to the text file as in the example above)
4) Is there a Thank You page? Which page is it?

This is as much as i can decipher from the integration guide in terms of my understanding of the process, but it is the connections between AbleCommerce and these 2 scripts that i am stuck with. I just don't know how to add to the Admin side as a Payment Gateway/Processor etc, or what the pages are that i need to call the script from, or the variables that would be available to me that i would need to submit to ePDQ.

I hope that someone can help me with this.

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Mon Feb 08, 2010 2:14 pm
by pezza
Please could someone tell me how i would update AbleCommerce to a custom gateway/processor?

Assuming that I am happy with the sample code that i have, how do i make the Admin "understand" that as well as an option for PayPal (which is already selectable in the admin), there will also be a "Custom" payment processor (ePDQ) that customers can also select?

I need to be able to allow customers to choose whether they wish to pay by PayPal or by "Credit Card" (The ePDQ routine). I presume that there must be an addition that i need to make to the configuration that allows me to do this and i guess i must not be explaining this clear as i have asked a few times in this thread. Apologies for this, but this was one of the reasons why i was considering this shopping cart, so that i didn't have to write all this myself, as i have very little experience in .NET :-( and when i asked this question to the Sales Team they said that i should ask in this forum for help integrating my ePDQ.

I also still need to know which page in AbleCommerce (checkout page?) is the one that i need to call my encryption routine (or add the code to) in order to trigger the encryption and submission to the ePDQ site. As i say, i understand the encryption and the submission, but i don't understand WHERE i need to put this, or where it is called from.

Also, is there a reference guide that shows the customer and order variables/details that are available at check out, so that i can use these in the data that i need to submit to Barclays? Such as Customer Name/Address, Order ID, Total, VAT etc etc. I also need to supply a return page, so i need to know the Thank You/Confirmation/Receipt page that already exists in AbleCommerce so that i can also include this in my script.

I would really appreciate some guidance on an existing gateway/processor that already handles a returned response so that i can learn how to update the order in the database with the transaction result. Again, the parameters and fields involved that i would need for this would be key to attempting this.

I understand the 2 scripts that are used from the point of submission to ePDQ and the returned response from ePDQ, but i need to know how i "integrate" this code in to AbleCommerce, and the AbleCommerce specific values that i need to substitute in these scripts to pass to ePDQ and handle the order update.

I have spoken to Barclays and read the integration guide, as suggested in a post above, but Barclays say that they wouldn't know the linking/integration element as that depends on the shopping cart, and have referred me back to AbleCommerce Support, so i seem to be in a vicious circle at the moment and not getting anywhere fast :-(

I would really appreciate any help with this, as the cart is pretty useless without a way to integrate my payment method.

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Mon Feb 08, 2010 3:21 pm
by jmestep
You are creating your gateway differently from the way Able does in their sample code for the authorize net provider. If you do it the way Able gives a sample for and use their provider base, when you copy your dll to the bin folder, Able picks up up automatically and displays an admin page to configure it and you can attach your payment methods to it.

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 09, 2010 6:04 am
by pezza
Thanks Judy,

So, if i follow the AbleCommerce Integration guide as far as adding it in to the Admin, i can get my Admin to pick up the option for Barclays ePDQ, and then i can select the PayPal Gateway and my Barclays ePDQ Processor as my 2 main Gateways/Processor?

Then, the configuration will ask me for certain details, i guess these details would be asking things like;

1) The name of my Encryption Script page
2) The response handling script page / expected returned values from ePDQ

Am i getting this right so far?

The thing is, when i read the AbleCommerce Gateway Integration, i couldn't find any specific steps, only that it said i had to implement this and implement that, but i am not sure "how" i would implement those items.

I hope i am getting there and starting to understand this. I believe that ePDQ MUST send the customer off to process the payment, so i wouldn't be able to do the whole payment handling within my site, hence my reason for asking if it would just be "sections" of the gateway guide that i would need to implement.

I am really new to all this ASP.NET and have not got a clue about creating dll's etc, so i am really hoping someone can help. I am also trying to learn this as much as possible, but the whole NET process (and programming) is all new to me i'm afraid :oops:

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 09, 2010 6:39 am
by jmestep
With the way you are doing it, Able won't pick up your scripts. You have to create a dll based on their provider base. If you do that, then Able will pick it up and will post the payments back to the site and do other things like their gateways do.
I was coding in Able 7 about a year before I did my first custom payment gateway and since I have the source code for gateways other than authorizenet, I took the source code for one of them as a pattern. You can try that with the authorizenet code- find out what the variable names are for the Barclays and substitute those names for the ones in authorize net. I haven't looked at that code lately, but I think the ones in authorizenet started with ssl_ or something similar.
If you are just using two webform scripts, then you will have to integrate sending the data back and forth will Able by yourself. When I did myVirtualMerchant, they had sample scripts, but they also had an integration guide that showed variable names and how the data was to be passed and I didn't use the page scripts except to test my connections when I first started coding.

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 09, 2010 7:40 am
by pezza
Thanks for your help with this Judy.

Hopefully I can merge the code from the sample scripts provided by Barclays ePDQ (above) with a new dll based around authorizenet, and that way I wouldn't need to have them as 2 seperate files so to speak.

I think what is also confusing me, is that with my current shopping cart, the admin on that doesn't seem as robust as Able, however it does have a simple option to choose a "custom" gateway. Activating this enables sections of the main code to launch 2 asp pages, one called INCPayOut and INCPayIn. This then means that I could then just update these 2 files (which are just blank templates) to start off with, with the ASP examples provided by Barclays, and I was also easily able to identify the database fields for customer and order etc and match them with the data that Barclays was expecting. I was also able to base my return response on one that their cart was also using, funnily enough I am pretty sure that that was also authorizenet, and I therefore was able to pinch the main structure of how that code was handling the response and updating the database and I just had to tweak it with the specific data names that Barclays was passing back.

It seems with Able, because I am new, I am getting confused between these two methods and assuming that I have to call the scripts in the same way, and it would seem that I just need to break their examples apart and add it in to the various sections of the dll.

In summary, I think I need to completely erase from my head, all of the integration I did before, and start from scratch :)

When I get home tonight, I will download the source for authorizenet and study that. I have got a much better understanding of the scripts now that I attached above, and I understand a little more what is going on in these, so I am hoping that I can then do a bit of merging magic to bring them both together.

The problem with Barclays Integration Guide is that it does give you the scripts, but just says that I have to then integrate these scripts in to the checkout page. This is where I am losing it, as I don't know HOW to or what pages I needed to amend in order to do this. Also with not knowing the Able variables I didn't even know where to start with the bit that sends the data back to update Able order in the database.

Hopefully now I can get an understanding of authorizenet routine, which will also include the db variables.

Just one question...

How do I create a dll? Do I need any specific software, or is it just a case of creating all the code and saving it as a dll extension? My knowledge only extends to as much as knowing that this stands for Dynamic Link Library (or maybe not?) :)

Anyway, thanks again for taking the time with this, and hopefully I can get a bit nearer.

Thanks

Andrew

Re: Barclays ePDQ Payments/Gateway

Posted: Tue Feb 09, 2010 12:33 pm
by jmestep
You would create a dll by compiling the project in Visual Studio. There should be plenty of info on the web about that - it's too much to go in to here.