Files
openfoodnetwork/app/views/spree/orders/_totals_footer.html.haml
Gaetan Craig-Riou c71ae35685 Fix payment_total calculation
For payment that complete during the checkout (Paypal, Stripe) the
amount was recorded twice against `order.payment_total`. This is because
the `payment_total` gets updated in an afer_save Payment callback when a
payment is completed, and then once more when we process payment in
`Spree::Order#process_each_payment`.
This is an existing  issue on master, but it was hidden by the
`update_shipping_fees!` callback, it trigerred an update of the order's
total, which then updated `order.payment_total` with the correct value.
Now that we removed the callback, the bug showed up.

Note, I updated the stripe specs for consistency even though they are
currently disabled.
2025-01-20 16:07:32 +11:00

59 lines
1.7 KiB
Plaintext

%tfoot
#subtotal
%tr#subtotal-row.total
%td.text-right{colspan: "3"}
%strong
= t :order_produce
%td.text-right.total
%span= display_checkout_subtotal(order)
#order-charges
- checkout_adjustments_for(order, exclude: [:line_item]).reverse_each do |adjustment|
%tr.total
%td.text-right{:colspan => "3"}
%strong
- if adjustment.originator_type == "Voucher"
= "#{t(:voucher)}:"
= adjustment.label
%td.text-right.total
%span= adjustment.display_amount.to_html
#order-total.order-details-total
%tr.total
%td.text-right{colspan: "3"}
%h5
= t :order_total_price
%td.text-right.total
%h5#order_total= order.display_total.to_html
%tr.total
%td.text-right{colspan: "3"}
%strong
= t :order_amount_paid
%td.text-right.total{id: "amount-paid"}
%strong
= order.display_payment_total.to_html
- if order.outstanding_balance.positive?
%tr.total
%td.text-right{colspan: "3"}
%h5.not-paid
= t :order_balance_due
%td.text-right.total.not-paid
%h5.not-paid
= order.display_outstanding_balance.to_html
- if order.outstanding_balance.negative?
%tr.total
%td.text-right{colspan: "3"}
%h5
= t :credit_owed
%td.text-right.total
%h5
= order.display_outstanding_balance.to_html
- if order.total_tax.positive?
#tax
%tr#tax-row.total
%td.text-right{colspan: "3"}
= t :order_includes_tax
%td.text-right.total
%span= display_checkout_tax_total(order)