effective_memberships 0.9.16 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/effective_memberships_owner.rb +23 -2
- data/app/models/concerns/effective_memberships_registrar.rb +24 -4
- data/app/models/effective/fee.rb +14 -2
- data/app/views/admin/applicants/_form_approve.html.haml +5 -2
- data/lib/effective_memberships/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09cdd3d71c709fdaacb54d4abd0d21217bd6e7e3a7395e687004eb124994b75b'
|
4
|
+
data.tar.gz: caebcbe36b5c113d715e47ef8df0d224f7ea825ae0fa3ea3f5efc59448bcc30f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50897b485cca843711185839c1e630b90211ac1559c7a956fd5d425d70a37ad7ef94b6a3863cd1055ac8efa226ef635a4b6186f32763e260c277cb198b4c7f3c
|
7
|
+
data.tar.gz: 0a53cc0947501e0f89c07d56e052b81f5b6a7f2c676698e5e45227f0c9ae460b8c674d90fd0bc521601eb5adef49ab07d1433ce6ccd5f80fcefb670b6c9845d6
|
@@ -99,6 +99,10 @@ module EffectiveMembershipsOwner
|
|
99
99
|
fees.select { |fee| fee.fee_payment_fee? && !fee.purchased? }
|
100
100
|
end
|
101
101
|
|
102
|
+
def outstanding_renewal_fees
|
103
|
+
fees.select { |fee| fee.fee_type == 'Renewal' && !fee.purchased? }
|
104
|
+
end
|
105
|
+
|
102
106
|
def outstanding_fee_payments
|
103
107
|
fee_payments = EffectiveMemberships.FeePayment.all
|
104
108
|
|
@@ -263,8 +267,25 @@ module EffectiveMembershipsOwner
|
|
263
267
|
# Build the renewal fee
|
264
268
|
fee ||= fees.build()
|
265
269
|
|
266
|
-
|
267
|
-
|
270
|
+
# Late on this period's late date, or 60 days, whichever is later
|
271
|
+
late_on ||= if category.create_late_fees?
|
272
|
+
late_date = EffectiveMemberships.Registrar.late_fee_date(period: period)
|
273
|
+
|
274
|
+
duration = EffectiveMemberships.Registrar.min_late_duration
|
275
|
+
min_date = ((fee.created_at || Time.zone.now) + duration) if duration.present?
|
276
|
+
|
277
|
+
[late_date, min_date].compact.max
|
278
|
+
end
|
279
|
+
|
280
|
+
# NIGS on this period's late date, or 60 days, whichever is later
|
281
|
+
not_in_good_standing_on ||= if category.create_not_in_good_standing?
|
282
|
+
nigs_date = EffectiveMemberships.Registrar.not_in_good_standing_date(period: period)
|
283
|
+
|
284
|
+
duration = EffectiveMemberships.Registrar.min_not_in_good_standing_duration
|
285
|
+
min_date = ((fee.created_at || Time.zone.now) + duration) if duration.present?
|
286
|
+
|
287
|
+
[nigs_date, min_date].compact.max
|
288
|
+
end
|
268
289
|
|
269
290
|
fee.assign_attributes(
|
270
291
|
fee_type: 'Renewal',
|
@@ -33,6 +33,18 @@ module EffectiveMembershipsRegistrar
|
|
33
33
|
raise('to be implemented by app registrar')
|
34
34
|
end
|
35
35
|
|
36
|
+
# A renewal fee must be at least this old to be considered late?
|
37
|
+
# Must be less than (late_fee_date - renewal_fee_date) but this is not enforced
|
38
|
+
def min_late_duration
|
39
|
+
60.days
|
40
|
+
end
|
41
|
+
|
42
|
+
# A renewal fee must be at least this old to be considered nigs?
|
43
|
+
# Must be less than (nigs_date - renewal_fee_date) but this is not enforced
|
44
|
+
def min_not_in_good_standing_duration
|
45
|
+
60.days
|
46
|
+
end
|
47
|
+
|
36
48
|
# scope
|
37
49
|
def not_in_good_standing_status
|
38
50
|
EffectiveMemberships.Status.where(title: 'Not In Good Standing')
|
@@ -156,6 +168,7 @@ module EffectiveMembershipsRegistrar
|
|
156
168
|
raise('expected to and from to be different') if from == to
|
157
169
|
|
158
170
|
date ||= Time.zone.now
|
171
|
+
period = period(date: date)
|
159
172
|
|
160
173
|
# Existing Membership
|
161
174
|
membership = owner.membership
|
@@ -171,11 +184,18 @@ module EffectiveMembershipsRegistrar
|
|
171
184
|
membership.build_membership_status(status: status) if status.present?
|
172
185
|
|
173
186
|
unless skip_fees
|
174
|
-
|
175
|
-
raise('already has purchased prorated fee') if fee.purchased?
|
187
|
+
existing = owner.membership_period_fee(category: from, period: period)
|
176
188
|
|
177
|
-
|
178
|
-
|
189
|
+
if existing
|
190
|
+
fee = owner.build_prorated_fee(date: date)
|
191
|
+
raise('already has purchased prorated fee') if fee.purchased?
|
192
|
+
|
193
|
+
fee = owner.build_discount_fee(date: date, from: from)
|
194
|
+
raise('already has purchased discount fee') if fee.purchased?
|
195
|
+
else
|
196
|
+
fee = owner.build_renewal_fee(category: to, period: period)
|
197
|
+
raise('already has purchased renewal fee') if fee.purchased?
|
198
|
+
end
|
179
199
|
end
|
180
200
|
|
181
201
|
save!(owner, date: date)
|
data/app/models/effective/fee.rb
CHANGED
@@ -87,14 +87,26 @@ module Effective
|
|
87
87
|
return false if late_on.blank?
|
88
88
|
return false if purchased?
|
89
89
|
|
90
|
-
|
90
|
+
now = Time.zone.now
|
91
|
+
|
92
|
+
if(duration = EffectiveMemberships.Registrar.min_late_duration).present?
|
93
|
+
return false if ((created_at || now) + duration > now)
|
94
|
+
end
|
95
|
+
|
96
|
+
late_on <= now.to_date
|
91
97
|
end
|
92
98
|
|
93
99
|
def not_in_good_standing?
|
94
100
|
return false if not_in_good_standing_on.blank?
|
95
101
|
return false if purchased?
|
96
102
|
|
97
|
-
|
103
|
+
now = Time.zone.now
|
104
|
+
|
105
|
+
if(duration = EffectiveMemberships.Registrar.min_not_in_good_standing_duration).present?
|
106
|
+
return false if ((created_at || now) + duration > now)
|
107
|
+
end
|
108
|
+
|
109
|
+
not_in_good_standing_on <= now.to_date
|
98
110
|
end
|
99
111
|
|
100
112
|
# Used by applicant.applicant_submit_fees
|
@@ -31,8 +31,11 @@
|
|
31
31
|
%li A #{month} prorated fee
|
32
32
|
|
33
33
|
- if applicant.reclassification?
|
34
|
-
|
35
|
-
|
34
|
+
- if applicant.owner.outstanding_renewal_fees.present?
|
35
|
+
%li A renewal fee in their new category
|
36
|
+
- else
|
37
|
+
%li A #{month} prorated fee to the new category
|
38
|
+
%li A #{month} discount fee from their old category
|
36
39
|
|
37
40
|
- if applicant.reinstatement?
|
38
41
|
%li A #{month} prorated fee to their reinstatement category
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_memberships
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|