Apply voucher after transitionning to the confirmation step

Testing that VoucherAdjustmentsService.calculate has been called after a
transition doens't work, skipping test for now.
This commit is contained in:
Gaetan Craig-Riou
2023-06-26 14:48:22 +10:00
parent 366cca7984
commit ca7dcb82b8

View File

@@ -81,6 +81,12 @@ module Spree
order.create_tax_charge!
order.update_totals_and_states
end
after_transition to: :confirmation do |order|
VoucherAdjustmentsService.calculate(order)
order.update_totals_and_states
end
after_transition to: :complete, do: :finalize!
after_transition to: :resumed, do: :after_resume
after_transition to: :canceled, do: :after_cancel