X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 5 (https://forum.x-cart.com/forumdisplay.php?f=64)
-   -   X-cart-5 Order not update based on payment gateway response (https://forum.x-cart.com/showthread.php?t=75749)

Shri@2c2p 10-30-2017 06:52 AM

X-cart-5 Order not update based on payment gateway response
 
Hello ,

I am working creating custom payment module using X-cart 5 where I can purchase items using various payment methods. When customer places the order, an entry is made to Order table
but that that order is not being displayed on the order history list.

When I manully update following column values for that record then it will gets displayed.
Column Names : shipping_status_id , is_order.

I also configured the Paypal stranded payment method but it also has same issue. Any thoughts on this?

I have below code to handle the payment gateway response and update the order status

Quote:

public function processReturn(\XLite\Model\Payment\Transaction $transaction)
{


/** @var \XLite\Core\Request $request */
$request = \XLite\Core\Request::getInstance();
$status = $transaction::STATUS_PENDING;

if (isset($request->cancel) && $request->cancel) {
$status = $transaction::STATUS_CANCELED;

$transaction->setNote(
static::t('Customer cancelled the order during checkout!')
);
} else {
if (isset($request->action) && $request->action == 'success') {
if ($transaction::STATUS_INPROGRESS == $transaction->getStatus()) {
$status = $transaction::STATUS_PENDING;
}

$transaction->setNote(
static::t('Payment completed successfully!')
);
} else {

$this->transaction->setDataCell(
'status',
static::t('Payment unsuccessful!'),
null,
static::FAILED
);

\XLite\Core\TopMessage::getInstance()->addError(
static::t('Payment unsuccessful!')
);
}
}
}


Thanks,
Shri

tony_sologubov 11-02-2017 04:56 AM

Re: X-cart-5 Order not update based on payment gateway response
 
Hi Shri,

Did you try to run a test payment module described here:
http://devs.x-cart.com/en/changing_store_logic/creating_a_payment_method/

Does it have the same problem or does it work fine for you?

Aside from that, I see you do not have call of parent::processReturn() method in your processReturn() implementation. It may be the reason why it does not work properly.

Tony

Quote:

Originally Posted by Shri@2c2p
Hello ,

I am working creating custom payment module using X-cart 5 where I can purchase items using various payment methods. When customer places the order, an entry is made to Order table
but that that order is not being displayed on the order history list.

When I manully update following column values for that record then it will gets displayed.
Column Names : shipping_status_id , is_order.

I also configured the Paypal stranded payment method but it also has same issue. Any thoughts on this?

I have below code to handle the payment gateway response and update the order status



Thanks,
Shri


Shri@2c2p 11-02-2017 07:48 PM

Re: X-cart-5 Order not update based on payment gateway response
 
Thanks for your reply,

I have called the
Quote:

parent::processReturn($transaction); method.


But this problem is I resolved by using the below code snippet.

public function processReturn(\XLite\Model\Payment\Transaction $transaction)
{
parent::processReturn($transaction);

$order = $this->getOrder();

$order->processSucceed();
}

Above code is updated the order status successfully based on payment response.

Thanks,
Shri

qualiteam 11-02-2017 11:32 PM

Re: X-cart-5 Order not update based on payment gateway response
 
Quote:

When customer places the order, an entry is made to Order table
but that that order is not being displayed on the order history list.

When I manully update following column values for that record then it will gets displayed.

If I get it right, you should mark orders with a new db field / flag and switch the flag when the order status changes
Check \XLite\Model\Order::getStatusHandlers() method.

Shri@2c2p 11-06-2017 12:24 AM

Re: X-cart-5 Order not update based on payment gateway response
 
Thanks for you response,

I have make successful payment and set the default order status as "Awaiting Payment" and after the I also change order payment status as "Paid" but it is not changing payment status.

Here is my code stuff.

Quote:

parent::processReturn($transaction);

$order = $this->getOrder();

$order->processSucceed();
$this->transaction->setStatus($transaction::STATUS_SUCCESS);

Shri@2c2p 11-08-2017 02:52 AM

Payment Callback is not working.
 
Hello,

I have developed one payment method and need to use front URL and backed URL to update the order status based on payment gateway response.

Front URL is working properly and also user is redirect based on payment gateway response status. Below is code for front method.
Quote:

public function processReturn(\XLite\Model\Payment\Transaction $transaction)
{
parent::processReturn($transaction);
// here is code for update the order status.
}



But I want to used backed method to update the order status but it is not working properly. Caused behind this is callBack.php is empty under the run folder / compile. Like below is empty code for Callback.php
Quote:

<?php
namespace XLite\Controller\Customer;
/**
* Payment method callback
*/
class Callback extends \XLite\Module\CDev\XPaymentsConnector\Controller\C ustomer\Callback {}


When I copy past the actual callBack.php content under the run... folder then it is working good.

Please suggest how I can resolved this one or it is X-cart issue?.

Because Paypal callBack also not working.

Shri@2c2p 11-08-2017 07:10 AM

Re: Payment Callback is not working.
 
When I Comment this line into below code snippet then it is working fine.
Quote:

protected function doActionCallback()
{
$this->setSuppressOutput(true);
$this->set('silent', true);

//Below line is comment's into this file under this file => \XLite\Module\CDev\XPaymentsConnector\Controller\C ustomer\Callback

/* \XLite\Module\CDev\XPaymentsConnector\Core\XPaymen tsClient::getInstance()->forceCloseConnection(); */
}


Please let me know is there any solution for this issue.

qualiteam 11-13-2017 04:02 AM

Re: X-cart-5 Order not update based on payment gateway response
 
Should it be "$order->transaction->..." instead of "$this->transaction->..."?

Also, I'm not sure, but you may have to manually adjust the order payment status as well.

qualiteam 11-13-2017 07:02 AM

Re: X-cart-5 Order not update based on payment gateway response
 
Also, XPaymentsConnector is a module that integrates X-Cart with out X-Payments solution.
It is not a payment method, but a wrapper that includes multiple payment methods.
I believe you don't have to change anything within that class unless you want your payment method to be supported by X-Payment somehow (I'm not sure how - all the integration code is inside X-Payments, the connector module just redirect payment requests from X-Cart to there).


All times are GMT -8. The time now is 09:42 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.