我正在嘗試註冊測試信用卡,以便測試我的應用程序。我正在使用ActiveMerchant
。我有一個用戶輸入數據的註冊表格,然後我收集這些參數,並將其轉移到付款中,但我只得到一個零響應。Activemerchant無法註冊假卡
我有這樣的代碼:
user.rb
def store_credit_card(payment_attributes)
pay = Payment.new(payment_attributes) # this return always nil. Why?
pay.build_contact_info
pay.contact_info.name = name
pay.contact_info.email = email
pay.contact_info.phone = phone
pay.first_name = first_name
pay.last_name = last_name
pay.construct_billing_address(self)
pay.escrow_amount = (0.01).to_money
pay.authorize!
end
我參數傳輸到store_credit_card
,他們看起來是這樣的:
payment_attributes
{"card_type"=>"bogus", "card_number"=>"1", "card_expires_month"=>"12", "card_expires_year"=>"2015", "security_code"=>"123"}
但是當我打電話:
pay = Payment.new(payment_attributes)
pay
總是返回nil
。
我應該怎麼做才能使用ActiveMerchant註冊一張假卡?爲什麼它返回零? 我正在開發當地的開發環境。我正在使用Ubuntu。