module Workarea::Afterpay
Constants
- RETRY_ERROR_STATUSES
- VERSION
Public Class Methods
config()
click to toggle source
# File lib/workarea/afterpay.rb, line 23 def self.config Workarea.config.afterpay end
credentials()
click to toggle source
# File lib/workarea/afterpay.rb, line 19 def self.credentials (Rails.application.secrets.afterpay || {}).deep_symbolize_keys end
gateway(location, options = {})
click to toggle source
Conditionally use the real gateway when secrets are present. Otherwise, use the bogus gateway.
@return [Afterpay::Gateway]
# File lib/workarea/afterpay.rb, line 52 def self.gateway(location, options = {}) if credentials.present? options.merge!(location: location, test: test?) Afterpay::Gateway.new(merchant_id(location), secret_key(location), options) else Afterpay::BogusGateway.new end end
merchant_id(location)
click to toggle source
# File lib/workarea/afterpay.rb, line 27 def self.merchant_id(location) return unless credentials.present? country = location.to_sym.downcase return unless credentials[country].present? credentials[country][:merchant_id] end
secret_key(location)
click to toggle source
# File lib/workarea/afterpay.rb, line 37 def self.secret_key(location) return unless credentials.present? country = location.to_sym.downcase credentials[country][:secret_key] end
test?()
click to toggle source
# File lib/workarea/afterpay.rb, line 44 def self.test? config[:test] end