Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorize.net CIM not getting Shipping Address #174

Open
onedanshow opened this issue Aug 24, 2014 · 11 comments
Open

Authorize.net CIM not getting Shipping Address #174

onedanshow opened this issue Aug 24, 2014 · 11 comments

Comments

@onedanshow
Copy link
Contributor

I've got a pretty run-of-the-mill setup for Spree on royalsportltd.com. However, it appears spree_gateway is not sending the shipping address to Authorize.net CIM. It does work when sending just using plain Authorize.net. I thought I could fix the issue by uncommenting and changing this line:

onedanshow@b595311#diff-d41d8cd98f00b204e9800998ecf8427e

Anyone else having this problem?

We've got a billing-shipping mismatch fraud filter that is catching the problem.

Original post: https://groups.google.com/forum/#!topic/spree-user/5RKsLjCY2ps

@onedanshow
Copy link
Contributor Author

It looks like the formatting for how to add a shipping address for Authorize.net has changed since the class in spree_gateway tried to implement it. There is nothing for the following in spree_gateway's class for Authorize.net CIM:

https://github.com/Shopify/active_merchant/blob/127be6da129c198319cbbc3dca720cbfc07f6980/lib/active_merchant/billing/gateways/authorize_net.rb#L313

Spree Gateway's non-CIM class just uses ActiveMerchant's default class, hence why it includes the shipping address. I'll look into create a pull request for adding the shipping address on CIM in spree_gateway.

@onedanshow
Copy link
Contributor Author

This documentation from Authorize.net still says use the "shipToList" key, though: http://www.authorize.net/support/CIM_XML_guide.pdf

(Documenting for future reference)

@onedanshow
Copy link
Contributor Author

Here is what I learned:

CIM does get the shipping and billing address saved with the profile after a Spree::Payment is created and create_profile is called:
https://github.com/spree/spree_gateway/blob/master/app/models/spree/gateway/authorize_net_cim.rb#L52

If this line is uncommented and changed to what I have in my repo:
https://github.com/spree/spree_gateway/blob/master/app/models/spree/gateway/authorize_net_cim.rb#L117

However, the create_transaction method is what is called to perform a capture, authorization, etc. and it was goes through the shipping/billing mismatch filter:
https://github.com/spree/spree_gateway/blob/master/app/models/spree/gateway/authorize_net_cim.rb#L76

That method needs to be extended to include the "customerShippingAddressId" as the CIM documentation has it. However, the ID of the shipping address saved to CIM is not saved on the Spree side, just the profile ID and payment profile ID. Would probably need to save a "gateway_shipping_address_id" on some model like Spree::Creditcard has.

@JDutil
Copy link
Member

JDutil commented Sep 18, 2014

I've made some tweaks so that the gateway options are used, but I'm still not seeing shipping address get set even with ship_to_list option... I'm not sure the best solution to this issue it seems like we need to call the create shipping address method separately.

@onedanshow
Copy link
Contributor Author

Yeah, I believe CIM wants you to pass the ID that it has for shipping address to use when charging the card. Spree doesn’t store gateway IDs for addresses through, just the payment profile.

On Sep 18, 2014, at 3:27 PM, Jeff Dutil [email protected] wrote:

I've made some tweaks so that the gateway options are used, but I'm still not seeing shipping address get set even with ship_to_list option... I'm not sure the best solution to this issue it seems like we need to call the create shipping address method separately.


Reply to this email directly or view it on GitHub.

@jimjimovich
Copy link

Is Authorize.net CIM still broken?

@JDutil
Copy link
Member

JDutil commented Mar 10, 2015

Is it broken? No. Is this still an issue? Yes.

@onedanshow
Copy link
Contributor Author

We're still using Auth.net CIM for our existing stores, but the new store we're working on will be using Stripe. Auth.net feels likes the Windows XP of payment gateways.

@JDutil
Copy link
Member

JDutil commented Mar 10, 2015

That would be because it is...

@jasonfb
Copy link

jasonfb commented Mar 12, 2015

Are you guys testing this on the master branch of spree_gateway? I just wanted to know to parse some information about some other bugs I'm seeing

@JDutil
Copy link
Member

JDutil commented Mar 12, 2015

I believe I tested with 2.4 at the time, and believe this would still remain an issue on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants