Jump to content

[Help] Payment Module Development


bizplan

Recommended Posts

HI

 

I want to create new payment module for 1 payment gateway from (Malaysia), I manage to connect to payment gateway but when i comfirm payment and want to return back to my store, its return error

 

Cart cannot be loaded or an order has already been placed using this cart

 

Can anyone help me?

 

Here is validation.php

$webcash = new webcash();
$webcash_name = 'webcash Online Payment Gateway ';
$cart = new Cart(intval($_POST['ord_mercID']));
/*$amount_cart = number_format($cart->getOrderTotal(), 2, '.', '');

if (round($amount_cart)== $_POST['Amount']) {
    $amt_cart = $amount_cart;
}
*/
$r_amount = str_replace(",","",$_POST['Amount']);	//remove thousand symbol
$amount_cart = $r_amount;

$amount = $_POST['amount'];
$RefNo = $_POST['ord_mercID'];
$tranID = $_POST['TransId'];
$status = $_POST['Status'];

function Requery() {

    $MerchantCode = $_REQUEST['MerchantCode'];
    $RefNo = $_REQUEST['ord_mercref'];
    $Amount = $_REQUEST['Amount'];

    $query = "http://staging.webcash.com.my/enquiry.php?ord_mercID=" . $MerchantCode . "&ord_mercref=" . $RefNo . "&ord_totalamt=" . $Amount;

    $url = parse_url($query);
    $host = $url["host"];
    $path = $url["path"] . "?" . $url["query"];
    $timeout = 15;
    $fp = fsockopen ($host, 80, $errno, $errstr, $timeout);

    if ($fp) {
        fputs ($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n");
        while (!feof($fp)) {
            $buf .= fgets($fp, 128);
        }
        $lines = split("\n", $buf);
        $Result = $lines[count($lines)-1];
        fclose($fp);
    } else {
        # enter error handing code here
    }
    return $Result;

}


if ($status == "100" && Requery()=="S") {  // successful transaction

    $webcash->validateOrder(intval($orderid), _PS_OS_PAYMENT_, $amount_cart, $webcash_name,$webcash->getL('S').''.$tranID.')');
    Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$webcash->id);
}

else { // failure transaction

    $webcash->validateOrder(intval($orderid),_PS_OS_ERROR_,$amount_cart, $webcash_name, $webcash->getL('-1').''.$tranID.')');
    Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$webcash->id);
}


?>
Link to comment
Share on other sites

These should be your first lines in validation.php

include(dirname(__FILE__). '/../../config/config.inc.php');
include(dirname(__FILE__). '/../../init.php');

You should confirm what value you are being sent in ord_mercID

$cart = new Cart(intval($_POST['ord_mercID']));

Then you should validate that you can load the Cart

if (!Validate::isLoadedObject($cart))
{
    Logger::addLog('Cart loading failed for cart '.(int)$_POST['ord_mercID'], 4);
    die('An unrecoverable error occured with the cart '.(int)$_POST['ord_mercID']);
}

 

Link to comment
Share on other sites

  • 2 months later...

Sebenarnya abaikan lah, webcash ni ada masalah pengurusan dan kepakaran, jika ada SME yang menggunakan pelantar pembayaran mereka kelak bakal mengundang masalah. Pelangan sasaran mereka adalah user dan peniaga besar.

 

Peniaga kecil ni dinasihatkan jangan lah, tidak mesra komuniti..

Aku faham kenapa ianya menjadi faktor utama? kerana getway ni tak mengenakan sebarang charge untuk setup bukan? biasa lah tu.  :D

 

Last plugin dikemaskini pada tahun 2009? agak-agak la kawan, kau tu payment gateway.

Edited by Farid Zenon (see edit history)
Link to comment
Share on other sites

Webcash v1.0 (Mar 2009) module for Prestashop v1.0 released on 2008 here the source code.

i don't think this payment gateway module gonna be your first choice since this module last update on 2009 & actually the module not by webcash it self, but from merchant who provide this module back to community long time ago.

 

Unless just fork from this module recreate working module for latest version Prestashop.

Edited by Farid Zenon (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Webcash v1.0 (Mar 2009) module for Prestashop v1.0 released on 2008 here the source code.

i don't think this payment gateway module gonna be your first choice since this module last update on 2009 & actually the module not by webcash it self, but from merchant who provide this module back to community long time ago.

 

Unless just fork from this module recreate working module for latest version Prestashop.

Farid, saya perlukan module ini juga. Farid, you tahu menggunakan Prestashop, selain PAYPAL, apa payment gateway yang sesuai digunakan dalam Malaysia?

Link to comment
Share on other sites

Farid, saya perlukan module ini juga. Farid, you tahu menggunakan Prestashop, selain PAYPAL, apa payment gateway yang sesuai digunakan dalam Malaysia?

Selain daripada PAYPAL.. boleh guna paid services macam ipay88, nbpay @molpay...

@bizplan, can you share the full set of the module?

Can't use at all

Link to comment
Share on other sites

Selain daripada PAYPAL.. boleh guna paid services macam ipay88, nbpay @molpay...

Can't use at all

Bizplan,

1. Adakah module sedia ada untuk ipay88, nbpay, dan molpay untuk Prestashop?

 

2. Yang module itu, can't use at all, but you berjaya sampai ke page untuk bayar, tapi masalahnya di return page sahaja, kan?

Link to comment
Share on other sites

Bizplan,

1. Adakah module sedia ada untuk ipay88, nbpay, dan molpay untuk Prestashop?

ha ah... nbpay dgn molpay tu sama je..  ipay88 dan molpay mmg ada module utk prestashop, cuma dua2 ada registrtation fee. WEBCASH x de..

 

2. Yang module itu, can't use at all, but you berjaya sampai ke page untuk bayar, tapi masalahnya di return page sahaja, kan?

Ye, return blank..

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...