From 9ca1a9e33f751ffb648433183eade5330ccb064e Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 16 Feb 2026 13:29:53 +1100 Subject: [PATCH] Allow orders to be paid before checkout Taler puts the payment completion into the hands of the user. So we can't strictly finalise the payment and order together. And in the bigger picture, it should be okay if a payment goes through but we have to abort checkout due to stock issues. Then we want to be able to check out again, using the existing complete payment. Any refunds can be handled later by the shop owner. --- app/models/spree/order.rb | 2 -- spec/models/spree/order_spec.rb | 5 ----- 2 files changed, 7 deletions(-) diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 741ebe0d55..ed608aa46b 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -674,8 +674,6 @@ module Spree end def process_each_payment - raise Core::GatewayError, Spree.t(:no_pending_payments) if pending_payments.empty? - pending_payments.each do |payment| if payment.amount.zero? && zero_priced_order? payment.update_columns(state: "completed", captured_at: Time.zone.now) diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index d9ae1a59f3..d8fe7e9f2a 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -282,11 +282,6 @@ RSpec.describe Spree::Order do let(:payment) { build(:payment) } before { allow(order).to receive_messages pending_payments: [payment], total: 10 } - it "returns false if no pending_payments available" do - allow(order).to receive_messages pending_payments: [] - expect(order.process_payments!).to be_falsy - end - context "when the processing is sucessful" do it "processes the payments" do expect(payment).to receive(:process!)