mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #8759 from jibees/8547-use-the-last-payment-in-the-Payment-Method-Report
Use the last payment method instead of the first for the Payment Method Report
This commit is contained in:
@@ -6,7 +6,7 @@ module Spree
|
||||
module ReportsHelper
|
||||
def report_payment_method_options(orders)
|
||||
orders.map do |order|
|
||||
payment_method = order.payments.first&.payment_method
|
||||
payment_method = order.payments.last&.payment_method
|
||||
|
||||
next unless payment_method
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ module OpenFoodNetwork
|
||||
order.email,
|
||||
ba&.phone,
|
||||
order.shipping_method&.name,
|
||||
order.payments.first&.payment_method&.name,
|
||||
order.payments.last&.payment_method&.name,
|
||||
order.total,
|
||||
balance(order)]
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ describe Spree::ReportsHelper, type: :helper do
|
||||
let(:order_with_payments) { create(:order_ready_to_ship) }
|
||||
let(:order_without_payments) { create(:order_with_line_items) }
|
||||
let(:orders) { [order_with_payments, order_without_payments] }
|
||||
let(:payment_method) { order_with_payments.payments.first.payment_method }
|
||||
let(:payment_method) { order_with_payments.payments.last.payment_method }
|
||||
|
||||
it "returns payment method select options for given orders" do
|
||||
select_options = helper.report_payment_method_options([order_with_payments])
|
||||
|
||||
Reference in New Issue
Block a user