Currently uc_moneris does not actually enforce avs or cvv verification. This patch adds that functionality.

It also adds a configurable option to specify whether to use the US or Canadian api, which differs by passing in a 'purchase' or 'us_purchase' transaction type.

This patch is against HEAD, not the D5 branch.

CommentFileSizeAuthor
#3 488848-1.patch9.96 KBezra-g
#2 488848.patch10.4 KBezra-g
uc_moneris_ezra.patch10.25 KBezra-g

Comments

ezra-g’s picture

Assigned: Unassigned » ezra-g
Status: Active » Needs work

This needs a re-roll to cover some spots where the transaction type is incorrect for the Canadian API.

ezra-g’s picture

Status: Needs work » Needs review
StatusFileSize
new10.4 KB

Here is a more complete re-roll. This also changes the "unable to verify" avs/cvv drupal_set_messages to be warnings.

ezra-g’s picture

StatusFileSize
new9.96 KB

Previous patch included a line from #412910: Moneris for Drupal 6?.

greggles’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j0rd’s picture

Alright. This patch is bad. This patch allows successfully processed transactions to get shown to the user and ubercart "AVS Failed", even though there transaction has been processed on their credit card.

Here's the use case:

Moneris returns with AVS 'W'. Which it has been on my account. AVS code 'W' is not in the $avs_access array, there for the AVS code marks the transaction as failed, even though the $response_code is less than 49 (a success).

The true way (which needs to superceed any other logic on success/failed) I believe needs to be the response_code. This tells us if we have charged the card or not. If we have charged the card, we need to allow ubercart to display a successful transaction. Otherwise the user will continue to process their card (sucessfully) but being displayed failed messages.

THIS IS BAD BAD BAD and does happen with this code.

Everything needs to be refactored to error on the side of caution.

It should work like this

IF success_code
THEN treat everything as a success and perhaps warn about CVV and AVS codes we dont understand in watchdog, so we can resolve them and improve the module
ELSE failed_code
THEN check to see why it failed including CVV and AVS

right now it works like this

IF success_code
THEN mark transaction as successs
IF FAILED CVV
THEN mark transaction as failed
IF FAILED AVS
THEN mark transaction as failed

this is poor logic and your clients are getting billed and ubercart is not showing successes.

ezra-g’s picture

Thanks for pointing this out. Since this patch has long ago been applied, I created a new issue for this bug report: http://drupal.org/node/630064

j0rd’s picture

Category: feature » bug
Priority: Normal » Critical
Status: Closed (fixed) » Active

Here's another bug:

if (($this_trans_type == 'us_preauth' && $txnType == 'us_purchase') && intval($response_code) < 49 || $completed == 'TRUE') {

$completed is equal to 'true'
$completed is never equal to 'TRUE'

Again, when you are dealing with credit card processor integrations you need to error in the side of caution and should do something like

str_tolower($completed) == 'true';

Unless for what ever reason PHP string comparisons are case insensitive, but I don't think they are.

Here's what responses look like

<?xml version="1.0" standalone="yes"?><response><receipt><ReceiptId>csDDDDDDDDDD</ReceiptId><ReferenceNum>66DDDDDDDDD</ReferenceNum><ResponseCode>027</ResponseCode><ISO>01</ISO><AuthCode>08DDDD</AuthCode><TransTime>21:36:10</TransTime><TransDate>2009-11-03</TransDate><TransType>01</TransType><Complete>true</Complete><Message>APPROVED * =</Message><TransAmount>28.22</TransAmount><CardType>V</CardType><TransID>3D-D_DD</TransID><TimedOut>false</TimedOut><BankTotals>null</BankTotals><Ticket>null</Ticket><AvsResultCode>Y</AvsResultCode><CvdResultCode>1M</CvdResultCode></receipt></response>

I've replaced numbers with D to hide the information.

Here's one with AVS response W

<ReceiptId>cs1DDDDDDDDDD</ReceiptId><ReferenceNum>661DDDDDDDDDD</ReferenceNum><ResponseCode>027</ResponseCode><ISO>01</ISO><AuthCode>1DDDDZ</AuthCode><TransTime>10:09:35</TransTime><TransDate>2009-11-11</TransDate><TransType>01</TransType><Complete>true</Complete><Message>APPROVED * =</Message><TransAmount>45.15</TransAmount><CardType>M</CardType><TransID>DD-0_DD</TransID><TimedOut>false</TimedOut><BankTotals>null</BankTotals><Ticket>null</Ticket><AvsResultCode>W</AvsResultCode><CvdResultCode>1M</CvdResultCode></receipt></response>

I've also noticed that successful transactions seem to have an AUTHCODE of non 0000000 . I assume this also means it was able to auth the card and charge it.

ezra-g’s picture

Category: bug » feature
Priority: Critical » Normal
Status: Active » Closed (fixed)

Thanks for pointing this out. The proper place for this new bug is in a new bug report. Please open a new issue so that we can keep track of it. Thanks!

j0rd’s picture

nevermind.