Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env ruby
- ##
- #
- require 'date'
- require 'rubygems'
- require 'faker'
- require 'active_merchant'
- ##
- #
- instructions = <<-__
- these instructions need to describe, to a user, how to setup the config
- below. they should walk the user through logging into whatever web
- console and jumping through whatever hoops the gateway makes you jump
- through to get a valid config...
- __
- ##
- #
- gateway_class = ActiveMerchant::Billing::InspireGateway
- config = { :login => 'XXX', :password => 'XXX' }
- #gateway_class = ActiveMerchant::Billing::AuthorizeNetGateway
- #config = { :login => 'XXX', :password => 'XXX' }
- #gateway_class = ActiveMerchant::Billing::SageGateway
- #config = { :login => 'XXX', :password => 'XXX' }
- gateway = gateway_class.new(config)
- p gateway
- puts
- ##
- #
- credit_card = ActiveMerchant::Billing::CreditCard.new(
- :type => 'visa',
- :number => '4111111111111111',
- :year => 2012,
- :month => 13,
- :first_name => 'Ara',
- :last_name => 'Howard',
- :verification_value => '123'
- )
- p credit_card
- p credit_card.valid?
- puts
- ##
- #
- amount = [1000, rand(10_000)].max
- response = gateway.authorize(amount, credit_card, options = {})
- p response
- puts
- puts(response.success? ? 'SUCCESS' : 'FAILURE')
Add Comment
Please, Sign In to add comment