lib/active_merchant/billing/gateways/plugnpay.rb in activemerchant-1.2.1 vs lib/active_merchant/billing/gateways/plugnpay.rb in activemerchant-1.3.0
- old
+ new
@@ -91,14 +91,10 @@
}
SUCCESS_CODES = [ 'pending', 'success' ]
FAILURE_CODES = [ 'badcard', 'fraud' ]
- # URL
- attr_reader :response
- attr_reader :options
-
self.default_currency = 'USD'
self.supported_countries = ['US']
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
self.homepage_url = 'http://www.plugnpay.com/'
self.display_name = "Plug'n Pay"
@@ -172,23 +168,19 @@
end
end
private
def commit(action, post)
- if result = test_result_from_cc_number(post[:card_number])
- return result
- end
-
- data = ssl_post(URL, post_data(action, post))
-
- @response = parse(data)
+ response = parse( ssl_post(URL, post_data(action, post)) )
- success = SUCCESS_CODES.include?(@response[:finalstatus])
- message = success ? 'Success' : message_from(@response)
+ success = SUCCESS_CODES.include?(response[:finalstatus])
+ message = success ? 'Success' : message_from(response)
- Response.new(success, message, @response,
+ Response.new(success, message, response,
:test => test?,
- :authorization => @response[:orderid]
+ :authorization => response[:orderid],
+ :avs_result => { :code => response[:avs_code] },
+ :cvv_result => response[:cvvresp]
)
end
def parse(body)
body = CGI.unescape(body)