View Single Post
  #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