I'm strangely getting
Payment failed for order 15: Credit card **purchase** declined: No Pre-auth corresponds to the store Id and order Id and transaction Id entered
in watchdog

The user message is

We were unable to process your credit card payment. Please verify your card details and try again. If the problem persists, contact us to complete your order.

but the transaction message is " APPROVED * =" from Moneris' side in my Moneris Solusionts eSELECTPlus transaction report.

I'm using Canadian Moneris in Production Mode.

Also I added a watchdog line mentioned in another post to see the mpgRequest object being passed.

mpgRequest Object
(
[txnTypes] => Array
(
[purchase] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => pan
[4] => expdate
[5] => crypt_type
)

[refund] => Array
(
[0] => order_id
[1] => amount
[2] => txn_number
[3] => crypt_type
)

[idebit_purchase] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => idebit_track2
)

[idebit_refund] => Array
(
[0] => order_id
[1] => amount
[2] => txn_number
)

[ind_refund] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => pan
[4] => expdate
[5] => crypt_type
)

[preauth] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => pan
[4] => expdate
[5] => crypt_type
)

[completion] => Array
(
[0] => order_id
[1] => comp_amount
[2] => txn_number
[3] => crypt_type
)

[purchasecorrection] => Array
(
[0] => order_id
[1] => txn_number
[2] => crypt_type
)

[opentotals] => Array
(
[0] => ecr_number
)

[batchclose] => Array
(
[0] => ecr_number
)

[cavv_purchase] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => pan
[4] => expdate
[5] => cavv
)

[cavv_preauth] => Array
(
[0] => order_id
[1] => cust_id
[2] => amount
[3] => pan
[4] => expdate
[5] => cavv
)

)

[txnArray] => mpgTransaction Object
(
[txn] => Array
(
[type] => purchase
[order_id] => cs021612205100000015
[cust_id] => 1
[amount] => 114.29
[pan] => *************0005 <- I ALTERED THIS As it's a real card number
[expdate] => **** <- I ALTERED THIS As it's a real card number
[crypt_type] => 7
)

[custInfo] =>
[avsInfo] =>
[cvdInfo] =>
[recur] =>
)

)

Any thoughts would be great. Thanks

Comments

drewmacphee’s picture

oops I meant to but the response object..

mpgResponse Object
(
[responseData] => Array
(
[ReceiptId] => cs021612375900000015
[ReferenceNum] => 661644350010010130
[ResponseCode] => 027
[ISO] => 01
[AuthCode] => 024776
[TransTime] => 12:37:50
[TransDate] => 2010-02-16
[TransType] => 00
[Complete] => true
[Message] => APPROVED * =
[TransAmount] => 114.29
[CardType] => V
[TransID] => 13-0_28
[TimedOut] => false
[Ticket] => null
)

[p] => Resource id #326
[currentTag] => /dev/null
[purchaseHash] => Array
(
)

[refundHash] =>
[correctionHash] => Array
(
)

[isBatchTotals] => 0
[term_id] =>
[receiptHash] => Array
(
)

[ecrHash] => Array
(
)

[CardType] =>
[currentTxnType] =>
[ecrs] => Array
(
)

[cards] => Array
(
)

[cardHash] => Array
(
)

[ACSUrl] =>
)

drewmacphee’s picture

if (($this_trans_type == uc_moneris_preauth_string() && $txn_type == uc_moneris_transaction_type()) && intval($response_code) < 49 || $completed == 'true')

Turns out it's this line.. it was causing a purchase than a capture.
I outputted all the values

$this_trans_type = purchase
uc_moneris_preauth_string() = preauth
$txn_type = purchase
uc_moneris_transaction_type() = purchase
intval($response_code) = 27
$completed = true

so it was ((false && true) && true || true) = true then in my case it should have been false. I'm thinking it has something to do with the $complete == 'true' part?? should that perhaps be == false?
Maybe I'm missing the point of that part of the code.

mmuzard’s picture

Hi there,
any progress on this issue? I'm having the same problem

steve.m’s picture

+1 seeing the same thing here

steve.m’s picture

Same thing with HEAD as with alpha1

acrazyanimal’s picture

I will attach a patch shortly, but what I found was that if you do not do any additional checks like cvv or address verification then the transaction is completed immediately and no pre-auth is created. In this case however a second COMPLETE request is still sent to moneris by the module and it returns with a failure because it cannot find a pre-auth with the proper credentials (ie orderid, cc#, etc).

The fix is on line 510: add brackets around intval($response_code) < 49 || $completed == 'true'

if (($this_trans_type == uc_moneris_preauth_string() && $txn_type == uc_moneris_transaction_type()) && (intval($response_code) < 49 || $completed == 'true')) {

acrazyanimal’s picture

StatusFileSize
new344 bytes

Here is a patch for alpha. Hopefully all is good.

steve.m’s picture

@j.payne -- adding the brackets works nicely (on head as well as alpha). Thanks!

sreynen’s picture

Component: Miscellaneous » Code
Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.29 KB

I just ran into this. It's a critical bug. The current code gives users false feedback about charges to their credit cards. Seems like there are probably some legal liability involved in telling customers there was no charge when there really was. This current release maybe shouldn't be recommended.

I'm attaching a new version of j.payne's patch in what I believe is the more standard patch format.

greggles’s picture

Status: Needs review » Closed (duplicate)

There's a patch over at #730048: Pre-auth/capture check conflicts with purchase which affects the same area so I merged this code into that one since it also does a bit more stuff.

I've re-rolled it and would love a review.

I hope to commit it today.

dlx’s picture

Version: 6.x-1.0-alpha1 » 6.x-1.x-dev

Just FYI: I'm using the latest (as of March 2012) dev branch and this patch IS STILL NOT APPLIED.

greggles’s picture

@dlx, the module is marked "unsupported" so I'm not sure why you are surprised that it is not getting the necessary fixes/attention.

If you would like to take it over and fix it, you certainly are welcome to.

It is almost never appropriate, however, to use ALL CAPS.