Class: Effective::Stamp
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Stamp
- Defined in:
- app/models/effective/stamp.rb
Constant Summary collapse
- CATEGORIES =
CATEGORIES = ['Physical', 'Digital-only']
['Physical']
Instance Method Summary collapse
- #created_by_admin? ⇒ Boolean
- #mark_as_issued! ⇒ Object
-
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action.
- #physical? ⇒ Boolean
-
#submit! ⇒ Object
Called by an application when submitted Called by a stamp wizard when submitted.
- #to_s ⇒ Object
Instance Method Details
#created_by_admin? ⇒ Boolean
82 83 84 |
# File 'app/models/effective/stamp.rb', line 82 def created_by_admin? stamp_wizard_id.blank? && applicant_id.blank? end |
#mark_as_issued! ⇒ Object
74 75 76 |
# File 'app/models/effective/stamp.rb', line 74 def mark_as_issued! issued! end |
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'app/models/effective/stamp.rb', line 94 def mark_paid! raise('expected an user with a membership category') unless owner && owner.try(:membership).present? category = owner.membership.categories.first assign_attributes( price: category.stamp_fee, tax_exempt: category.stamp_fee_tax_exempt, qb_item_name: category.stamp_fee_qb_item_name ) save! Effective::Order.new(items: self, user: owner).mark_as_purchased! end |
#physical? ⇒ Boolean
78 79 80 |
# File 'app/models/effective/stamp.rb', line 78 def physical? category == 'Physical' end |
#submit! ⇒ Object
Called by an application when submitted Called by a stamp wizard when submitted
88 89 90 91 |
# File 'app/models/effective/stamp.rb', line 88 def submit! raise('expected a purchased order') unless purchased? submitted! end |
#to_s ⇒ Object
70 71 72 |
# File 'app/models/effective/stamp.rb', line 70 def to_s ['Professional Stamp', *name.presence].join(' ') end |