mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #6965 from andrewpbrett/fix-sca-snail
Fix #6964: don't try to complete a failed payment
This commit is contained in:
@@ -20,7 +20,7 @@ class ProcessPaymentIntent
|
||||
|
||||
last_payment.update_attribute(:cvv_response_message, nil)
|
||||
OrderWorkflow.new(@order).next
|
||||
last_payment.complete! if !last_payment.completed?
|
||||
last_payment.complete! if last_payment.can_complete?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -47,5 +47,19 @@ describe ProcessPaymentIntent do
|
||||
expect(order).to have_received(:deliver_order_confirmation_email)
|
||||
end
|
||||
end
|
||||
|
||||
context "payment is in a failed state" do
|
||||
let(:invalid_intent) { "invalid" }
|
||||
let(:service) { ProcessPaymentIntent.new(invalid_intent, order) }
|
||||
|
||||
before do
|
||||
payment.update_attribute(:state, "failed")
|
||||
end
|
||||
|
||||
it "does not complete the payment" do
|
||||
service.call!
|
||||
expect(payment.reload.state).to eq("failed")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user