allnz Posted November 23, 2014 Share Posted November 23, 2014 Dear all, I am a new prestashop user who live in NZ and install free DPS Payment express module as payment gateway. However, the version of DPS module is bit old so I think the DPS module is not working with Prestashop 1.6.0.9. When transaction is approved by DPS and then I click next for return to my site but error - "Cart cannot be loaded or an order has already been placed using this cart" is displayed So, I have a looked error php file which is validation.php. The validation.php contain order-confirmation.php but Prestashop 1.6.0.9 dosen't have order-confirmation.php How can I fix this problem?? Please give me some information how to fix this?? Many thanks advance. Regards, Sam p.s) validation.php files code below <?php include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); include(dirname(__FILE__). '/paymentexpress.php'); include(dirname(__FILE__).'/api/PxPayAPI.php'); //global $cart, $cookie; # Removed $cart so that it can get from DPS post global $cookie; $dps = new paymentexpress(); $pxpay = new PxPay_Curl( Configuration::get('DPS_PXPAY_URL'), Configuration::get('DPS_PXPAY_USERID'),Configuration::get('DPS_PXPAY_KEY') ); $enc_hex = $_REQUEST["result"]; #getResponse method in PxPay object returns PxPayResponse object #which encapsulates all the response data $rsp = $pxpay->getResponse($enc_hex); # the following are the fields available in the PxPayResponse object $Success = $rsp->getSuccess(); # =1 when request succeeds $AmountSettlement = $rsp->getAmountSettlement(); $AuthCode = $rsp->getAuthCode(); # from bank $CardName = $rsp->getCardName(); # e.g. "Visa" $CardNumber = $rsp->getCardNumber(); # Truncated card number $DateExpiry = $rsp->getDateExpiry(); # in mmyy format $DpsBillingId = $rsp->getDpsBillingId(); $BillingId = $rsp->getBillingId(); $CardHolderName = $rsp->getCardHolderName(); $DpsTxnRef = $rsp->getDpsTxnRef(); $TxnType = $rsp->getTxnType(); $TxnData1 = $rsp->getTxnData1(); $TxnData2 = $rsp->getTxnData2(); $TxnData3 = $rsp->getTxnData3(); $CurrencySettlement= $rsp->getCurrencySettlement(); $ClientInfo = $rsp->getClientInfo(); # The IP address of the user who submitted the transaction $TxnId = $rsp->getTxnId(); $CurrencyInput = $rsp->getCurrencyInput(); $EmailAddress = $rsp->getEmailAddress(); $MerchantReference = $rsp->getMerchantReference(); $ResponseText = $rsp->getResponseText(); $TxnMac = $rsp->getTxnMac(); # An indication as to the uniqueness of a card used in relation to others $MerchantReference_break = preg_split('/-/',$MerchantReference); //$cart = !empty($cart) ? $cart : new Cart((int)$MerchantReference_break[1]); $cart = new Cart((int)$MerchantReference_break[1]); # Always set $cart from DPS post values $customer = new Customer((int)$cart->id_customer); $orderMessage = "Amount Settled: $AmountSettlement\n Ref: $MerchantReference\n Auth Code from bank: $AuthCode\n DPSTxnRef: $DpsTxnRef\n"; $type = Configuration::get('DPS_TRAN_TYPE_NORM'); $en_order_pro = Configuration::get('DPS_ORDER_PROCESS'); if ($rsp->getSuccess() == "1"){ if ($type == "Purchase"){ $dps->validateOrder((int)$MerchantReference_break[1], Configuration::get('DPS_OS_ACCEPTED'), (float)$AmountSettlement, $dps->displayName, $orderMessage, array(), NULL, false, $cart->secure_key); Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'dps_order_status` (`id_order`,`curr`, `dpstxnref`, `payment_status`, `original_amount`, `purchase_complete`, `amount`) values ("'.$dps->currentOrder.'","'.$CurrencyInput.'","'.$DpsTxnRef.'","'.$type.'","'.$AmountSettlement.'","'.$AmountSettlement.'","0.0")'); } else { $dps->validateOrder((int)$MerchantReference_break[1], Configuration::get('DPS_OS_AUTH'), (float)$AmountSettlement, $dps->displayName, $orderMessage, array(), NULL, false, $cart->secure_key); Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'dps_order_status` (`id_order`,`curr`, `dpstxnref`, `payment_status`, `original_amount`, `purchase_complete`, `amount`) values ("'.$dps->currentOrder.'","'.$CurrencyInput.'","'.$DpsTxnRef.'","'.$type.'","'.$AmountSettlement.'","0.0","0.0")'); } /* new relic - custom reporting for inisghts */ if (extension_loaded('newrelic')) { newrelic_add_custom_parameter("order_total", $AmountSettlement); newrelic_add_custom_parameter("customer_id", $cart->id_customer); } /* /end new relic */ Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$dps->id.'&id_order='.$dps->currentOrder.'&key='.$customer->secure_key); } else { if ($en_order_pro) { $dps->validateOrder((int)$MerchantReference_break[1], Configuration::get('DPS_OS_PAY_ERROR'), 0.0, $dps->displayName, $orderMessage, array(), NULL, false, $cart->secure_key); Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'dps_order_status` (`id_order`,`curr`, `dpstxnref`, `payment_status`, `original_amount`, `purchase_complete`,`amount`) values ("'.$dps->currentOrder.'","'.$CurrencyInput.'","'.$DpsTxnRef.'","Declined","0.0","0.0","0.0")'); Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$dps->id.'&id_order='.$dps->currentOrder.'&key='.$customer->secure_key.'&dpserror=1'); } else { Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'dps_decline_attempt` (`customer_id`, `dpstxnref`, `curr`, `amount`) values ("'.$MerchantReference_break[0].'","'.$DpsTxnRef.'","'.$CurrencyInput.'","'.$AmountSettlement.'")'); Tools::redirect('order.php?step=3&cgv=1&dpserror=1'); } } ?> validation.php Link to comment Share on other sites More sharing options...
Recommended Posts