module Workarea::Affirm

Constants

VERSION

Public Class Methods

api_configured?() click to toggle source
# File lib/workarea/affirm.rb, line 19
def self.api_configured?
  public_key.present? && private_key.present?
end
enabled?() click to toggle source
# File lib/workarea/affirm.rb, line 23
def self.enabled?
  Workarea.config.affirm_enabled && api_configured?
end
gateway(_options = {}) click to toggle source
# File lib/workarea/affirm.rb, line 39
def self.gateway(_options = {})
  if Rails.env.test?
    Affirm::BogusGateway.new
  else
    Affirm::Gateway.new(
      test: test?,
      public_key: public_key,
      private_key: private_key
    )
  end
end
js_sdk_url() click to toggle source
# File lib/workarea/affirm.rb, line 27
def self.js_sdk_url
  if test?
    "https://cdn1-sandbox.affirm.com/js/v2/affirm.js"
  else
    "https://cdn1.affirm.com/js/v2/affirm.js"
  end
end
private_key() click to toggle source
# File lib/workarea/affirm.rb, line 15
def self.private_key
  Workarea.config.affirm_private_key
end
public_key() click to toggle source
# File lib/workarea/affirm.rb, line 11
    def self.public_key
  Workarea.config.affirm_public_key
end
test?() click to toggle source
# File lib/workarea/affirm.rb, line 35
def self.test?
  !Workarea.config.affirm_use_production_environment
end