Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 5 > Third Party Add-Ons for X-Cart 5
 
Thread Tools Search this Thread
  #1  
Old 10-30-2017, 06:52 AM
 
Shri@2c2p Shri@2c2p is offline
 

Newbie
  
Join Date: Oct 2017
Posts: 4
 

Default 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
__________________
X-cart-5
Reply With Quote
  #2  
Old 11-02-2017, 04:56 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 11-02-2017, 07:48 PM
 
Shri@2c2p Shri@2c2p is offline
 

Newbie
  
Join Date: Oct 2017
Posts: 4
 

Default 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
__________________
X-cart-5
Reply With Quote
  #4  
Old 11-02-2017, 11:32 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 11-06-2017, 12:24 AM
 
Shri@2c2p Shri@2c2p is offline
 

Newbie
  
Join Date: Oct 2017
Posts: 4
 

Default 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);
__________________
X-cart-5
Reply With Quote
  #6  
Old 11-08-2017, 02:52 AM
 
Shri@2c2p Shri@2c2p is offline
 

Newbie
  
Join Date: Oct 2017
Posts: 4
 

Default 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.
__________________
X-cart-5
Reply With Quote
  #7  
Old 11-08-2017, 07:10 AM
 
Shri@2c2p Shri@2c2p is offline
 

Newbie
  
Join Date: Oct 2017
Posts: 4
 

Default 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.
__________________
X-cart-5
Reply With Quote
  #8  
Old 11-13-2017, 04:02 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #9  
Old 11-13-2017, 07:02 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Third Party Add-Ons for X-Cart 5



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:28 AM.

   

 
X-Cart forums © 2001-2020