Class: ActiveMerchant::Billing::Gateway
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::Gateway
- Includes:
- PostsData, RequiresParameters
- Defined in:
- lib/active_merchant/billing/gateway.rb
Overview
The Gateway class is the base class for all ActiveMerchant gateway implementations. The list of gateway functions that concrete gateway classes can and should implement include the following:
Core operations supported by most gateways
-
purchase(money, creditcard, options = {})
-
authorize(money, creditcard, options = {})
-
capture(money, authorization, options = {})
-
void(identification, options = {})
-
credit(money, identification, options = {})
Direct Known Subclasses
AuthorizeNetGateway, BogusGateway, EwayGateway, LinkpointGateway, MonerisGateway, PayflowExpressGateway, PayflowGateway, PaypalExpressGateway, PaypalGateway, PsigateGateway, TrustCommerceGateway, UsaEpayGateway
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.gateway(name) ⇒ Object
Return the matching gateway for the provider *
bogus
: BogusGateway - Does nothing ( for testing) *moneris
: MonerisGateway *authorize_net
: AuthorizeNetGateway *trust_commerce
: TrustCommerceGateway. -
.supported_cardtypes ⇒ Object
Get a list of supported credit card types for this gateway.
-
.supports?(type) ⇒ Boolean
Does this gateway support credit cards of the passed type?.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Gateway
constructor
Initialize a new gateway .
-
#test? ⇒ Boolean
Are we running in test mode?.
Methods included from RequiresParameters
Methods included from PostsData
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
53 54 55 |
# File 'lib/active_merchant/billing/gateway.rb', line 53 def initialize( = {}) @ssl_strict = [:ssl_strict] || false end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
48 49 50 |
# File 'lib/active_merchant/billing/gateway.rb', line 48 def @options end |
Class Method Details
.gateway(name) ⇒ Object
Return the matching gateway for the provider
-
bogus
: BogusGateway - Does nothing ( for testing) -
moneris
: MonerisGateway -
authorize_net
: AuthorizeNetGateway -
trust_commerce
: TrustCommerceGatewayActiveMerchant::Base.gateway(‘moneris’).new
34 35 36 |
# File 'lib/active_merchant/billing/gateway.rb', line 34 def self.gateway(name) ActiveMerchant::Billing.const_get("#{name.to_s.downcase}_gateway".camelize) end |
.supported_cardtypes ⇒ Object
Get a list of supported credit card types for this gateway
44 45 46 |
# File 'lib/active_merchant/billing/gateway.rb', line 44 def self.supported_cardtypes [] end |
.supports?(type) ⇒ Boolean
Does this gateway support credit cards of the passed type?
39 40 41 |
# File 'lib/active_merchant/billing/gateway.rb', line 39 def self.supports?(type) supported_cardtypes.include?(type.intern) end |
Instance Method Details
#test? ⇒ Boolean
Are we running in test mode?
58 59 60 |
# File 'lib/active_merchant/billing/gateway.rb', line 58 def test? Base.gateway_mode == :test end |