diff --git a/app/services/process_payment_intent.rb b/app/services/process_payment_intent.rb index b18319d83dc2..ee13414b9c12 100644 --- a/app/services/process_payment_intent.rb +++ b/app/services/process_payment_intent.rb @@ -56,8 +56,9 @@ def call! attr_reader :order, :payment_intent, :payment def process_payment - OrderWorkflow.new(order).next if order.state == "payment" - order.process_payments! + return unless order.process_payments! && order.state == "confirmation" + + OrderWorkflow.new(order).next end def ready_for_capture? diff --git a/spec/services/process_payment_intent_spec.rb b/spec/services/process_payment_intent_spec.rb index 1e7b43decd3d..5d9570e5c763 100644 --- a/spec/services/process_payment_intent_spec.rb +++ b/spec/services/process_payment_intent_spec.rb @@ -9,7 +9,7 @@ let(:customer) { create(:customer) } let(:order) { create(:order_with_totals, customer: customer, distributor: customer.enterprise, - state: "payment") + state: "confirmation") } let(:payment_method) { create(:stripe_sca_payment_method) }