mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-21 00:47:26 +00:00
Add error message if adding a voucher fails
It's not really useful to the user but better than failing silently
This commit is contained in:
committed by
Maikel Linke
parent
596c775af6
commit
3f609d3842
@@ -203,9 +203,12 @@ class SplitCheckoutController < ::BaseController
|
||||
return false
|
||||
end
|
||||
|
||||
# Create adjustment
|
||||
# TODO add tax part of adjustement
|
||||
voucher.create_adjustment(voucher.code, @order)
|
||||
adjustment = voucher.create_adjustment(voucher.code, @order)
|
||||
|
||||
if adjustment.nil?
|
||||
@order.errors.add(:voucher, I18n.t('split_checkout.errors.add_voucher_error'))
|
||||
return false
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user