Skip to content

Commit

Permalink
Fix ProcessPaymentIntent service
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley authored and abdellani committed Jun 5, 2023
1 parent cef8969 commit 4a8a146
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/services/process_payment_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion spec/services/process_payment_intent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down

0 comments on commit 4a8a146

Please sign in to comment.