lib/active_merchant/billing/gateways/usa_epay.rb in activemerchant-1.0.3 vs lib/active_merchant/billing/gateways/usa_epay.rb in activemerchant-1.1.0

- old
+ new

@@ -1,10 +1,11 @@ module ActiveMerchant #:nodoc: module Billing #:nodoc: class UsaEpayGateway < Gateway GATEWAY_URL = 'https://www.usaepay.com/gate.php' + POST_HEADERS = { 'Content-Type' => 'application/x-www-form-urlencoded' } attr_reader :url attr_reader :response attr_reader :options @@ -44,14 +45,14 @@ end private def expdate(creditcard) - year = sprintf("%.4i", creditcard.year) - month = sprintf("%.2i", creditcard.month) + year = format(creditcard.year, :two_digits) + month = format(creditcard.month, :two_digits) - "#{year[-2..-1]}#{month}" + "#{month}#{year}" end def add_customer_data(post, options) address = options[:billing_address] || options[:address] || {} post[:street] = address[:address1] @@ -149,12 +150,10 @@ if result = test_result_from_cc_number(parameters[:card]) return result end - data = ssl_post GATEWAY_URL, - post_data(action, parameters), - { 'Content-Type' => 'application/x-www-form-urlencoded' } + data = ssl_post(GATEWAY_URL, post_data(action, parameters), POST_HEADERS) @response = parse(data) success = @response[:status] == 'Approved' message = message_from(@response)