Tom Wilson
08/28/2023, 6:29 PMSpree::Payment::Processing#handle_response
doesn't store the response.error_code
on the payment as self.response_code
? Is doing so in a monkey patch going to set us up for some sort of nasty failure? (I could easily just add a new column, but I'm curious about the design thought behind the existing system)waiting_for_dev
08/29/2023, 7:16 AMTom Wilson
08/29/2023, 3:03 PMTom Wilson
08/29/2023, 3:04 PMTom Wilson
08/29/2023, 3:05 PMTom Wilson
08/29/2023, 3:06 PMorder.complete
fails with a "hard" error vs a "soft" error. With what I can see currently, there's no good information in the Payment object we can use to make that determination - order.errors
contains relevant messages, but those aren't really suitable for status codes because they could change/etc.waiting_for_dev
08/30/2023, 3:38 AMTom Wilson
08/30/2023, 2:09 PMpayment.log_entries.last
to drive conditional logic. That's why I'm asking about Payment.response_code
- it feels better to look at order.payments.last.response_code
in order to determine how to respond to the client.Tom Wilson
08/30/2023, 2:10 PMwaiting_for_dev
08/30/2023, 2:11 PMwaiting_for_dev
08/30/2023, 2:11 PMTom Wilson
08/30/2023, 2:15 PMorder.complete
. Based on what happens at that moment, we want to change the return value. Solidus seems to expect the gateway to return an ActiveMerchant::Billing::Response
, which then is processed in Payment::Processing
. If the response is not successful, processing raises a Core::GatewayError
which is caught during process_payments_with
.Tom Wilson
08/30/2023, 2:16 PMfailed
in that scenario, I think, for example.waiting_for_dev
08/30/2023, 2:24 PMTom Wilson
08/30/2023, 2:26 PMSpree::Payment
to actually store the error code as the response code:
def handle_response(response)
super
rescue Spree::Core::GatewayError
update!(response_code: response.error_code)
raise
end
Tom Wilson
08/30/2023, 2:27 PMstate: failed, response_code: card_declined
in this particular casewaiting_for_dev
08/30/2023, 2:27 PMTom Wilson
08/30/2023, 2:29 PMwaiting_for_dev
08/30/2023, 2:30 PM