module Workarea::Usaepay

Constants

VERSION

Public Class Methods

auto_initialize_gateway() click to toggle source
# File lib/workarea/usaepay.rb, line 31
def self.auto_initialize_gateway
  if credentials.present?
    if Rails.env.test?
      self.gateway = ActiveMerchant::Billing::BogusUsaEpayGateway.new credentials
    else
      self.gateway = ActiveMerchant::Billing::UsaEpayCustom.new credentials
    end
  else
    self.gateway = ActiveMerchant::Billing::BogusUsaEpayGateway.new
  end
end
credentials() click to toggle source

Credentials for PayFlowPro from Rails secrets.

@return [Hash]

# File lib/workarea/usaepay.rb, line 14
def self.credentials
  return {} unless Rails.application.secrets.usaepay_transaction_gateway.present?
  Rails.application.secrets.usaepay_transaction_gateway.symbolize_keys
end
gateway() click to toggle source

Conditionally use the real gateway when secrets are present. Otherwise, use the bogus gateway.

@return [ActiveMerchant::Billing::Gateway]

# File lib/workarea/usaepay.rb, line 23
def self.gateway
  Workarea.config.gateways.credit_card
end
gateway=(gateway) click to toggle source
# File lib/workarea/usaepay.rb, line 27
def self.gateway=(gateway)
  Workarea.config.gateways.credit_card = gateway
end