Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # convenience file for testing ActiveMerchant objects in
- # IRB. See billing module and/or ActiveMerchant docs
- # for creating a gateway and commiting a charge.
- require 'rubygems'
- require 'active_support/all'
- require 'active_merchant'
- include ActiveMerchant::Billing
- ActiveMerchant::Billing::Base.mode = :test
- # add your keys here
- LOGIN = 'YOUR LOGIN HERE'
- PASSWORD = 'HOWS ABOUT A PASSWORD'
- TESTMODE = true
- def newcard
- # the credit card object. available testcards:
- # - American Express Test Card: 370000000000002
- # - Discover Test Card: 6011000000000012
- # - Visa Test Card: 4007000000027
- # - Second Visa Test Card: 4012888818888
- # - JCB: 3088000000000017
- # - Diners Club/ Carte Blanche: 38000000000006
- ActiveMerchant::Billing::CreditCard.new(
- :first_name => "Bob",
- :last_name => "Dobbs",
- :number => "4222222222222",
- :month => "12",
- :year => "2012",
- :verification_value => "123")
- end
- def newaddress
- # for billing_address or shipping_address
- {
- :first_name => "Bob",
- :last_name => "Dobbs",
- :address1 => "123 Slack St.",
- :city => "Subgeniusberg", :state => "CA",
- :country => 'US', :zip => "90210" }
- end
- def amt
- # set a price to charge (in cents)
- return 100
- end
- def newgateway
- ActiveMerchant::Billing::AuthorizeNetGateway.new(
- :login => LOGIN,
- :password => PASSWORD,
- :test => TESTMODE)
- end
Add Comment
Please, Sign In to add comment