VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: sean_nwfs on October 15, 2018, 17:51:47 PM

Title: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 15, 2018, 17:51:47 PM
I am having trouble figuring out what is wrong with my store. We get occasional credit card orders on Authorize.net that are declined but Virtuemart marks them as pending. I already have set my Order status parameters so that only "Order Status for Approved Payments" should be marked as "Pending." Transactions declined and held for review should be marked as Declined. What should the permissions be on the "Declined" order status? On my end all the permissions for the Declined are set to Not Allowed. Is that my issue? If not, why are declined cards getting marked as Pending?
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 15, 2018, 21:00:05 PM
QuoteOn my end all the permissions for the Declined are set to Not Allowed. Is that my issue?

what does this mean?
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 15, 2018, 21:12:37 PM
In Virtuemart, if you go to Configuration > Order Statuses > Decline > Permissions, all the listed "Calculated Settings" are set to Not Allowed (Inherited).  Does the Order Status need to be set to Allowed or would something else cause my order status to always show as Pending, even if a credit card is declined?
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 15, 2018, 22:39:35 PM
Do u mean ACL permissions?

These are just what members of different Joomla user groups can do -- nothing to do with VM functionality

If not then I don't know where u are talking about.. screenshot?

have u switched on debugging and logging to see what is happening in the plugin?
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 16, 2018, 00:14:40 AM
GJC,
I have not turned on debugging. Do you have any guidance on where to turn on debugging and what I might look for with authorize.net on a declined order to VM?

Thanks for your patience and help!
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 16, 2018, 11:15:41 AM
in the plugin..  chk boxes for both
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 18, 2018, 22:01:29 PM
I have collected logs and have received an order as pending when the card was declined.

This is what I see in the logs:
Authorize.net log
2018-10-18 19:25:05 MESSAGE _handleResponse PAYMENT DECLINED: There was an error while processing your transaction: This transaction has been declined. (2)<br />
2018-10-18 19:29:29 DEBUG plgVmConfirmedOrder: before store

com_virtuemart log
2018-10-18 19:25:04 ERROR vmError: TableUserinfos COM_VIRTUEMART_VIRTUEMART_USER_ID in record is missing ! Can't save the record with no COM_VIRTUEMART_VIRTUEMART_USER_ID.
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 18, 2018, 23:11:13 PM
plugins\vmpayment\authorizenet\authorizenet.php

function plgVmConfirmedOrder(VirtueMartCart $cart, $order)  ~ line 574

if ($this->error) {
$new_status = $this->_currentMethod->payment_declined_status;
$this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
return; // will not process the order
} else {
if ($this->approved) {
$this->_clearAuthorizeNetSession();
$new_status = $this->_currentMethod->payment_approved_status;
} else {
if ($this->declined) {
vRequest::setVar('html', $html);
$new_status = $this->_currentMethod->payment_declined_status;
$this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
return;
} else {
if ($this->held) {
$this->_clearAuthorizeNetSession();
$new_status = $this->_currentMethod->payment_held_status;
}
}
}
}
$modelOrder = VmModel::getModel('orders');
$order['order_status'] = $new_status;
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);



hmmm ..  I don't think the return should be there -- it never reaches the 

$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);

you could try commenting it out

//return;

but I would recommend to test immediately
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 23, 2018, 01:45:07 AM
When I commented that line out I had a customer who called to say that they were getting an "Invalid data entered" error when trying to process an order. I put Authorize.net in sandbox mode and tried to make an order and saw the same thing. Once I put the return; back in it seems to have gone away. I can't be sure that the customer was entering their information correctly or not but I wouldn't be surprised if they were doing something wrong. I had several orders over the weekend that seemed to have worked just fine.  If I pay for support through Virtuemart, is this something they can help resolve?
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 23, 2018, 10:52:26 AM
Yes -- normally you buy a membership

but first try adding


$modelOrder = VmModel::getModel('orders');
$order['order_status'] = $new_status;
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);



just before the return;  we discussed and keep the return there

this will hopefully set the status to declined b4 returning
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: sean_nwfs on October 26, 2018, 17:53:50 PM
I very much appreciate your support. Unfortunately, I added the suggested code but we're still getting failed authorize.net orders set as pending.  :(
Title: Re: Authorize.net declined card but Virtuemart marked as pending
Post by: GJC Web Design on October 26, 2018, 19:19:59 PM
you need to set up some repeatable test install where you can POST returns and debug what is happening

otherwise add some of your own logging to see what happens ..

guessing is never going to do it...

see - https://www.gjcwebdesign.com/joomla-virtuemart-tips/802-php-log-anything.html