effective_memberships 0.9.5 → 0.9.6
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_applicant.rb +2 -0
- data/app/models/concerns/effective_memberships_owner.rb +9 -0
- data/app/models/concerns/effective_memberships_registrar.rb +34 -7
- data/app/models/effective/membership.rb +2 -3
- data/app/models/effective/registrar_action.rb +2 -0
- data/app/views/admin/applicants/_form_approve.html.haml +11 -1
- data/app/views/admin/memberships/_form_membership.html.haml +1 -1
- data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +1 -0
- data/lib/effective_memberships/version.rb +1 -1
- data/lib/tasks/effective_memberships_tasks.rake +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: f42637485b8a72cd2cf2a7f4845e75dbca8d3c379270d4dfe0a607e70610117d
|
4
|
+
data.tar.gz: 9d41bd14aad6e7e54c76568bd58147d43965fd30060c07525941294b7504d28e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d456e9bcd40ce78fc83689c5352a85bc156ec50f7149bd169f7af1521d3ec1c58f6ed67b06922b28b36fec1cbb7c880a58e4e6c7ddcf197f3872e37fb5ac247b
|
7
|
+
data.tar.gz: 2f27824362cf294f83d4f953bb8c283045ef70a03910b17eeff1591f90df0a508bcf7dff1bbca53b49d6663f60d50376e9a8d4fb50da9cc47e6889724d34ef4d
|
@@ -99,6 +99,15 @@ module EffectiveMembershipsOwner
|
|
99
99
|
fees.select { |fee| fee.fee_payment_fee? && !fee.purchased? }
|
100
100
|
end
|
101
101
|
|
102
|
+
def outstanding_fee_payments
|
103
|
+
fee_payments = EffectiveMemberships.FeePayment.all
|
104
|
+
|
105
|
+
fee_payments = fee_payments.where(user: self) if self.class.respond_to?(:effective_memberships_user?)
|
106
|
+
fee_payments = fee_payments.where(organization: self) if self.class.respond_to?(:effective_memberships_organization?)
|
107
|
+
|
108
|
+
fee_payments.select { |fee_payment| fee_payment.in_progress? && fee_payment.orders.none?(&:purchased?) }
|
109
|
+
end
|
110
|
+
|
102
111
|
def outstanding_fee_payment_orders
|
103
112
|
orders.select { |order| order.parent_type.to_s.include?('FeePayment') && !order.purchased? }
|
104
113
|
end
|
@@ -380,24 +380,51 @@ module EffectiveMembershipsRegistrar
|
|
380
380
|
periods(from: from, to: to).reverse.map { |period| [period_end_on(date: period), period] }
|
381
381
|
end
|
382
382
|
|
383
|
+
# Called by applicant.approve!
|
384
|
+
def delete_fees!(resource)
|
385
|
+
owner = (resource.class.respond_to?(:effective_memberships_owner?) ? resource : resource.try(:owner))
|
386
|
+
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
387
|
+
|
388
|
+
# Delete unpurchased fees and orders
|
389
|
+
owner.outstanding_fee_payment_fees.each { |fee| fee.mark_for_destruction }
|
390
|
+
owner.outstanding_fee_payment_orders.each { |order| order.mark_for_destruction }
|
391
|
+
owner.save!
|
392
|
+
|
393
|
+
owner.outstanding_fee_payments.each { |fee_payment| fee_payment.destroy! }
|
394
|
+
|
395
|
+
true
|
396
|
+
end
|
397
|
+
|
383
398
|
# This is intended to be run once per day in a rake task
|
384
399
|
# rake effective_memberships:create_fees
|
385
400
|
# Create Renewal and Late fees
|
386
|
-
|
401
|
+
# Assigns NIGS
|
402
|
+
def create_all_fees!(period: nil)
|
387
403
|
period ||= current_period
|
388
404
|
memberships = Effective::Membership.deep.with_unpaid_fees_through(period)
|
389
405
|
|
406
|
+
memberships.find_each do |membership|
|
407
|
+
create_fees!(membership, period: period)
|
408
|
+
GC.start
|
409
|
+
end
|
410
|
+
|
411
|
+
true
|
412
|
+
end
|
413
|
+
|
414
|
+
def create_fees!(resource, period: nil)
|
415
|
+
period ||= current_period
|
416
|
+
|
417
|
+
membership = (resource.class.respond_to?(:effective_memberships_owner?) ? resource.membership : resource)
|
418
|
+
raise('expected a membership') unless membership.present? && membership.kind_of?(Effective::Membership)
|
419
|
+
|
390
420
|
# Create Renewal Fees
|
391
|
-
|
392
|
-
GC.start
|
421
|
+
create_renewal_fees!(membership, period: period)
|
393
422
|
|
394
423
|
# Create Late Fees
|
395
|
-
|
396
|
-
GC.start
|
424
|
+
create_late_fees!(membership, period: period)
|
397
425
|
|
398
426
|
# Update Membership Status - Assign Not In Good Standing
|
399
|
-
|
400
|
-
GC.start
|
427
|
+
create_not_in_good_standing!(membership, period: period)
|
401
428
|
|
402
429
|
true
|
403
430
|
end
|
@@ -252,9 +252,8 @@ module Effective
|
|
252
252
|
return true if paid_fees_through?(period)
|
253
253
|
|
254
254
|
# Otherwise build fees right now
|
255
|
-
EffectiveMemberships.Registrar.
|
256
|
-
EffectiveMemberships.Registrar.
|
257
|
-
EffectiveMemberships.Registrar.create_not_in_good_standing!(self, period: period)
|
255
|
+
EffectiveMemberships.Registrar.delete_fees!(self)
|
256
|
+
EffectiveMemberships.Registrar.create_fees!(self, period: period)
|
258
257
|
|
259
258
|
true
|
260
259
|
end
|
@@ -28,6 +28,7 @@ module Effective
|
|
28
28
|
# Mark Fees Paid - Order Attributes
|
29
29
|
attr_accessor :payment_provider
|
30
30
|
attr_accessor :payment_card
|
31
|
+
attr_accessor :purchased_at
|
31
32
|
attr_accessor :note_to_buyer
|
32
33
|
attr_accessor :note_internal
|
33
34
|
|
@@ -136,6 +137,7 @@ module Effective
|
|
136
137
|
{
|
137
138
|
payment_provider: @payment_provider.presence,
|
138
139
|
payment_card: @payment_card.presence,
|
140
|
+
purchased_at: @purchased_at.presence,
|
139
141
|
note_to_buyer: @note_to_buyer.presence,
|
140
142
|
note_internal: @note_internal.presence
|
141
143
|
}.compact
|
@@ -16,7 +16,7 @@
|
|
16
16
|
No membership number will be assigned.
|
17
17
|
|
18
18
|
%h3 Fees
|
19
|
-
%p The following
|
19
|
+
%p The following fees will be created:
|
20
20
|
- month = Time.zone.now.strftime('%B')
|
21
21
|
|
22
22
|
%ul
|
@@ -27,6 +27,16 @@
|
|
27
27
|
%li A #{month} prorated fee to the new category
|
28
28
|
%li A #{month} discount fee from their old category
|
29
29
|
|
30
|
+
%p The following unpurchased fees will be deleted:
|
31
|
+
- outstanding_fee_payment_fees = applicant.owner.outstanding_fee_payment_fees
|
32
|
+
|
33
|
+
%ul
|
34
|
+
- outstanding_fee_payment_fees.each do |fee|
|
35
|
+
%li= fee
|
36
|
+
|
37
|
+
- if outstanding_fee_payment_fees.blank?
|
38
|
+
%li None
|
39
|
+
|
30
40
|
%h3 Email to send
|
31
41
|
- email_templates = applicant.approve_email_templates
|
32
42
|
|
@@ -23,6 +23,6 @@
|
|
23
23
|
|
24
24
|
= f.select :change_fees_paid_period, collection, label: 'Fees Paid Through', hint: 'Which period this user has fees paid through. Determines which renewal fees should be created. Setting this to a past or blank period may create a renewal fee in the current period.'
|
25
25
|
|
26
|
-
%p.text-muted To update the current membership categories, use the '
|
26
|
+
%p.text-muted To update the current membership categories or statuses, use the 'Reclassify' or 'Status Change' actions below
|
27
27
|
|
28
28
|
= f.submit 'Update Membership', border: false, center: true, 'data-confirm': "Really update #{f.object.owner}?"
|
@@ -31,6 +31,7 @@
|
|
31
31
|
%p An order will be created and marked as paid with the following information:
|
32
32
|
|
33
33
|
= f.select :payment_provider, EffectiveOrders.admin_payment_providers, required: true
|
34
|
+
= f.datetime_field :purchased_at, label: 'Purchased or completed'
|
34
35
|
|
35
36
|
= f.text_field :payment_card,
|
36
37
|
label: 'Payment card type, cheque or transaction number',
|
@@ -11,7 +11,7 @@ namespace :effective_memberships do
|
|
11
11
|
begin
|
12
12
|
if ActiveRecord::Base.connection.table_exists?(:memberships)
|
13
13
|
EffectiveLogger.info "Running effective_memberships:create_fees scheduled task" if defined?(EffectiveLogger)
|
14
|
-
EffectiveMemberships.Registrar.
|
14
|
+
EffectiveMemberships.Registrar.create_all_fees!
|
15
15
|
end
|
16
16
|
rescue => e
|
17
17
|
ExceptionNotifier.notify_exception(e) if defined?(ExceptionNotifier)
|
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.9.
|
4
|
+
version: 0.9.6
|
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: 2022-11-
|
11
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|