class Transbank::Onepay::Base
Constants
Attributes
Your Api key, given by Transbank
@return [String]
The URI for the app (eg the Android Intent that starts the app/the iOS equivalent) @param [String] @return [String]
Your callback URL, used to resume the payment process after validating with Transbank
when paying on Channel::MOBILE @param [String] @return [String]
The url of the commerce logo to be displayed in the Onepay
mobile app. @param [String] @return [String]
The default channel. Value must be in Channel.values
@return [String] One of the values from Channel.values
The current integration type @param [String, Symbol] @return [Symbol]
Contains all valid integration types @return [Hash<String, String>]
The width and height in pixels for the returned QR. @param [Integer] @return [Integer]
Public Class Methods
# File lib/transbank/sdk/onepay/base.rb, line 96 def api_key return ENV['ONEPAY_API_KEY'] if @api_key.nil? @api_key end
Returns the app_scheme
@return [String] the app scheme, either the one set on @app_scheme or, failing that, the value of ENV (your env variable)
# File lib/transbank/sdk/onepay/base.rb, line 91 def app_scheme return ENV['ONEPAY_APP_SCHEME'] unless @app_scheme @app_scheme end
@return [String] the app key used by the current integration type
# File lib/transbank/sdk/onepay/base.rb, line 74 def current_integration_type_app_key @app_keys[@integration_type] end
@return [String] the URL that is used by the current integration type
# File lib/transbank/sdk/onepay/base.rb, line 69 def current_integration_type_url @integration_types[@integration_type] end
Returns the 'ONEPAY_API_KEY' env variable, or, if ONEPAY_API_KEY doesn't exist, returns a default api key @return [String] ENV or DEFAULT_API_KEY
# File lib/transbank/sdk/onepay/base.rb, line 104 def default_api_key env_api_key = ENV['ONEPAY_API_KEY'] env_api_key.nil? ? DEFAULT_API_KEY : env_api_key end
Sets the current integration type @param type [String] Type of integration to be set. Must be included one of the keys of self.integration_types @raise [IntegrationTypeError] if the given type is not valid
# File lib/transbank/sdk/onepay/base.rb, line 82 def integration_type=(type) return @integration_type = type.to_sym unless @integration_types[type.to_sym].nil? valid_values = @integration_types.keys.join(', ') raise Transbank::Onepay::Errors::IntegrationTypeError, "Invalid integration type, valid values are #{valid_values}" end