Class: Effective::Fee
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Fee
- Defined in:
- app/models/effective/fee.rb
Constant Summary collapse
- CHECKOUT_TYPES =
['Default', 'Applicant', 'Fee Payment']
Instance Method Summary collapse
-
#applicant_submit_fee? ⇒ Boolean
Used by applicant.applicant_submit_fees.
- #custom_fee? ⇒ Boolean
- #default_title ⇒ Object
- #early? ⇒ Boolean
- #fee_payment_fee? ⇒ Boolean
- #late? ⇒ Boolean
-
#membership_period_fee? ⇒ Boolean
Will advance a membership.fees_paid_through_year value when purchased.
- #not_in_good_standing? ⇒ Boolean
- #to_s ⇒ Object
Instance Method Details
#applicant_submit_fee? ⇒ Boolean
Used by applicant.applicant_submit_fees
127 128 129 130 131 132 133 134 135 |
# File 'app/models/effective/fee.rb', line 127 def applicant_submit_fee? return true if parent.kind_of?(EffectiveMemberships.Applicant) return false if checkout_type == 'Fee Payment' return true if checkout_type == 'Applicant' # Default ['Applicant', 'Reinstatement'].include?(fee_type) end |
#custom_fee? ⇒ Boolean
152 153 154 |
# File 'app/models/effective/fee.rb', line 152 def custom_fee? EffectiveMemberships.custom_fee_types.include?(fee_type) end |
#default_title ⇒ Object
156 157 158 159 160 161 162 163 164 |
# File 'app/models/effective/fee.rb', line 156 def default_title return nil unless period.present? && fee_type.present? [ period.strftime('%Y'), category, EffectiveResources.et("effective_memberships.fees.#{fee_type.parameterize.underscore}") ].join(' ') end |
#early? ⇒ Boolean
95 96 97 98 |
# File 'app/models/effective/fee.rb', line 95 def early? return false if purchased? EffectiveMemberships.Registrar.early_fee_date_range(period: period).cover?(Time.zone.now) end |
#fee_payment_fee? ⇒ Boolean
137 138 139 140 141 142 143 144 145 |
# File 'app/models/effective/fee.rb', line 137 def fee_payment_fee? return false if parent.kind_of?(EffectiveMemberships.Applicant) return false if checkout_type == 'Applicant' return true if checkout_type == 'Fee Payment' # Default ['Applicant', 'Reinstatement'].exclude?(fee_type) end |
#late? ⇒ Boolean
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'app/models/effective/fee.rb', line 100 def late? return false if late_on.blank? return false if purchased? now = Time.zone.now if(duration = EffectiveMemberships.Registrar.min_late_duration).present? return false if ((created_at || now) + duration > now) end late_on <= now.to_date end |
#membership_period_fee? ⇒ Boolean
Will advance a membership.fees_paid_through_year value when purchased
148 149 150 |
# File 'app/models/effective/fee.rb', line 148 def membership_period_fee? ['Prorated', 'Renewal'].include?(fee_type) end |
#not_in_good_standing? ⇒ Boolean
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'app/models/effective/fee.rb', line 113 def not_in_good_standing? return false if not_in_good_standing_on.blank? return false if purchased? now = Time.zone.now if(duration = EffectiveMemberships.Registrar.min_not_in_good_standing_duration).present? return false if ((created_at || now) + duration > now) end not_in_good_standing_on <= now.to_date end |
#to_s ⇒ Object
91 92 93 |
# File 'app/models/effective/fee.rb', line 91 def to_s title.presence || default_title() end |