1

每当用户在结帐期间输入空字符串时,都会闪烁以下错误消息:

Credit card number is required. (81714)

我不想向用户展示,而是想展示:

Credit card number is needed to process your order.

我相信代码在这里:https ://github.com/braintree/braintree_ruby/blob/master/lib/braintree/error_codes.rb

简化代码:

module Braintree
  module ErrorCodes
    module CreditCard
      NumberIsRequired = "81714"
     end
  end
end

尝试使用以下装饰器但未成功

Braintree::ErrorCodes::CreditCard.class_eval do
  NumberIsRequired = "We need a credit card to process your order"
end

这是实现这一目标的正确方法吗?Braintree 是否将错误存储在其他地方?

我在 Rails 3 和 Spree 1.3

预先感谢您的帮助!

4

0 回答 0