lib/active_merchant/billing/gateways/sage.rb in jelaniharris-activemerchant-1.24.1 vs lib/active_merchant/billing/gateways/sage.rb in jelaniharris-activemerchant-1.29.1
- old
+ new
@@ -5,27 +5,28 @@
module Billing #:nodoc:
class SageGateway < Gateway
self.supported_countries = SageBankcardGateway.supported_countries
self.supported_cardtypes = SageBankcardGateway.supported_cardtypes
+ self.abstract_class = true
+
# Creates a new SageGateway
- #
+ #
# The gateway requires that a valid login and password be passed
# in the +options+ hash.
- #
+ #
# ==== Options
#
# * <tt>:login</tt> - The Sage Payment Solutions Merchant ID Number.
# * <tt>:password</tt> - The Sage Payment Solutions Merchant Key Number.
def initialize(options = {})
requires!(options, :login, :password)
- @options = options
super
end
-
+
# Performs an authorization transaction
- #
+ #
# ==== Parameters
# * <tt>money</tt> - The amount to be authorized as an integer value in cents.
# * <tt>credit_card</tt> - The CreditCard object to be used as the funding source for the transaction.
# * <tt>options</tt> - A hash of optional parameters.
# * <tt>:order_id</tt> - A unique reference for this order. (maximum of 20 characters).
@@ -38,24 +39,24 @@
# * <tt>:country</tt> - The 2 digit ISO billing address country code
# * <tt>:zip</tt> - The billing address zip code
# * <tt>:phone</tt> - The billing address phone number
# * <tt>:fax</tt> - The billing address fax number
# * <tt>:shipping_address</tt> - The customer's shipping address as a hash of address information.
- # * <tt>:name</tt> - The name at the shipping address
+ # * <tt>:name</tt> - The name at the shipping address
# * <tt>:address1</tt> - The shipping address street
# * <tt>:city</tt> - The shipping address city
# * <tt>:state</tt> - The shipping address state code
# * <tt>:country</tt> - The 2 digit ISO shipping address country code
# * <tt>:zip</tt> - The shipping address zip code
# * <tt>:tax</tt> - The tax amount for the transaction as an Integer value in cents. Maps to Sage <tt>T_tax</tt>.
- # * <tt>:shipping</tt> - The shipping amount for the transaction as an Integer value in cents. Maps to Sage <tt>T_shipping</tt>.
+ # * <tt>:shipping</tt> - The shipping amount for the transaction as an Integer value in cents. Maps to Sage <tt>T_shipping</tt>.
def authorize(money, credit_card, options = {})
bankcard.authorize(money, credit_card, options)
end
-
+
# Performs a purchase, which is essentially an authorization and capture in a single operation.
- #
+ #
# ==== Parameters
#
# * <tt>money</tt> - The amount to be authorized as an integer value in cents.
# * <tt>source</tt> - The CreditCard or Check object to be used as the funding source for the transaction.
# * <tt>options</tt> - A hash of optional parameters.
@@ -69,11 +70,11 @@
# * <tt>:country</tt> - The 2 digit ISO billing address country code
# * <tt>:zip</tt> - The billing address zip code
# * <tt>:phone</tt> - The billing address phone number
# * <tt>:fax</tt> - The billing address fax number
# * <tt>:shipping_address</tt> - The customer's shipping address as a hash of address information.
- # * <tt>:name</tt> - The name at the shipping address
+ # * <tt>:name</tt> - The name at the shipping address
# * <tt>:address1</tt> - The shipping address street
# * <tt>:city</tt> - The shipping address city
# * <tt>:state</tt> - The shipping address state code
# * <tt>:country</tt> - The 2 digit ISO shipping address country code
# * <tt>:zip</tt> - The shipping address zip code
@@ -91,22 +92,22 @@
if card_brand(source) == "check"
virtual_check.purchase(money, source, options)
else
bankcard.purchase(money, source, options)
end
- end
-
+ end
+
# Captures authorized funds.
#
# ==== Parameters
#
# * <tt>money</tt> - The amount to be authorized as an integer value in cents. Sage doesn't support changing the capture amount, so the full amount of the initial transaction will be captured.
# * <tt>reference</tt> - The authorization reference string returned by the original transaction's Response#authorization.
def capture(money, reference, options = {})
bankcard.capture(money, reference, options)
end
-
+
# Voids a prior transaction. Works for both CreditCard and Check transactions.
#
# ==== Parameters
#
# * <tt>reference</tt> - The authorization reference string returned by the original transaction's Response#authorization.
@@ -129,18 +130,18 @@
virtual_check.credit(money, source, options)
else
bankcard.credit(money, source, options)
end
end
-
+
private
def bankcard
@bankcard ||= SageBankcardGateway.new(@options)
end
-
+
def virtual_check
@virtual_check ||= SageVirtualCheckGateway.new(@options)
- end
+ end
end
end
end