Closed acreilly closed 7 years ago
👍 that sounds great! In general I prefer avoid extra levels of abstraction but after working through a few endpoints using the login-and-pay Amazon gem it's pretty ugly even figuring out whether a response is failure or not. I think it would be great if we could keep any solution here pretty minimal and still provide access to the raw response object.
Another idea: What if we instead focused on submitting some PRs to the login-and-pay gem that made the response objects from there easier to work with?
Before I get too far, this is where I am at right now. Let me know what you think. Refund and cancel has not been addressed yet. https://github.com/boomerdigital/solidus_amazon_payments/tree/acr/response-model
@acreilly that's looking much nicer than what we currently have! It seems like a lot of it could be pushed upstream to the amazon gem itself though. What do you think?
Possibly. Some things need to stay on our side since they are Spree specific. I don't plan to replace the ActiveMerchant::Billing::Response (or what may end up being the login and pay response?) with the Amazon Response model. I just want to move a lot of the fetching logic out of the gateway, clean it up. Manuel and I were discussing this yesterday. I am going to hold off on the Response model until all calls are handled with the login and pay gem. Also, just want you to take a look at success? in the login and pay gem. I'm not sure if checking for the HTTP status to be 200 will be accurate. Do we know for sure that when we get a response with a status 'Declined' that it doesn't send a 200 code?
Right now, the gateway and handling the responses from amazon is a mess. I'd like to create a response model to handle the information given to us.