mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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!)
|
||||
|
||||
Reference in New Issue
Block a user