Created
October 11, 2012 13:01
-
-
Save chris-ramon/3872118 to your computer and use it in GitHub Desktop.
activemerchant-error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'active_merchant', '~> 1.3.1' | |
# Send requests to the gateway's test servers | |
ActiveMerchant::Billing::Base.mode = :test | |
Create a new credit card object | |
credit_card = ActiveMerchant::Billing::CreditCard.new( | |
:number => '4111111111111111', | |
:month => '8', | |
:year => '2009', | |
:first_name => 'Tobias', | |
:last_name => 'Luetke', | |
:verification_value => '123' | |
) | |
if credit_card.valid? | |
# Create a gateway object to the TrustCommerce service | |
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new( | |
:login => 'TestMerchant', | |
:password => 'password' | |
) | |
# Authorize for $10 dollars (1000 cents) | |
response = gateway.authorize(1000, credit_card) | |
if response.success? | |
# Capture the money | |
gateway.capture(1000, response.authorization) | |
else | |
raise StandardError, response.message | |
end | |
end | |
# Error : /Users/chris/Desktop/am.rb:5:in `<main>': uninitialized constant | |
# Object::ActiveMerchant (NameError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment