public
Description: Tools for processing credit cards on the command line
Homepage: http://scie.nti.st
Clone URL: git://github.com/up_the_irons/credit_card_tools.git
Click here to lend your support to: credit_card_tools and make a donation at www.pledgie.com !
credit_card_tools / gateway.rb
100644 20 lines (15 sloc) 0.709 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
config = YAML.load(File.read(File.join(File.dirname(__FILE__), 'gateway.yml')))
 
mode = config['live']['enabled'] ? 'live' : 'test'
 
$API_LOGIN = config[mode]['api_login']
$API_PASSWORD = config[mode]['api_password']
$API_KEY_FILENAME = config[mode]['api_key_filename']
 
if mode == 'test'
  ActiveMerchant::Billing::Base.mode = :test
  ActiveMerchant::Billing::CreditCard.require_verification_value = false
end
 
@gateway = ActiveMerchant::Billing::PaypalGateway.new(
  { :login => $API_LOGIN,
    :password => $API_PASSWORD }.merge(
  mode == 'live' ?
  { :pem => File.read(File.join(File.dirname(__FILE__), $API_KEY_FILENAME)) } :
  { :signature => config['test']['api_signature'] }))