mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Avoid reloading the payment every time, so that in-memory data is not wiped out
When checkout fails and the payment states dont match (inside the if), in-memory data of the failed payment can be lost but updating the payment state is the fundamental part here so that further checkout attempts work. We may improve this update statement so that all the data of the failed payment is persisted
This commit is contained in:
@@ -64,8 +64,8 @@ class OrderWorkflow
|
||||
def persist_all_payments
|
||||
order.payments.each do |payment|
|
||||
original_payment_state = payment.state
|
||||
if original_payment_state != payment.reload.state
|
||||
payment.update(state: original_payment_state)
|
||||
if original_payment_state != Spree::Payment.find(payment.id).state
|
||||
payment.reload.update(state: original_payment_state)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user