我正在尝试在https://github.com/activemerchant/active_merchant/blob/master/lib/active_merchant/billing/credit_card.rb的第 315 行覆盖“requires_name”方法或其变量,以便检查第 328 行不执行。在澳大利亚,通常不会在付款过程中收集卡名,所以我试图输入 nils。我没有得到任何工作。
我试过 class_variable_set 像:
ActiveMerchant::Billing::CreditCard.class_variable_set(:@@requires_name, Proc.new do
false
end)
我在这里试过 requires_name 和 require_name 。没有不同。
我试过了:
ActiveMerchant::Billing::CreditCard.requires_name = Proc.new do
false
end)
我已经尝试过其他各种事情。我如何覆盖它?