module Workarea::Sezzle

Constants

VERSION

Public Class Methods

api_configured?() click to toggle source
# File lib/workarea/sezzle.rb, line 33
def self.api_configured?
  api_public_key.present? && api_private_key.present?
end
api_private_key() click to toggle source
# File lib/workarea/sezzle.rb, line 29
def self.api_private_key
  Workarea.config.sezzle_private_key || credentials[:api_private_key]
end
api_public_key() click to toggle source
# File lib/workarea/sezzle.rb, line 25
def self.api_public_key
  Workarea.config.sezzle_public_key || credentials[:api_public_key]
end
config() click to toggle source
# File lib/workarea/sezzle.rb, line 15
def self.config
  Workarea.config.sezzle
end
credentials() click to toggle source

used for <= 3.5, these creds come from secrets isntead of encrypted in the 3.5 configurations system.

# File lib/workarea/sezzle.rb, line 21
def self.credentials
  (Rails.application.secrets.sezzle || {}).deep_symbolize_keys
end
gateway() click to toggle source
# File lib/workarea/sezzle.rb, line 41
def self.gateway
  if Rails.env.test?
    Sezzle::BogusGateway.new
  else
    Sezzle::Gateway.new(
      api_public_key: api_public_key,
      api_private_key: api_private_key,
      test: test?
    )
  end
end
test?() click to toggle source
# File lib/workarea/sezzle.rb, line 37
def self.test?
  Workarea.config.sezzle_test_mode || credentials[:test]
end