lib/active_merchant/billing/gateways/instapay.rb in activemerchant-1.28.0 vs lib/active_merchant/billing/gateways/instapay.rb in activemerchant-1.29.0
- old
+ new
@@ -13,17 +13,16 @@
# The homepage URL of the gateway
self.homepage_url = 'http://www.instapayllc.com'
# The name of the gateway
self.display_name = 'InstaPay'
-
+
SUCCESS = "Accepted"
SUCCESS_MESSAGE = "The transaction has been approved"
def initialize(options = {})
requires!(options, :login)
- @options = options
super
end
def authorize(money, creditcard, options = {})
post = {}
@@ -45,28 +44,28 @@
add_address(post, options)
add_customer_data(post, options)
commit('ns_quicksale_cc', post)
end
-
+
def capture(money, authorization, options = {})
post = {}
add_amount(post, money)
- add_reference(post, authorization)
+ add_reference(post, authorization)
commit('ns_quicksale_cc', post)
end
private
-
+
def add_amount(post, money)
post[:amount] = amount(money)
end
-
+
def add_reference(post, reference)
post[:postonly] = reference
end
-
+
def add_customer_data(post, options)
post[:ci_email] = options[:email]
post["ci_IP Address"] = options[:ip]
end
@@ -85,11 +84,11 @@
post[:ci_shipaddr1] = address[:address1]
post[:ci_shipaddr2] = address[:address2]
post[:ci_shipcity] = address[:city]
post[:ci_shipstate] = address[:state]
post[:ci_shipzip] = address[:zip]
- post[:ci_shipcountry] = address[:country]
+ post[:ci_shipcountry] = address[:country]
end
end
def add_invoice(post, options)
post[:merchantordernumber] = options[:order_id]
@@ -106,13 +105,13 @@
end
def parse(body)
results = {}
fields = body.split("\r\n")
-
- response = fields[1].split('=')
+
+ response = fields[1].split('=')
response_data = response[1].split(':')
-
+
if response[0] == SUCCESS
results[:success] = true
results[:message] = SUCCESS_MESSAGE
results[:transaction_type] = response_data[0]
results[:authorization_code] = response_data[1]