mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix rubocop warning
This commit is contained in:
@@ -47,9 +47,7 @@ class VoucherAdjustmentsController < BaseController
|
||||
return false
|
||||
end
|
||||
|
||||
# Clear payments and payment_fee, to not affect voucher adjustment calculation
|
||||
@order.all_adjustments.payment_fee.destroy_all
|
||||
@order.payments.clear
|
||||
clear_payments
|
||||
|
||||
VoucherAdjustmentsService.new(@order).update
|
||||
@order.update_totals_and_states
|
||||
@@ -81,4 +79,10 @@ class VoucherAdjustmentsController < BaseController
|
||||
def voucher_params
|
||||
params.require(:order).permit(:voucher_code)
|
||||
end
|
||||
|
||||
# Clear payments and payment fees, to not affect voucher adjustment calculation
|
||||
def clear_payments
|
||||
@order.all_adjustments.payment_fee.destroy_all
|
||||
@order.payments.clear
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,9 +67,7 @@ describe VoucherAdjustmentsController, type: :request do
|
||||
|
||||
context "when the order has a payment and payment feed" do
|
||||
let(:payment_method) { create(:payment_method, calculator: calculator) }
|
||||
let(:calculator) do
|
||||
::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)
|
||||
end
|
||||
let(:calculator) { Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) }
|
||||
|
||||
before do
|
||||
create(:payment, order: order, payment_method: payment_method, amount: order.total)
|
||||
|
||||
Reference in New Issue
Block a user