Module: Gold::Concerns::MerchantFacing

Included in:
BillingController
Defined in:
app/controllers/gold/concerns/merchant_facing.rb

Overview

Helpers that make it easier to work with the current merchant’s billing information in controllers.

Defined Under Namespace

Classes: ConfrontMandatoryBillingAction, HasAccessToRoutes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'app/controllers/gold/concerns/merchant_facing.rb', line 6

def self.included(base)
  base.helper_method :billing
end

Instance Method Details

#billingObject

Returns the Gold::Billing instance for the currently logged-in merchant.



11
12
13
14
15
# File 'app/controllers/gold/concerns/merchant_facing.rb', line 11

def billing
  @billing ||= Billing.find_by!(shop_id: session[:shop_id])
rescue ActiveRecord::RecordNotFound
  raise Gold::Exceptions::BillingNotFound
end

#confront_mandatory_billing_actionObject

‘before_action` filter that forces a merchant to deal with billing-related states (outstanding charges, acceptance of terms, etc) before continuing with their work.



20
21
22
# File 'app/controllers/gold/concerns/merchant_facing.rb', line 20

def confront_mandatory_billing_action
  ConfrontMandatoryBillingAction.new(self).call
end