mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Use VoucherAdjustmentsService to retrieve tax part of the voucher
This commit is contained in:
@@ -70,7 +70,6 @@ module Spree
|
||||
scope :credit, -> { where('amount < 0') }
|
||||
scope :return_authorization, -> { where(originator_type: "Spree::ReturnAuthorization") }
|
||||
scope :voucher, -> { where(originator_type: "Voucher") }
|
||||
scope :voucher_tax, -> { where(originator_type: "Voucher").where("label LIKE 'Tax%'") }
|
||||
scope :non_voucher, -> { where.not(originator_type: "Voucher") }
|
||||
scope :inclusive, -> { where(included: true) }
|
||||
scope :additional, -> { where(included: false) }
|
||||
|
||||
@@ -159,10 +159,8 @@ module Reporting
|
||||
end
|
||||
|
||||
def voucher_tax_adjustment(order)
|
||||
included_tax_voucher_adjustment = order.voucher_adjustments.first&.included_tax || 0
|
||||
excluded_tax_voucher_adjustment = order.all_adjustments.voucher_tax.first&.amount || 0
|
||||
|
||||
included_tax_voucher_adjustment + excluded_tax_voucher_adjustment
|
||||
VoucherAdjustmentsService.new(order).voucher_included_tax +
|
||||
VoucherAdjustmentsService.new(order).voucher_excluded_tax
|
||||
end
|
||||
|
||||
def first_name(query_result_row)
|
||||
|
||||
Reference in New Issue
Block a user