Class: Transbank::Webpay::WebpayPlus::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/transbank/sdk/webpay/webpay_plus/base.rb

Constant Summary collapse

DEFAULT_API_KEY =
'579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C'.freeze
DEFAULT_COMMERCE_CODE =
'597055555532'.freeze
DEFAULT_DEFERRED_COMMERCE_CODE =
'597055555540'.freeze
DEFAULT_MALL_COMMERCE_CODE =
'597055555535'.freeze
DEFAULT_MALL_CHILD_COMMERCE_CODES =
['597055555536'.freeze,'597055555537'.freeze].freeze
DEFAULT_MALL_DEFERRED_COMMERCE_CODE =
'597055555544 '.freeze
DEFAULT_MALL_DEFERRED_CHILD_COMMERCE_CODES =
['597055555545'.freeze,
'597055555546'.freeze].freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



26
27
28
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 26

def api_key
  @api_key
end

.commerce_codeObject

Returns the value of attribute commerce_code.



26
27
28
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 26

def commerce_code
  @commerce_code
end

.integration_typeObject

Returns the value of attribute integration_type.



26
27
28
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 26

def integration_type
  @integration_type
end

.integration_typesObject (readonly)

Returns the value of attribute integration_types.



25
26
27
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 25

def integration_types
  @integration_types
end

Class Method Details

.configure_deferred_for_testingObject



59
60
61
62
63
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 59

def configure_deferred_for_testing
  @api_key = DEFAULT_API_KEY
  @commerce_code = DEFAULT_DEFERRED_COMMERCE_CODE
  self.integration_type = :TEST
end

.configure_for_testingObject



47
48
49
50
51
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 47

def configure_for_testing
  @api_key = DEFAULT_API_KEY
  @commerce_code = DEFAULT_COMMERCE_CODE
  self.integration_type = :TEST
end

.configure_mall_deferred_for_testingObject



65
66
67
68
69
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 65

def configure_mall_deferred_for_testing
  @api_key = DEFAULT_API_KEY
  @commerce_code = DEFAULT_MALL_DEFERRED_COMMERCE_CODE
  self.integration_type = :TEST
end

.configure_mall_for_testingObject



53
54
55
56
57
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 53

def configure_mall_for_testing
  @api_key = DEFAULT_API_KEY
  @commerce_code = DEFAULT_MALL_COMMERCE_CODE
  self.integration_type = :TEST
end

.current_integration_type_urlObject



36
37
38
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 36

def current_integration_type_url
  @integration_types[@integration_type]
end

.integration_type_url(integration_type) ⇒ Object



29
30
31
32
33
34
# File 'lib/transbank/sdk/webpay/webpay_plus/base.rb', line 29

def integration_type_url(integration_type)
  type = integration_type.upcase.to_sym
  return @integration_types[type] unless @integration_types[type].nil?
  valid_values = @integration_types.keys.join(', ')
  raise Transbank::Webpay::Errors::IntegrationTypeError, "Invalid integration type, valid values are #{valid_values}"
end