Class: Effective::Stamp
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Stamp
- Defined in:
- app/models/effective/stamp.rb
Instance Method Summary collapse
- #applicant_categories ⇒ Object
- #applicant_category ⇒ Object
- #applicant_status ⇒ Object
- #applicant_statuses ⇒ Object
- #linked_applicants ⇒ Object
-
#mark_as_issued! ⇒ Object
Admin action.
-
#mark_as_submitted! ⇒ Object
Admin action.
-
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action.
-
#submit! ⇒ Object
Called by a stamp wizard, applicant or fee payment when submitted.
- #to_s ⇒ Object
Instance Method Details
#applicant_categories ⇒ Object
78 79 80 81 82 83 |
# File 'app/models/effective/stamp.rb', line 78 def applicant_categories linked_applicants .filter_map { |applicant| applicant.try(:category) } .map(&:to_s) .uniq end |
#applicant_category ⇒ Object
74 75 76 |
# File 'app/models/effective/stamp.rb', line 74 def applicant_category applicant_categories.to_sentence.presence end |
#applicant_status ⇒ Object
70 71 72 |
# File 'app/models/effective/stamp.rb', line 70 def applicant_status applicant_statuses.to_sentence.presence end |
#applicant_statuses ⇒ Object
85 86 87 88 89 90 |
# File 'app/models/effective/stamp.rb', line 85 def applicant_statuses linked_applicants .filter_map { |applicant| applicant.try(:status).presence } .map { |status| status.to_s.humanize } .uniq end |
#linked_applicants ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'app/models/effective/stamp.rb', line 92 def linked_applicants if parent.class.try(:effective_memberships_applicant?) [parent] elsif parent.respond_to?(:registration_applicants) Array(parent.registration_applicants) else [] end end |
#mark_as_issued! ⇒ Object
Admin action
113 114 115 |
# File 'app/models/effective/stamp.rb', line 113 def mark_as_issued! issued! end |
#mark_as_submitted! ⇒ Object
Admin action
108 109 110 |
# File 'app/models/effective/stamp.rb', line 108 def mark_as_submitted! submitted! end |
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'app/models/effective/stamp.rb', line 118 def mark_paid! category = owner&.membership&.category assign_attributes( price: (category&.stamp_fee || 0), tax_exempt: (category&.stamp_fee_tax_exempt || false), qb_item_name: (category&.stamp_fee_qb_item_name || 'Professional Stamp') ) submit! Effective::Order.new(items: self, user: owner).mark_as_purchased! true end |
#submit! ⇒ Object
Called by a stamp wizard, applicant or fee payment when submitted
103 104 105 |
# File 'app/models/effective/stamp.rb', line 103 def submit! submitted! end |
#to_s ⇒ Object
66 67 68 |
# File 'app/models/effective/stamp.rb', line 66 def to_s [model_name.human, name.presence, category.presence].compact.join(' - ') end |