RailsCasts Pro episodes are now free!

Learn more or hide this

Arun.S's Profile

GitHub User: railsfactory-aruns

Comments by Arun.S

Avatar

I got following Error:
Error: A field was longer or shorter than the server allows.

Here my code:

require 'rubygems'
require 'active_merchant'
ActiveMerchant::Billing::Base.mode = :test
credit_card = ActiveMerchant::Billing::CreditCard.new(
:number => '4111286234782053',
:month => '6',
:year => '2018',
:first_name => 'xxxx',
:last_name => 'xxxxxxx',
:verification_value => '123'
)

gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
:login => "xxxxxxxxxxxxxx.xxxxxxx.com",
:password => "xxxxxxxxxx",
:signature => "xxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxx"
)

response = gateway.purchase(1000, credit_card, :ip => "127.0.0.1", :billing_address => {
:name => "Test Guy",
:address1 => "123 W 423 E",
:city => "Somewhere",
:state => "CA",
:country => "US",
:zip => "88888"
}