Module: EffectiveMembershipsCategory

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_memberships_category.rb

Overview

EffectiveMembershipsCategory

Mark your category model with effective_memberships_category to get all the includes

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#applicant_fee_qb_item_nameObject



286
287
288
# File 'app/models/concerns/effective_memberships_category.rb', line 286

def applicant_fee_qb_item_name
  'Applicant'
end

#applicant_fee_tax_exemptObject



290
291
292
# File 'app/models/concerns/effective_memberships_category.rb', line 290

def applicant_fee_tax_exempt
  tax_exempt
end

#applicant_reinstatement_wizard_stepsObject

Apply for Reinstatement



256
257
258
# File 'app/models/concerns/effective_memberships_category.rb', line 256

def applicant_reinstatement_wizard_steps
  [:reinstatement]
end

#applicant_resignation_feeObject



251
252
253
# File 'app/models/concerns/effective_memberships_category.rb', line 251

def applicant_resignation_fee
  0
end

#applicant_resignation_wizard_stepsObject

Apply for Resignation



247
248
249
# File 'app/models/concerns/effective_memberships_category.rb', line 247

def applicant_resignation_wizard_steps
  [:resignation]
end

#applicant_review_wizard_stepsObject



264
265
266
# File 'app/models/concerns/effective_memberships_category.rb', line 264

def applicant_review_wizard_steps
  (Array(self[:applicant_review_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_stepsObject

Apply to Join or Apply to Reclassify



242
243
244
# File 'app/models/concerns/effective_memberships_category.rb', line 242

def applicant_wizard_steps
  (Array(self[:applicant_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_steps_collectionObject



268
269
270
271
272
273
274
275
# File 'app/models/concerns/effective_memberships_category.rb', line 268

def applicant_wizard_steps_collection
  wizard_steps = EffectiveMemberships.Applicant.wizard_steps_hash
  required_steps = EffectiveMemberships.Applicant.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#can_apply?Boolean

Returns:

  • (Boolean)


201
202
203
# File 'app/models/concerns/effective_memberships_category.rb', line 201

def can_apply?
  can_apply_new? || can_apply_existing? || can_apply_restricted?
end

#can_apply_restricted_idsObject



225
226
227
# File 'app/models/concerns/effective_memberships_category.rb', line 225

def can_apply_restricted_ids
  Array(self[:can_apply_restricted_ids]) - [nil, '']
end

#can_stamp_wizard?Boolean

This enables the permission to use the effective products stamp wizard To buy a stamp outside of the applicant process

Returns:

  • (Boolean)


296
297
298
# File 'app/models/concerns/effective_memberships_category.rb', line 296

def can_stamp_wizard?
  applicant_wizard_steps.include?(:stamp)
end

#cpd_target_score(cpd_cycle:) ⇒ Object



312
313
314
# File 'app/models/concerns/effective_memberships_category.rb', line 312

def cpd_target_score(cpd_cycle:)
  nil
end

#discount_fee(date:) ⇒ Object



221
222
223
# File 'app/models/concerns/effective_memberships_category.rb', line 221

def discount_fee(date:)
  0 - prorated_fee(date: date)
end

#fee_payment_wizard_stepsObject



260
261
262
# File 'app/models/concerns/effective_memberships_category.rb', line 260

def fee_payment_wizard_steps
  (Array(self[:fee_payment_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#fee_payment_wizard_steps_collectionObject



277
278
279
280
281
282
283
284
# File 'app/models/concerns/effective_memberships_category.rb', line 277

def fee_payment_wizard_steps_collection
  wizard_steps = EffectiveMemberships.FeePayment.wizard_steps_hash
  required_steps = EffectiveMemberships.FeePayment.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#individual?Boolean

Returns:

  • (Boolean)


205
206
207
# File 'app/models/concerns/effective_memberships_category.rb', line 205

def individual?
  category_type == 'Individual'
end

#membership_directory_titleObject



197
198
199
# File 'app/models/concerns/effective_memberships_category.rb', line 197

def membership_directory_title
  to_s
end

#membership_number_required?Boolean

Returns:

  • (Boolean)


213
214
215
# File 'app/models/concerns/effective_memberships_category.rb', line 213

def membership_number_required?
  true
end

#optional_applicant_review_wizard_stepsObject



237
238
239
# File 'app/models/concerns/effective_memberships_category.rb', line 237

def optional_applicant_review_wizard_steps
  applicant_review_wizard_steps - EffectiveMemberships.ApplicantReview.required_wizard_steps
end

#optional_applicant_wizard_stepsObject



229
230
231
# File 'app/models/concerns/effective_memberships_category.rb', line 229

def optional_applicant_wizard_steps
  applicant_wizard_steps - EffectiveMemberships.Applicant.required_wizard_steps
end

#optional_fee_payment_wizard_stepsObject



233
234
235
# File 'app/models/concerns/effective_memberships_category.rb', line 233

def optional_fee_payment_wizard_steps
  fee_payment_wizard_steps - EffectiveMemberships.FeePayment.required_wizard_steps
end

#organization?Boolean

Returns:

  • (Boolean)


209
210
211
# File 'app/models/concerns/effective_memberships_category.rb', line 209

def organization?
  category_type == 'Organization'
end

#prorated_fee(date:) ⇒ Object



217
218
219
# File 'app/models/concerns/effective_memberships_category.rb', line 217

def prorated_fee(date:)
  send("prorated_#{date.strftime('%b').downcase}").to_i
end

#reclassification_expires_inObject



316
317
318
# File 'app/models/concerns/effective_memberships_category.rb', line 316

def reclassification_expires_in
  nil # 2.years
end

#stamp_feeObject



300
301
302
# File 'app/models/concerns/effective_memberships_category.rb', line 300

def stamp_fee
  0
end

#stamp_fee_qb_item_nameObject



304
305
306
# File 'app/models/concerns/effective_memberships_category.rb', line 304

def stamp_fee_qb_item_name
  qb_item_name
end

#stamp_fee_tax_exemptObject



308
309
310
# File 'app/models/concerns/effective_memberships_category.rb', line 308

def stamp_fee_tax_exempt
  tax_exempt
end

#to_sObject

Instance Methods



193
194
195
# File 'app/models/concerns/effective_memberships_category.rb', line 193

def to_s
  title.presence || 'New Membership Category'
end