effective_memberships 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c5813efd8fd5455db9964bbb466b8ae8d12f44ee3acce7a945c5ff67550c5e8
4
- data.tar.gz: a91d84a98511574b854ae98724d5fbdd37a66aef5a9d87a29956bd6c9cf95062
3
+ metadata.gz: 0e562d7ef78e3298066d1051a02aee3f0e81515a5221f5210f0782403d4634a6
4
+ data.tar.gz: 7951880cdf0b2fd8f0a4dfbff341b58ef61853cab50d36da54ed31ee5f16f457
5
5
  SHA512:
6
- metadata.gz: 83c2dba1cfde3ace28c1037a633e50a4f975f5b8be24877ee2d96e029197c5d43ea8b4e66a2e3a992c9f9298c6c81d84fdaa2045a6e7dc12e3ef97ad154a4a90
7
- data.tar.gz: 18b9f5b9377923a1a17703f104ab51710a9c6dacfb6315c322c6a71c3c6204e4b80d64ec13121c4d95b20178e807087bf8ab383288486e6f3abba9b09ca72bf2
6
+ metadata.gz: 3a46a6e3b2117e117aef3dd3ee1d28e4f6cb9790ce22144193549c54cd6c96253f2268287e6f228083e7d526b14d6b1091cb196091caf1f7da7eec9df5f5ac65
7
+ data.tar.gz: 5cf7629541e967ce4ffd3c06a1e0953cc0d36fa2528e4fb85a4418ce1c5ff77e71f13ea172e77d1fea3d9f2f73623dc5b285079099e51be2df385ad0f572587b
@@ -395,6 +395,16 @@ module EffectiveMembershipsApplicant
395
395
  can_revisit_completed_steps(step)
396
396
  end
397
397
 
398
+ # Find fee
399
+ def fee(fee_type:)
400
+ fees.find { |fee| fee.fee_type == fee_type }
401
+ end
402
+
403
+ # Find or build
404
+ def build_fee(fee_type:)
405
+ fee(fee_type: fee_type) || fees.build(parent: self, owner: owner, fee_type: fee_type)
406
+ end
407
+
398
408
  def applicant_fee_type
399
409
  return 'Reinstatement' if reinstatement?
400
410
  'Applicant'
@@ -411,18 +421,22 @@ module EffectiveMembershipsApplicant
411
421
 
412
422
  # All Fees and Orders
413
423
  def submit_fees
424
+ default_applicant_submit_fees
425
+ end
426
+
427
+ def default_applicant_submit_fees
414
428
  # Find or build submit fee
415
- fee = fees.first || fees.build(owner: owner)
429
+ fee = fees.first || build_fee(fee_type: applicant_fee_type)
416
430
 
417
431
  raise('expected a present applicant fee price') if applicant_fee_price.blank?
418
432
 
419
433
  unless fee.purchased?
420
434
  fee.assign_attributes(
421
- fee_type: applicant_fee_type(),
422
- category: applicant_fee_category(),
423
- price: applicant_fee_price(),
424
- tax_exempt: applicant_fee_category().applicant_fee_tax_exempt,
425
- qb_item_name: applicant_fee_category().applicant_fee_qb_item_name
435
+ fee_type: applicant_fee_type,
436
+ category: applicant_fee_category,
437
+ price: applicant_fee_price,
438
+ tax_exempt: applicant_fee_category.applicant_fee_tax_exempt,
439
+ qb_item_name: applicant_fee_category.applicant_fee_qb_item_name
426
440
  )
427
441
  end
428
442
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_memberships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect