Skip to content

Commit

Permalink
use the sandbox for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
igkins committed Dec 23, 2010
1 parent 7ec6318 commit 2d40d0e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/active_merchant/billing/gateways/usa_epay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ module ActiveMerchant #:nodoc:
module Billing #:nodoc:

class UsaEpayGateway < Gateway
URL = 'https://www.usaepay.com/gate.php'
class_inheritable_accessor :test_url, :live_url

self.live_url = 'https://www.usaepay.com/gate.php'
self.test_url = 'https://sandbox.usaepay.com/gate.php'

self.supported_cardtypes = [:visa, :master, :american_express]
self.supported_countries = ['US']
Expand Down Expand Up @@ -157,10 +160,11 @@ def parse(body)


def commit(action, parameters)
response = parse( ssl_post(URL, post_data(action, parameters)) )
url = @options[:test] || test? ? self.test_url : self.live_url
response = parse( ssl_post(url, post_data(action, parameters)) )

Response.new(response[:status] == 'Approved', message_from(response), response,
:test => @options[:test] || test?,
:test => false,
:authorization => response[:ref_num],
:cvv_result => response[:cvv2_result_code],
:avs_result => {
Expand All @@ -184,7 +188,7 @@ def post_data(action, parameters = {})
parameters[:command] = TRANSACTIONS[action]
parameters[:key] = @options[:login]
parameters[:software] = 'Active Merchant'
parameters[:testmode] = @options[:test] ? 1 : 0
parameters[:testmode] = 0

parameters.collect { |key, value| "UM#{key}=#{CGI.escape(value.to_s)}" }.join("&")
end
Expand Down

0 comments on commit 2d40d0e

Please sign in to comment.