Guest User

Untitled

a guest
Jul 17th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. # convenience file for testing ActiveMerchant objects in
  2. # IRB. See billing module and/or ActiveMerchant docs
  3. # for creating a gateway and commiting a charge.
  4.  
  5. require 'rubygems'
  6. require 'active_support/all'
  7. require 'active_merchant'
  8. include ActiveMerchant::Billing
  9. ActiveMerchant::Billing::Base.mode = :test
  10.  
  11. # add your keys here
  12. LOGIN = 'YOUR LOGIN HERE'
  13. PASSWORD = 'HOWS ABOUT A PASSWORD'
  14. TESTMODE = true
  15.  
  16. def newcard
  17. # the credit card object. available testcards:
  18. # - American Express Test Card: 370000000000002
  19. # - Discover Test Card: 6011000000000012
  20. # - Visa Test Card: 4007000000027
  21. # - Second Visa Test Card: 4012888818888
  22. # - JCB: 3088000000000017
  23. # - Diners Club/ Carte Blanche: 38000000000006
  24. ActiveMerchant::Billing::CreditCard.new(
  25. :first_name => "Bob",
  26. :last_name => "Dobbs",
  27. :number => "4222222222222",
  28. :month => "12",
  29. :year => "2012",
  30. :verification_value => "123")
  31. end
  32.  
  33. def newaddress
  34. # for billing_address or shipping_address
  35. {
  36. :first_name => "Bob",
  37. :last_name => "Dobbs",
  38. :address1 => "123 Slack St.",
  39. :city => "Subgeniusberg", :state => "CA",
  40. :country => 'US', :zip => "90210" }
  41. end
  42.  
  43. def amt
  44. # set a price to charge (in cents)
  45. return 100
  46. end
  47.  
  48. def newgateway
  49. ActiveMerchant::Billing::AuthorizeNetGateway.new(
  50. :login => LOGIN,
  51. :password => PASSWORD,
  52. :test => TESTMODE)
  53. end
Add Comment
Please, Sign In to add comment