Module: Vpago::ShippingRateDecorator

Defined in:
app/models/vpago/shipping_rate_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/models/vpago/shipping_rate_decorator.rb', line 3

def self.prepended(base)
  base.has_many :payout_profiles, class_name: 'Spree::PayoutProfile', through: :shipping_method
  base.has_many :active_payout_profiles, class_name: 'Spree::PayoutProfile', through: :shipping_method
  base.has_many :active_payway_payout_profiles, class_name: 'Spree::PayoutProfile', through: :shipping_method
  base.has_many :required_active_payout_profiles, class_name: 'Spree::PayoutProfile', through: :shipping_method

  base.enum handle_by: { store: 0, vendor: 1 }, _prefix: true

  base.scope :handle_by_vendor, -> { where(handle_by: :vendor) }
  base.scope :handle_by_store, -> { where(handle_by: :store) }

  base.before_save :set_handle_by
end