Class: Effective::Fee

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/fee.rb

Constant Summary collapse

CHECKOUT_TYPES =
['Default', 'Applicant', 'Fee Payment']

Instance Method Summary collapse

Instance Method Details

#applicant_submit_fee?Boolean

Used by applicant.applicant_submit_fees

Returns:

  • (Boolean)


97
98
99
100
101
102
103
104
105
# File 'app/models/effective/fee.rb', line 97

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

Returns:

  • (Boolean)


126
127
128
# File 'app/models/effective/fee.rb', line 126

def custom_fee?
  EffectiveMemberships.custom_fee_types.include?(fee_type)
end

#default_titleObject



130
131
132
# File 'app/models/effective/fee.rb', line 130

def default_title
  [period&.strftime('%Y'), category, fee_type, 'Fee'].compact.join(' ')
end

#fee_payment_fee?Boolean

Returns:

  • (Boolean)


107
108
109
110
111
112
113
114
115
# File 'app/models/effective/fee.rb', line 107

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

Returns:

  • (Boolean)


82
83
84
85
86
87
# File 'app/models/effective/fee.rb', line 82

def late?
  return false if late_on.blank?
  return false if purchased?

  late_on <= Time.zone.now.to_date
end

#membership_period_fee?Boolean

Will advance a membership.fees_paid_through_year value when purchased

Returns:

  • (Boolean)


118
119
120
# File 'app/models/effective/fee.rb', line 118

def membership_period_fee?
  ['Prorated', 'Renewal'].include?(fee_type)
end

#not_in_good_standing?Boolean

Returns:

  • (Boolean)


89
90
91
92
93
94
# File 'app/models/effective/fee.rb', line 89

def not_in_good_standing?
  return false if not_in_good_standing_on.blank?
  return false if purchased?

  not_in_good_standing_on <= Time.zone.now.to_date
end

#renewal_fee?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'app/models/effective/fee.rb', line 122

def renewal_fee?
  fee_type == 'Renewal'
end

#to_sObject



78
79
80
# File 'app/models/effective/fee.rb', line 78

def to_s
  title.presence || default_title()
end