Closed (fixed)
Project:
Commerce Authorize.Net
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Feb 2018 at 20:09 UTC
Updated:
20 Mar 2020 at 19:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mglamanProof of concept backport. Basics work with minor testing.
Comment #3
TynanFox commentedMy site uses a payment processor that utilizes Gateway Emulation of Authorize.net. To make it work with this, I'm changing the variables noted in my settings file as noted here. Does modifying these variables still work when using this patch/using Accept.js?
Comment #4
mglamanIt is not modifying the existing payment method. It is adding a new one, so emulators need not worry.
Comment #5
drummThis seems to be working well so far.
I did add a bit of CSS to put all the credit card fields inline, but that’s easily handled in the theme:
Comment #6
drummTest cards seem to be declined, but record as a successful payment. Here is an example payload:
Comment #7
drummThe customer name & address are also not being populated in Authorize.net
Comment #8
ericchew commentedHere is a patch that fixes a few things (FYI I am only testing in the ADMIN area, someone else will need to test cart.)
Card on file needs work, can't add them in admin UI or select them in payment terminal.
Comment #9
ericchew commentedThis patch adds Card On File capabilities.
Notes:
Comment #10
ericchew commentedOne thing I notice is that if you create a card on file, then delete a card on file (so there are no more cards on file for the customer), then try to create a new card on file..you get "Error: Invalid OTS Token". I'm guessing this is because it is assuming there is a payment profile from a previous card.
Comment #11
ericchew commentedShould be working in the cart now with this patch. Had to create custom submit handler for new cards to be able to pass opaqueData instead of creditCard. You'll notice I didnt spend any time trying to make this code pretty, so feel free to refactor if you want!
The Error: Invalid OTS Token still remains if you delete all cards for a customer and try to add another. If you delete the customer profile altogether (via authorize.net site), it fixes the issue. Maybe when deleteing card we can check to see if it is the last card on file, and if so delete the customer profile?
Comment #12
ericchew commentedForgot to remove a variable I no longer used.
Comment #13
mglamanRE bug in #11: that is a fix I just had to make in D8 #2832501: Duplicate payment profile code should lookup if method is already in system.
Comment #14
mglamanericchew thanks so much. I'm going to tackle the "Invalid OTS Token" error.
Comment #15
mglamanThis backports the profile creation logic from D8 to handle Accept.js and invalid tokens.
Comment #16
mglamanDebugging line, and invalid jQuery for what ships with core.
Comment #17
mglamanFixed jQuery
Interdiff:
Comment #18
mglamanI also hit another quirk. If there is an error the submit button is still disabled and the loading gif keeps on spinning.
Comment #19
mglamanFixes unable to go back on error (or at all.)
Comment #20
mglamanHere's an attempt to fix duplicates in card on file / admin terminal scenario.
Comment #21
mglamanWhen using the card 4111111111111111 with zip code 46282 the General bank decline workflow is triggered.
However checkout completes, and the order's payment transaction shows success even though:
Comment #22
mglamanFix the handling.
Interdiff:
Comment #23
mglamanClean up the files.
Comment #24
drummThis is the same patch as #22, but without the
debugger;statements.Comment #25
drummI can confirm what I spotted in #6-7 looks all good now.
Comment #26
mglamanI think the only thing we are missing from the AIM gateway is:
* Invoice num
* Email
* Customer ID
* Customer IP
Comment #27
drummThis patch adds the order number, line items, and customer ID, email, and IP.
Comment #28
drummThe error handling may need to be improved. When testing with rejected API requests, there were the good
commerce_authnetwatchdog messages likeAuthorize.net error: E00003 - The element 'lineItem' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'quantity' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'name' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.But also some noisy
phpwatchdog messages:Notice: Undefined index: transactionResponse in commerce_authnet_acceptjs_submit_form_submit() (line 267 of /var/www/dev/acceptjs-jobs.private.devdrupal.org/htdocs/sites/all/modules/commerce_authnet/includes/commerce_authnet.acceptjs.inc).Comment #29
drummThis version of the patch:
Comment #30
mglamanLet's commit this. I discussed with drumm, and this looks to be solid! Thanks a lot. We can handle any nits in follow ups.
Comment #32
mglamanYay! Glad to see this in.
Comment #34
tonytheferg commentedShould we be able to Limit accepted credit cards to the following types: with accept.js? Should i open a new issue for this?
Comment #35
tonytheferg commentedAlso, I noticed something in testing:
If there is a typo (wrong CVV for example) It will decline as it should, but when the typo is fixed, and the card resubmitted, the checkout screen is refreshed with no message, and there is this notice in the log:
Authorize.net error: E00027 - The transaction was unsuccessful.According to this, it's a duplicate transaction error. It seems this resolves/refreshes after a couple of minutes. This seems to be common behavior for Authorize.net, (see here) So maybe the default "this transaction has been declined" message should include "please allow 3 minutes to prevent duplicate transactions" (or whatever)
Comment #36
jaimeah commentedThank you for adding accept.js support for Drupal 7. Any plans for the acceptui.js hosted form variant?