Class: Effective::Stamp
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Stamp
- Defined in:
- app/models/effective/stamp.rb
Instance Attribute Summary collapse
-
#admin_action ⇒ Object
Returns the value of attribute admin_action.
Instance Method Summary collapse
- #created_by_admin? ⇒ Boolean
- #mark_as_issued! ⇒ Object
- #mark_as_submitted! ⇒ Object
-
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action.
-
#submit! ⇒ Object
Called by an application when submitted Called by a stamp wizard when submitted.
- #to_s ⇒ Object
Instance Attribute Details
#admin_action ⇒ Object
Returns the value of attribute admin_action.
10 11 12 |
# File 'app/models/effective/stamp.rb', line 10 def admin_action @admin_action end |
Instance Method Details
#created_by_admin? ⇒ Boolean
101 102 103 |
# File 'app/models/effective/stamp.rb', line 101 def created_by_admin? stamp_wizard_id.blank? && applicant_id.blank? end |
#mark_as_issued! ⇒ Object
97 98 99 |
# File 'app/models/effective/stamp.rb', line 97 def mark_as_issued! issued! end |
#mark_as_submitted! ⇒ Object
93 94 95 |
# File 'app/models/effective/stamp.rb', line 93 def mark_as_submitted! submitted! end |
#mark_paid! ⇒ Object
This is the Admin Save and Mark Paid action
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'app/models/effective/stamp.rb', line 113 def mark_paid! assign_attributes(admin_action: true) category = owner&.membership&.categories&.first if category.present? assign_attributes( price: category.stamp_fee, tax_exempt: category.stamp_fee_tax_exempt, qb_item_name: category.stamp_fee_qb_item_name ) end submitted! # Will fail with invalid owner membership anyway if category.present? Effective::Order.new(items: self, user: owner).mark_as_purchased! end true end |
#submit! ⇒ Object
Called by an application when submitted Called by a stamp wizard when submitted
107 108 109 110 |
# File 'app/models/effective/stamp.rb', line 107 def submit! raise('expected a purchased order') unless (purchased? || applicant&.submit_order&.purchased?) submitted! end |
#to_s ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'app/models/effective/stamp.rb', line 83 def to_s [ model_name.human, ('Replacement' if stamp_wizard_id_was.present?), '-', name.presence, ("- #{category}" if category.present?) ].compact.join(' ') end |