diff --git a/app/controllers/spree/credit_cards_controller.rb b/app/controllers/spree/credit_cards_controller.rb index 90f754a3fe..2fb4d51a05 100644 --- a/app/controllers/spree/credit_cards_controller.rb +++ b/app/controllers/spree/credit_cards_controller.rb @@ -22,8 +22,10 @@ module Spree def destroy if @credit_card.destroy flash[:success] = I18n.t(:card_has_been_removed, number: "x-#{@credit_card.last_digits}") - redirect_to "/account#/cards" + else + flash[:error] = I18n.t(:card_could_not_be_removed) end + redirect_to "/account#/cards" end # Currently can only destroy the whole customer object diff --git a/config/locales/en.yml b/config/locales/en.yml index bb1d1bbd80..31b75dac6b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -903,6 +903,7 @@ en: you_have_no_saved_cards: You haven't saved any cards yet saving_credit_card: Saving credit card... card_has_been_removed: "Your card has been removed (number: %{number})" + card_could_not_be_removed: Sorry, the card could not be removed ie_warning_headline: "Your browser is out of date :-(" ie_warning_text: "For the best Open Food Network experience, we strongly recommend upgrading your browser:"