Using the uc_recurring module, we found that a recent batch of renewal transactions failed with the following error:

Error processing order 96666: Error: The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:customerShippingAddressId' element is invalid - The value '' is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:numericString' - The Pattern constraint failed.

As it turns out, Authorize.net won't accept an empty string for this element. When empty, zero must be passed. This patch addresses this by checking for an empty string and supplying 0 (zero) when the string is empty.

Also included in this patch, but not required, is an additional order admin comment for logging the Authorize.net error to the order itself. This is helpful with recurring transactions, since uc_recurring is abstracted and doesn't seem to have access to the API response and can't log it itself.

Files: 
CommentFileSizeAuthor
#9 ubercart_authorizenet.module-fix_CIM_error-1933424-9.patch1.16 KBDanZ
PASSED: [[SimpleTest]]: [MySQL] 2,148 pass(es).
[ View ]
#2 uc_authorizenet.module-fix_CIM_error.patch925 bytesr.aubin
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_authorizenet.module-fix_CIM_error_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
uc_authorizenet.module-fix_CIM_error.patch859 bytesr.aubin
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_authorizenet.module-fix_CIM_error.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Needs review» Needs work

The last submitted patch, uc_authorizenet.module-fix_CIM_error.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new925 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_authorizenet.module-fix_CIM_error_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Adding new patch with path to module file....first one failed. Boo.

Status:Needs review» Needs work

The last submitted patch, uc_authorizenet.module-fix_CIM_error.patch, failed testing.

Version:6.x-2.11» 6.x-2.x-dev
Priority:Major» Normal
Status:Needs work» Needs review

Patches need to be applied to the current -dev module.

This doesn't affect most users, so it's a "normal" instead of a "major" (although it is certainly important for those people!).

Status:Needs review» Needs work

The last submitted patch, uc_authorizenet.module-fix_CIM_error.patch, failed testing.

Great, thanks DanZ. Tried to find a good template for getting my patch to pass testing, but was unable. Rolling it from my own dev environment using SVN. If there's something I need to do to make the patch file compatible with the test suite, let me know and I can update it.

Hmm. You don't use SVN any more. Use GIT instead.

You should be making patches from the current -dev repository, too.

Complete directions are at https://drupal.org/node/129292/git-instructions/6.x-2.x.

Also, just FYI, Drupal 6 will be unsupported later this year when Drupal 8 is released. This might be good time to consider upgrading to Drupal 7 / Ubercart 3, since you'll have to do it later, anyway.

Status:Needs work» Needs review
StatusFileSize
new1.16 KB
PASSED: [[SimpleTest]]: [MySQL] 2,148 pass(es).
[ View ]

Let's see what the testbot thinks of this (completely untested) version of your patch. (I don't run D6, so I just went through the motions at https://drupal.org/node/129292/git-instructions/6.x-2.x, because you only modified two lines.)

This is basically a followup to #1578482: customerShippingAddressId needs to be added to uc_authorizenet CIM payments, I wonder why rickmanelius did not suffer from this issue. I don't use uc_recurring or Authorize.Net so I have no idea whether this is the correct thing to do or not.

I do however agree with adding comments for failed charges, as we already do the same for successful ones.

Also, as you are using uc_recurring and Authorize.Net, are you able to shed any light on #1777024: Invalid ARB payment notification received.? I guess you're not seeing the same issue?

I'm not sure on http://drupal.org/node/1777024. We're not using ARB, but from what experience we have had with Auth.net's API, it does require a particular order to the elements passed.

Looks like #1578482 was using d7. Might be why rickmanelius didn't encounter the error?

Status:Needs review» Fixed

I committed the fix for customerShippingAddressId to 6.x only, as I am not sure whether the same applies to 7.x.

I also rearranged the uc_order_comment_save() code slightly to avoid duplication, and committed that to both branches.

Status:Fixed» Closed (fixed)

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