Class: ActiveMerchant::Billing::Gateway
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::Gateway
- Includes:
- CreditCardFormatting, PostsData, RequiresParameters, Utils
- Defined in:
- lib/active_merchant/billing/gateway.rb
Overview
Description
The Gateway class is the base class for all ActiveMerchant gateway implementations.
The standard list of gateway functions that most concrete gateway subclasses implement is:
-
purchase(money, creditcard, options = {})
-
authorize(money, creditcard, options = {})
-
capture(money, authorization, options = {})
-
void(identification, options = {})
-
credit(money, identification, options = {})
Some gateways include features for recurring billing
-
recurring(money, creditcard, options = {})
Some gateways also support features for storing credit cards:
-
store(creditcard, options = {})
-
unstore(identification, options = {})
Gateway Options
The options hash consists of the following options:
-
:order_id
- The order number -
:ip
- The IP address of the customer making the purchase -
:customer
- The name, customer number, or other information that identifies the customer -
:invoice
- The invoice number -
:merchant
- The name or description of the merchant offering the product -
:description
- A description of the transaction -
:email
- The email address of the customer -
:currency
- The currency of the transaction. Only important when you are using a currency that is not the default with a gateway that supports multiple currencies. -
:billing_address
- A hash containing the billing address of the customer. -
:shipping_address
- A hash containing the shipping address of the customer.
The :billing_address
, and :shipping_address
hashes can have the following keys:
-
:name
- The full name of the customer. -
:company
- The company name of the customer. -
:address1
- The primary street address of the customer. -
:address2
- Additional line of address information. -
:city
- The city of the customer. -
:state
- The state of the customer. The 2 digit code for US and Canadian addresses. The full name of the state or province for foreign addresses. -
:country
- The [ISO 3166-1-alpha-2 code](www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm) for the customer. -
:zip
- The zip or postal code of the customer. -
:phone
- The phone number of the customer.
Implmenting new gateways
Direct Known Subclasses
AuthorizeNetCimGateway, AuthorizeNetGateway, BalancedGateway, BarclaysEpdqGateway, BeanstreamGateway, BeanstreamInteracGateway, BluePayGateway, BogusGateway, BraintreeBlueGateway, BraintreeGateway, CardStreamGateway, CertoDirectGateway, CyberSourceGateway, DataCashGateway, EfsnetGateway, EpayGateway, EwayGateway, EwayManagedGateway, ExactGateway, FatZebraGateway, FederatedCanadaGateway, FirstPayGateway, GarantiGateway, IdealBaseGateway, InspireGateway, InstapayGateway, IridiumGateway, ItransactGateway, JetpayGateway, LinkpointGateway, LitleGateway, MerchantESolutionsGateway, MerchantWareGateway, MetricsGlobalGateway, MigsGateway, ModernPaymentsCimGateway, ModernPaymentsGateway, MonerisGateway, MonerisUsGateway, NabTransactGateway, NetRegistryGateway, NetaxeptGateway, NetbillingGateway, OgoneGateway, OptimalPaymentGateway, OrbitalGateway, PayGateXmlGateway, PayJunctionGateway, PaySecureGateway, PayboxDirectGateway, PayflowExpressGateway, PayflowGateway, PaymentExpressGateway, PaypalExpressGateway, PaypalGateway, PaystationGateway, PaywayGateway, PlugnpayGateway, PsigateGateway, PslCardGateway, QbmsGateway, QuantumGateway, QuickpayGateway, RealexGateway, SageBankcardGateway, SageGateway, SagePayGateway, SageVirtualCheckGateway, SallieMaeGateway, SamuraiGateway, SecureNetGateway, SecurePayAuGateway, SecurePayTechGateway, SkipJackGateway, SmartPs, StripeGateway, TransFirstGateway, TrustCommerceGateway, UsaEpayAdvancedGateway, UsaEpayGateway, UsaEpayTransactionGateway, VerifiGateway, ViaklixGateway, VindiciaGateway, WirecardGateway, WorldpayGateway
Constant Summary collapse
- DEBIT_CARDS =
[ :switch, :solo ]
- CURRENCIES_WITHOUT_FRACTIONS =
[ 'JPY' ]
- CREDIT_DEPRECATION_MESSAGE =
"Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead."
- @@implementations =
[]
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .card_brand(source) ⇒ Object
- .inherited(subclass) ⇒ Object
-
.supports?(card_type) ⇒ Boolean
Use this method to check if your gateway of interest supports a credit card of some type.
Instance Method Summary collapse
- #card_brand(source) ⇒ Object
-
#initialize(options = {}) ⇒ Gateway
constructor
Initialize a new gateway.
-
#test? ⇒ Boolean
Are we running in test mode?.
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ Gateway
Initialize a new gateway.
See the documentation for the gateway you will be using to make sure there are no other required options.
127 128 |
# File 'lib/active_merchant/billing/gateway.rb', line 127 def initialize( = {}) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
107 108 109 |
# File 'lib/active_merchant/billing/gateway.rb', line 107 def @options end |
Class Method Details
.card_brand(source) ⇒ Object
114 115 116 117 |
# File 'lib/active_merchant/billing/gateway.rb', line 114 def self.card_brand(source) result = source.respond_to?(:brand) ? source.brand : source.type result.to_s.downcase end |
.inherited(subclass) ⇒ Object
71 72 73 74 |
# File 'lib/active_merchant/billing/gateway.rb', line 71 def self.inherited(subclass) super @@implementations << subclass end |
.supports?(card_type) ⇒ Boolean
Use this method to check if your gateway of interest supports a credit card of some type
110 111 112 |
# File 'lib/active_merchant/billing/gateway.rb', line 110 def self.supports?(card_type) supported_cardtypes.include?(card_type.to_sym) end |
Instance Method Details
#card_brand(source) ⇒ Object
119 120 121 |
# File 'lib/active_merchant/billing/gateway.rb', line 119 def card_brand(source) self.class.card_brand(source) end |
#test? ⇒ Boolean
Are we running in test mode?
131 132 133 |
# File 'lib/active_merchant/billing/gateway.rb', line 131 def test? Base.gateway_mode == :test end |