Merge pull request #13349 from mkllnk/vine-error-message

Clarify voucher code not found can mean fully redeemed
This commit is contained in:
Filipe
2025-06-06 12:46:11 +01:00
committed by GitHub
4 changed files with 8 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ class VoucherAdjustmentsController < BaseController
def create
if voucher_params[:voucher_code].blank?
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_not_found'))
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_code_blank'))
return render_error
end
@@ -43,7 +43,7 @@ class VoucherAdjustmentsController < BaseController
return false if @order.errors.present?
if voucher.nil?
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_not_found'))
@order.errors.add(:voucher_code, I18n.t('checkout.errors.voucher_code_not_found'))
return false
end

View File

@@ -2172,7 +2172,8 @@ en:
select_a_shipping_method: Select a shipping method
select_a_payment_method: Select a payment method
no_shipping_methods_available: Checkout is not possible due to absence of shipping options. Please contact the shop owner.
voucher_not_found: Not found
voucher_code_blank: Please enter a valid voucher code
voucher_code_not_found: invalid. It either doesn't exist or has been redeemed fully
add_voucher_error: There was an error while adding the voucher
create_voucher_error: "There was an error while creating the voucher: %{error}"
voucher_redeeming_error: There was an error while trying to redeem your voucher

View File

@@ -47,7 +47,7 @@ RSpec.describe VoucherAdjustmentsController do
post("/voucher_adjustments", params:)
expect(response).to be_unprocessable
expect(flash[:error]).to match "Voucher code Not found"
expect(flash[:error]).to match "Voucher code invalid."
end
end
@@ -123,7 +123,7 @@ RSpec.describe VoucherAdjustmentsController do
post("/voucher_adjustments", params:)
expect(response).to be_unprocessable
expect(flash[:error]).to match "Voucher code Not found"
expect(flash[:error]).to match "Voucher code invalid."
end
end
@@ -149,7 +149,7 @@ RSpec.describe VoucherAdjustmentsController do
post("/voucher_adjustments", params:)
expect(response).to be_unprocessable
expect(flash[:error]).to match "Voucher code Not found"
expect(flash[:error]).to match "Voucher code invalid"
end
end

View File

@@ -169,7 +169,7 @@ RSpec.describe "As a consumer, I want to checkout my order" do
fill_in "Enter voucher code", with: "non_code"
click_button("Apply")
expect(page).to have_content("Voucher code Not found")
expect(page).to have_content("Voucher code invalid")
end
end