effective_memberships 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85036ca2aa1362333f21d1da76e3ce330607f39922e8a9200f33794e01d326db
4
- data.tar.gz: a266929f23d85a651aa70b353b70041088f442a46c576a28458674bf1959b286
3
+ metadata.gz: e5630148361e363550dea41e32b75f80ce1534bd93a4c18873d724c7b0b9cd61
4
+ data.tar.gz: 46e7aa62a886f604e4ebbf9b80e76f44f3fe5ee933f9e5f468513d412007fd62
5
5
  SHA512:
6
- metadata.gz: b054a795fd94aadadb7d6986b1a4c9b2e7e375f7db63b94b3c3ce9e39ec7c6d1e035030db076777724e3d8a7bb47b33acbdd7dec3c81fbd2f01237d35bff2709
7
- data.tar.gz: 38e7942eb0fcae97c12153442b390dc8d239c2ad26a8981287be8fb30d01808d263d6019445af11eb0a6e5f6676b8b0f167140b8ab0a13658d2e82327082d137
6
+ metadata.gz: 91fb28c6ba34f3ac0146219b14f613fb4d19b883963e268d1117bcd56d9f7fcdfb4c5bd807230c53d14d2aefc49eb525867cc23c370948562d881ad79a29029a
7
+ data.tar.gz: eb61306191817a7bde172a548d2cf373f3210b235857c1a35d6923522a7ffddafbeeff6124ce5ef2e8d2bb9161c32d0de606465738ee88aeb74adc2e15efc92e
@@ -383,14 +383,14 @@ module EffectiveMembershipsApplicant
383
383
  # This required_steps is defined inside the included do .. end block so it overrides the acts_as_wizard one.
384
384
  def required_steps
385
385
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
386
- return self.class.all_wizard_steps if category.blank?
387
386
 
388
387
  @_required_steps ||= begin
389
388
  # All required
390
389
  required_steps = self.class.required_wizard_steps
391
390
 
392
391
  # Based on current applicant
393
- applicant_steps = (reinstatement? ? category.applicant_reinstatement_wizard_steps : category.applicant_wizard_steps)
392
+ applicant_steps = self.class.all_wizard_steps if category.blank?
393
+ applicant_steps ||= (reinstatement? ? category.applicant_reinstatement_wizard_steps : category.applicant_wizard_steps)
394
394
 
395
395
  # Sanity check
396
396
  applicant_steps.delete(:stamp) unless apply_to_join?
@@ -100,7 +100,7 @@ module EffectiveMembershipsFeePayment
100
100
  self.organization_type = (EffectiveMemberships.Organization.name if organization_id.present?)
101
101
  end
102
102
 
103
- before_validation(if: -> { current_step == :start && user && user.membership }) do
103
+ before_validation(if: -> { (new_record? || current_step == :start) && user && user.membership }) do
104
104
  self.category ||= user.membership.categories.first if user.membership.categories.length == 1
105
105
  self.with_status ||= user.membership.statuses.first if user.membership.statuses.length == 1
106
106
  end
@@ -121,14 +121,14 @@ module EffectiveMembershipsFeePayment
121
121
  # This required_steps is defined inside the included do .. end block so it overrides the acts_as_wizard one.
122
122
  def required_steps
123
123
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
124
- return self.class.all_wizard_steps if category.blank?
125
124
 
126
125
  @_required_steps ||= begin
127
126
  # All required
128
127
  required_steps = self.class.required_wizard_steps
129
128
 
130
129
  # Based on current fee payment
131
- fee_payment_steps = Array(category.fee_payment_wizard_steps)
130
+ fee_payment_steps = self.class.all_wizard_steps if category.blank?
131
+ fee_payment_steps ||= Array(category.fee_payment_wizard_steps)
132
132
 
133
133
  # Sanity Check
134
134
  fee_payment_steps.delete(:organization) unless organization?
@@ -162,10 +162,13 @@ module EffectiveMembershipsFeePayment
162
162
  submit_fees
163
163
  end
164
164
 
165
+ def existing_renewal_fee
166
+ fees.find { |fee| fee.fee_type == 'Renewal' }
167
+ end
168
+
165
169
  def after_submit_purchased!
166
170
  EffectiveMemberships.Registrar.fee_payment_purchased!(owner)
167
171
  end
168
-
169
172
  end
170
173
 
171
174
  def to_s
@@ -193,7 +193,7 @@ module EffectiveMembershipsOwner
193
193
  end
194
194
 
195
195
  # Only thing optional is category, late_on and bad_standing_on
196
- def build_title_fee(title:, fee_type:, period:, price:, tax_exempt:, qb_item_name:, category: nil)
196
+ def build_title_fee(title:, fee_type:, period:, price: nil, tax_exempt: nil, qb_item_name: nil, category: nil)
197
197
  fee = fees.find do |fee|
198
198
  fee.fee_type == fee_type && fee.period == period && fee.title == title &&
199
199
  (category.blank? || fee.category_id == category.id && fee.category_type == category.class.name)
@@ -228,7 +228,7 @@ module EffectiveMembershipsOwner
228
228
 
229
229
  # Sanity check.
230
230
  # If there's already a purchased or unpurchased Prorated (or other membership period advancing fee) in this period
231
- # We shouldn't be building renewal fees for the same period a prorated fee is purcahsed in
231
+ # We shouldn't be building renewal fees for the same period a prorated fee is purchased in
232
232
  prorated = membership_period_fee(category: category, period: period, except: 'Renewal')
233
233
  raise('must not have an existing membership_period (prorated) fee in this period') if prorated.present?
234
234
 
@@ -437,7 +437,7 @@ module EffectiveMembershipsRegistrar
437
437
  # Called in the after_purchase of fee payment
438
438
  def fee_payment_purchased!(owner)
439
439
  raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
440
- owner.update_membership_status!
440
+ owner.update_membership_status! if owner.membership.present?
441
441
  end
442
442
 
443
443
  protected
@@ -45,7 +45,7 @@ module EffectiveMembershipsUser
45
45
  end
46
46
 
47
47
  def memberships_owners
48
- Array(is?(:member) ? self : nil) + membership_organizations
48
+ Array(self) + membership_organizations
49
49
  end
50
50
 
51
51
  def membership_present?
@@ -13,4 +13,6 @@
13
13
 
14
14
  = f.price_field :price
15
15
 
16
+ = f.text_field :qb_item_name
17
+
16
18
  = effective_submit(f)
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.7.2'
2
+ VERSION = '0.7.3'
3
3
  end
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.7.2
4
+ version: 0.7.3
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-09-16 00:00:00.000000000 Z
11
+ date: 2022-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails