0
Im与ActiveMerchant
发生奇怪的问题。 我使用activemerchant
验证信用卡号码并且工作正常。但是,我发现它似乎没有验证此卡号码3088023605344101
,当我输入类型为JCB
的卡号时,也会出现大多数验证问题。这里是我的代码看起来像ActiveMerchant说有效卡片的信用卡无效
cc = CreditCard.new(
:first_name => client_details[:firstname],
:last_name => client_details[:lastname],
:month => client_details[:month],
:year => client_details[:year],
:number => client_details[:cardnum],
:verification_value => client_details[:cvv]
)
这是我的控制台正确验证卡的一个例子。
2.1.1 :052 > cc = CreditCard.new(:first_name => 'Steve',:last_name => 'Smith', :month => '9',:year => '2015',:number => '5201457519355638', :verification_value => '123')
=> #<ActiveMerchant::Billing::CreditCard:0x00000109d3acc0 @first_name="Steve", @last_name="Smith", @month="9", @year="2015", @number="5201457519355638", @verification_value="123">
2.1.1 :053 > cc.valid?
=> true
2.1.1 :054 > cc.brand
=> "master"
虽然这似乎工作正常,这是一个引发品牌错误的例子。起初,我不会喂这个品牌,而是让它去找活跃的商家去寻找它。
2.1.1 :056 > cc = CreditCard.new(:first_name => 'Steve',:last_name => 'Smith', :month => '9',:year => '2015',:number => '3088023605344101', :verification_value => '123')
=> #<ActiveMerchant::Billing::CreditCard:0x0000010a0d91d8 @first_name="Steve", @last_name="Smith", @month="9", @year="2015", @number="3088023605344101", @verification_value="123">
2.1.1 :057 > cc.valid?
=> false
2.1.1 :058 > cc.errors
=> {"brand"=>["is required"], "number"=>[]}
所以我喂品牌
2.1.1 :059 > cc = CreditCard.new(:first_name => 'Steve',:last_name => 'Smith', :month => '9',:year => '2015',:number => '3088023605344101', :verification_value => '123', :brand => 'jcb')
=> #<ActiveMerchant::Billing::CreditCard:0x00000109d886c8 @first_name="Steve", @last_name="Smith", @month="9", @year="2015", @number="3088023605344101", @verification_value="123", @brand="jcb">
2.1.1 :060 > cc.valid?
=> false
2.1.1 :061 > cc.errors
=> {"number"=>[], "brand"=>["does not match the card number"]}
我已经验证了从不同的网站上的卡号,他们似乎只是罚款。我验证卡的网站是freeformatter和igo
我不知道问题是什么,但如果有人知道为什么会发生这种情况,请告诉我。