Module: EffectiveProductsStampWizard

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_products_stamp_wizard.rb

Overview

EffectiveProductsStampWizard

Mark your owner model with effective_products_stamp_wizard to get all the includes

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#assign_pricingObject



116
117
118
119
120
121
122
123
124
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 116

def assign_pricing
  raise('to be implemented by including class')

  # price = (stamp.physical? ? 100_00 : 50_00)
  # qb_item_name = "Professional Stamp"
  # tax_exempt = false

  # stamp.assign_attributes(price: price, qb_item_name: qb_item_name, tax_exempt: tax_exempt)
end

#build_stampObject



111
112
113
114
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 111

def build_stamp
  address = owner.try(:shipping_address) || owner.try(:billing_address)
  stamps.build(owner: owner, shipping_address: address)
end

#done?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 103

def done?
  
end

#in_progress?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 99

def in_progress?
  draft?
end

#stampObject



107
108
109
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 107

def stamp
  stamps.first
end

#stamp!Object

After the configure Stamp step



127
128
129
130
131
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 127

def stamp!
  assign_pricing() if stamp.present?
  raise('expected stamp to have a price') if stamp.price.blank?
  save!
end

#to_sObject

Instance Methods



95
96
97
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 95

def to_s
  'stamp payment'
end