Update voucher adjustment and order total when adding a voucher

This is needed so we can check if payment is needed and display
no payment required when no payment needed
This commit is contained in:
Gaetan Craig-Riou
2023-07-28 14:27:27 +10:00
parent ef62fb885d
commit f35001dacc
2 changed files with 4 additions and 2 deletions

View File

@@ -44,6 +44,9 @@ class VoucherAdjustmentsController < BaseController
return false
end
VoucherAdjustmentsService.new(@order).update
@order.update_totals_and_states
true
end

View File

@@ -771,7 +771,6 @@ describe "As a consumer, I want to checkout my order" do
fill_in "Enter voucher code", with: "some_code"
click_button("Apply")
pending
expect(page).to have_content "No payment required"
click_button "Next - Order summary"
# Expect to be on the Order Summary page
@@ -815,7 +814,7 @@ describe "As a consumer, I want to checkout my order" do
expect(page).to have_content("$15.00 Voucher")
expect(order.reload.voucher_adjustments.length).to eq(1)
pending
expect(page).to have_content "No payment required"
click_button "Next - Order summary"