lib/active_merchant/billing/gateways/cashnet.rb in activemerchant-1.76.0 vs lib/active_merchant/billing/gateways/cashnet.rb in activemerchant-1.77.0
- old
+ new
@@ -1,11 +1,12 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class CashnetGateway < Gateway
include Empty
- self.live_url = "https://commerce.cashnet.com/"
+ self.live_url = "https://commerce.cashnet.com/"
+ self.test_url = "https://train.cashnet.com/"
self.supported_countries = ["US"]
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
self.homepage_url = "http://www.higherone.com/"
self.display_name = "Cashnet"
@@ -52,14 +53,25 @@
add_invoice(post, options)
add_customer_data(post, options)
commit('REFUND', money, post)
end
+ def supports_scrubbing?
+ true
+ end
+
+ def scrub(transcript)
+ transcript
+ .gsub(%r{(password=)[^&]+}, '\1[FILTERED]')
+ .gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]')
+ .gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
+ end
+
private
def commit(action, money, fields)
fields[:amount] = amount(money)
- url = live_url + CGI.escape(@options[:merchant_gateway_name])
+ url = (test? ? test_url : live_url) + CGI.escape(@options[:merchant_gateway_name])
raw_response = ssl_post(url, post_data(action, fields))
parsed_response = parse(raw_response)
return unparsable_response(raw_response) unless parsed_response