When trying to issue a refund on a transaction I get this error
The element 'transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'splitTenderId, order, lineItems, tax, duty, shipping, taxExempt, poNumber, customer, billTo, shipTo, customerIP, cardholderAuthentication, retail, employeeId, transactionSettings, userFields, surcharge, merchantDescriptor, subMerchant' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
In case it matters was using a sandbox account with checkout set to authorize only and then did a manual capture through the order interface.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | commerce_authnet-error-issuing-refunds-2883122-12.patch | 1.27 KB | onedotover |
| #4 | commerce_authnet-error-issuing-refunds-2883122-4.patch | 1.24 KB | ctrladel |
Comments
Comment #2
ctrladelComment #3
ctrladelAttached patch resolved my issue. There were 2 separate issues.
Comment #4
ctrladelSmall fix to where I put the refTransId
Comment #5
josephdpurcell commentedThis will break non-sandbox, yes? Can you use the "Is sandbox?" flag to toggle whether to pull expiration date from the $payment_method?
If moving this out of the constructor is to control the order of parameters, I don't think this solution is best. Ordering restrictions should be seamless to the caller of the AuthorizeNet.php class--i.e. can we put ordering logic into the class?
Comment #6
ctrladelThe documentation doesn't specify a difference between sandbox and production for refunds.
The class is provided by the SDK and looks fairly bare bones currently, would need some input from mglaman on if this should be resolved there.
Comment #7
mglamanSo the API documentation is conflicting.
For the root
paymententryBut for
inside of it
Also
As painful as it sounds, it seems like there needs to be a serializer class which puts properties where they are expected to belong when a request is fired.
Comment #8
mglamanI've updated the SDK to provide property mapping which fixes the refTransId issue. I also added refund tests. Passing
XXXXor1234didn't matter.Comment #9
mglamanCan you run
composer update commerceguys/authnetand see if the latest commits fix refund issues? I'm thinking it might not need changes in the module itself.Comment #10
onedotover commentedI just tried out the latest from commerceguys/authnet and I'm getting this error now:
The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:expirationDate' element is invalid - The value XX is invalid according to its datatype 'String' - The actual length is less than the MinLength value.
Comment #11
mglamanThanks.
The test code in the SDK is
The module
From #10 it looks like a string less than four digits was passed. Not sure how, especially if just XX.
Can someone just try manually changing the code to pass
XXXXinstead of the payment method's expiration information?Comment #12
onedotover commentedOk, so the error returned from Auth.net is adding the XX for some reason. The actual request was sending an empty expirationDate. I tested with both the actual expiration date, and XXXX and both seemed to work in the Sandbox (which lines up with what mglaman found in #8).
I also found a related bug having to do with the amount refunded. The attached patch for the module fixed things for me.
Comment #13
mglamanSweet! Thanks so much for the find. I want to just see another +1 from other users here then I'll commit. Won't tag a new beta, though, as we'll be rolling Commerce RC1 soon and need a new beta just for that.
Comment #14
mglamanThanks, everyone!
Comment #16
ctrladelWas finally able to keep a database long enough to settle a transaction and can confirm that the issue is fixed. Thanks for all the hard work.