mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
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:
@@ -44,6 +44,9 @@ class VoucherAdjustmentsController < BaseController
|
||||
return false
|
||||
end
|
||||
|
||||
VoucherAdjustmentsService.new(@order).update
|
||||
@order.update_totals_and_states
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user