I am attempting to implement the SecurePayGateway on a site, and
although I appear to be connecting to the gateway, I'm getting almost
nothing back to indicate why my transaction is failing.
My securepay account is in demo/test mode, and I have a test credit
card number from securepay. I changed the gateway URL to match the
documentation they gave me. I wrote a simple ruby script to run the
test from a command line.
I have activemerchant installed as a plugin, and it's been working
fine with
authorize.net
Here's my secure_pay.rb gateway class file:
-------------------------------------------------------------------
require File.dirname(__FILE__) + '/authorize_net'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class SecurePayGateway < AuthorizeNetGateway
#******** this is the only line I changed********
self.live_url = self.test_url = '
https://www.securepay.com/
secure15/index.cfm'
#***************************************************
# '
https://www.securepay.com/AuthSpayAdapter/process.aspx'
self.homepage_url = '
http://www.securepay.com/'
self.display_name = 'SecurePay'
# Limit support to purchase() for the time being
# JRuby chokes here
# undef_method :authorize, :capture, :void, :credit
undef_method :authorize
undef_method :capture
undef_method :void
undef_method :credit
def test?
Base.gateway_mode == :test
end
private
def split(response)
response.split('%')
end
end
end
end
-------------------------------------------------------------------------
here's my test script, securepaytest.rb:
-------------------------------------------------------------------------
RAILS_ENV = ARGV[0] || 'development'
require File.dirname(__FILE__) + '/../config/environment'
logger = RAILS_DEFAULT_LOGGER
# 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 => '6',
:year => '2010',
:first_name => 'Test',
:last_name => 'Person',
:verification_value => '123',
:type => 'visa'
)
if credit_card.valid?
# Create a gateway object to the SecurePayGateway service
gateway = ActiveMerchant::Billing::SecurePayGateway.new(
:login => 'mymerchid',
:password => 'mypassword'
)
# Authorize for $10 dollars (1000 cents)
puts "attempting transaction, url is: #{gateway.test_url}"
response = gateway.purchase(1000, credit_card)
puts response.to_yaml
end
-----------------------------------------------------------------------
here's the response object that I get back:
-----------------------------------------------------------------------
--- !ruby/object:ActiveMerchant::Billing::Response
authorization:
avs_result:
message:
code:
street_match:
postal_match:
cvv_result:
message:
code:
fraud_review: false
message: ""
params:
response_reason_code:
response_reason_text:
response_code: 0
transaction_id:
avs_result_code:
card_code:
success: false
test: true
-----------------------------------------------------------
If anyone has any ideas, suggestions, or knows what I'm doing wrong,
please let me know!
Thanks