Module: MerbMerchant::Billing::Base
- Defined in:
- lib/merb_merchant/billing/base.rb
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.
-
.gateway_mode ⇒ Object
Set MerbMerchant gateways in test mode.
- .gateway_mode=(gateway_mode) ⇒ Object
-
.integration(name) ⇒ Object
Return the matching integration module You can then get the notification from the module * bogus: Bogus - Does nothing (for testing) * chronopay: Chronopay - Does nothing (for testing) * paypal: Chronopay - Does nothing (for testing) chronopay = MerbMerchant::Billing::Base.integration('chronopay') notification = chronopay.notification(raw_post).
-
.integration_mode ⇒ Object
Set MerbMerchant gateways in test mode.
- .integration_mode=(integration_mode) ⇒ Object
-
.mode ⇒ Object
Set both the mode of both the gateways and integrations at once.
- .mode=(mode) ⇒ Object
-
.test? ⇒ Boolean
A check to see if we're in test mode.
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: TrustCommerceGateway
MerbMerchant::Billing::Base.gateway('moneris').new
47 48 49 |
# File 'lib/merb_merchant/billing/base.rb', line 47 def self.gateway(name) Billing.const_get(MerbMerchant::Inflector.camelize("#{name.to_s.downcase}_gateway")) end |
.gateway_mode ⇒ Object
Set MerbMerchant gateways in test mode.
MerbMerchant::Billing::Base.gateway_mode = :test
7 8 9 |
# File 'lib/merb_merchant/billing/base.rb', line 7 def self.gateway_mode @@gateway_mode end |
.gateway_mode=(gateway_mode) ⇒ Object
11 12 13 |
# File 'lib/merb_merchant/billing/base.rb', line 11 def self.gateway_mode=(gateway_mode) @@gateway_mode = gateway_mode end |
.integration(name) ⇒ Object
Return the matching integration module You can then get the notification from the module
-
bogus: Bogus - Does nothing (for testing)
-
chronopay: Chronopay - Does nothing (for testing)
-
paypal: Chronopay - Does nothing (for testing)
chronopay = MerbMerchant::Billing::Base.integration('chronopay') notification = chronopay.notification(raw_post)
61 62 63 |
# File 'lib/merb_merchant/billing/base.rb', line 61 def self.integration(name) Billing::Integrations.const_get(MerbMerchant::Inflector.camelize("#{name.to_s.downcase}")) end |
.integration_mode ⇒ Object
Set MerbMerchant gateways in test mode.
MerbMerchant::Billing::Base.gateway_mode = :test
18 19 20 |
# File 'lib/merb_merchant/billing/base.rb', line 18 def self.integration_mode @@integration_mode end |
.integration_mode=(integration_mode) ⇒ Object
22 23 24 |
# File 'lib/merb_merchant/billing/base.rb', line 22 def self.integration_mode=(integration_mode) @@integration_mode = integration_mode end |
.mode ⇒ Object
Set both the mode of both the gateways and integrations at once
28 29 30 |
# File 'lib/merb_merchant/billing/base.rb', line 28 def self.mode @@mode end |
.mode=(mode) ⇒ Object
32 33 34 35 36 |
# File 'lib/merb_merchant/billing/base.rb', line 32 def self.mode=(mode) @@mode = mode self.gateway_mode = mode self.integration_mode = mode end |
.test? ⇒ Boolean
A check to see if we're in test mode
66 67 68 |
# File 'lib/merb_merchant/billing/base.rb', line 66 def self.test? self.gateway_mode == :test end |