Tuesday, September 30, 2008

Paymate Payment Provider for Dash Commerce

Paymate (http://www.paymate.com) is a popular payment gateway in New Zealand and Australia and therefore have create a Payment Provider for Dash Commerce (http://www.dashcommerce.org)

Paymate is very similar to Pay Pay Express i.e uses HTTP Post to make payments and there for a lot of the code is based off the Pay Pal Standard Payment Provider in some situations we have just added to the file already in Dash Commerce in order to not duplication content. For example the checkout page uses the PayPalCheckOut.aspx page.

You can obviously switch backwards and forwards to which ever payment provider you wish to use, we have not altered the PayPal Standard provider in way in which it will now not work.

Below are some installation instructions, you will also find these then installation zip folder. You will require Visual Studio in order to complete installation.

================================
INSTALL INSTRUCTIONS
================================

1. Copy the 3 files in the paymatestandardconfiguration folder to Web\admin\controls\configuration\paymentproviders and include them in your project

2. Copy the 3 files in the PaymateHandler directory to web\paypal

3. Add a reference in your Web project to PayMateStandardPaymentProvider.dll

4. Add the following resource strings in Labels.resx in the Localization project

pnlPayMateStandardConfiguration
lblPayMateStandardDescriptionTitle
lblUserID
hluserid

5. Change checkout.aspx.cs - Line 124


FROM:
if(paymentService.PaymentServiceSettings.DefaultProvider == "PayPalStandardPaymentProvider") {
Response.Redirect("~/paypalcheckout.aspx", true);
}

TO:

if (paymentService.PaymentServiceSettings.DefaultProvider == "PayPalStandardPaymentProvider" || paymentService.PaymentServiceSettings.DefaultProvider == "PayMateProvider")
{
Response.Redirect("~/paypalcheckout.aspx", true);
}

6. Change the following in paypalcheckout.aspx.cs -


add this at the top of page line 90 or so.
using MettleSystems.dashCommerce.Store.Services.PaymentService;


line 423 and 424 change the following

FROM:


string returnUrl = Utility.GetSiteRoot() + "/paypal/pdthandler.aspx";
string cancelUrl = Utility.GetSiteRoot() + "/paypalcheckout.aspx";


TO:

string returnUrl = "";
string cancelUrl = "";

PaymentService paymentService = new PaymentService();
if (paymentService.PaymentServiceSettings.DefaultProvider == "PayPalStandardPaymentProvider" )
{
returnUrl = Utility.GetSiteRoot() + "/paypal/pdthandler.aspx";
cancelUrl = Utility.GetSiteRoot() + "/paypalcheckout.aspx";
}
else if (paymentService.PaymentServiceSettings.DefaultProvider == "PayMateProvider")
{
returnUrl = Utility.GetSiteRoot() + "/paypal/paymateHandler.aspx";
}

7. Build Project

8. Login to the control panel and go to manage payment providers
-add new provider with the following details

-name: PaymateStandardProvider
-description: A description
-Configuration Control Path: ~/admin/controls/configuration/paymentproviders/PaymateStandardConfiguration.ascx


9. Goto configure Payment provider and fill in the appropriate text boxes.
tick live to use live Url untick to use sandBox url.


10. TEST!

Install Files

No comments: