Class: MuckCommerce::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/muck-commerce/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/muck-commerce/config.rb', line 19

def initialize
  self.enable_orders = false
  self.enable_subscriptions = true
  self.enable_coupons = false
  self.credit_card_types = []
  self.commerce_run_production_as_test = false
  self.enable_paypal_express = false
  self.gateway = 'authorize_net'
  self.cim_gateway = 'authorize_net_cim'
  self.payment_methods = [[ "Credit card", "CC" ], [ "ACH/E-Check", "ACH" ]]
  self.credit_card_types = [[ "Visa", "visa" ], [ "MasterCard", "master" ], [ "Discover", "discover" ], [ "American Express", "american_express" ]]
  self.achholder_types = [[ "Business", "Business" ], [ "Personal", "Personal" ]]
  self.achtypes = [[ "Checking", "Checking" ], [ "Savings", "Savings" ]]
  self.require_cvv_value = true
end

Instance Attribute Details

#achholder_typesObject

Returns the value of attribute achholder_types.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def achholder_types
  @achholder_types
end

#achtypesObject

Returns the value of attribute achtypes.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def achtypes
  @achtypes
end

#cim_gatewayObject

Returns the value of attribute cim_gateway.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def cim_gateway
  @cim_gateway
end

#commerce_run_production_as_testObject

Returns the value of attribute commerce_run_production_as_test.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def commerce_run_production_as_test
  @commerce_run_production_as_test
end

#credit_card_typesObject

Returns the value of attribute credit_card_types.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def credit_card_types
  @credit_card_types
end

#enable_couponsObject

Returns the value of attribute enable_coupons.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def enable_coupons
  @enable_coupons
end

#enable_ordersObject

Returns the value of attribute enable_orders.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def enable_orders
  @enable_orders
end

#enable_paypal_expressObject

Returns the value of attribute enable_paypal_express.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def enable_paypal_express
  @enable_paypal_express
end

#enable_subscriptionsObject

Returns the value of attribute enable_subscriptions.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def enable_subscriptions
  @enable_subscriptions
end

#gateway(enable_live_test_gateway = false, gateway = nil, cim_gateway = nil, login = nil, password = nil, signature = nil, production_test = false) ⇒ Object

Configures the gateway for payment transactions.

Notes: For most uses the default options are fine and the gateway can be configured by simply calling: MuckCommerce.configuration.gateway as shown below.

Parameters:

enable_live_test_gateway:  Normally tests are run against the local bogus gateway.  However, tests 
                           can use the live test gateway by setting this value to true.  The tests
                           found in test/remote make use of this option.
gateway:                   Override the gateway.
cim_gateway:               Override the cim_gateway 
login:                     Override the login.
password:                  Override the password.
signature:                 Override the signature.
production_test:           If set to true then the system will use the test gateway even in production.  
                           Useful if you want to test the production site before going live


66
67
68
# File 'lib/muck-commerce/config.rb', line 66

def gateway
  @gateway
end

#gateway_loginObject

Returns the value of attribute gateway_login.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def 
  @gateway_login
end

#gateway_passwordObject

Returns the value of attribute gateway_password.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def gateway_password
  @gateway_password
end

#gateway_signatureObject

Returns the value of attribute gateway_signature.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def gateway_signature
  @gateway_signature
end

#payment_methodsObject

Returns the value of attribute payment_methods.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def payment_methods
  @payment_methods
end

#paypal_loginObject

Returns the value of attribute paypal_login.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def 
  @paypal_login
end

#paypal_passwordObject

Returns the value of attribute paypal_password.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def paypal_password
  @paypal_password
end

#paypal_signatureObject

Returns the value of attribute paypal_signature.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def paypal_signature
  @paypal_signature
end

#require_cvv_valueObject

Returns the value of attribute require_cvv_value.



14
15
16
# File 'lib/muck-commerce/config.rb', line 14

def require_cvv_value
  @require_cvv_value
end

Instance Method Details

#cim_enabled?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/muck-commerce/config.rb', line 44

def cim_enabled?
  @cim_enabled
end

#disable_live_test_gatewayObject



40
41
42
# File 'lib/muck-commerce/config.rb', line 40

def disable_live_test_gateway
  gateway
end

#enable_live_test_gateway(gateway = nil, cim_gateway = nil, login = nil, password = nil, signature = nil) ⇒ Object



35
36
37
38
# File 'lib/muck-commerce/config.rb', line 35

def enable_live_test_gateway(gateway = nil, cim_gateway = nil,  = nil, password = nil, signature = nil)
  gateway(true, gateway, cim_gateway, , password, signature)
  self.credit_card_types = [[ "Visa", "visa" ], [ "MasterCard", "master" ], [ "Discover", "discover" ], [ "American Express", "american_express" ]]
end