effective_resources 2.19.4 → 2.19.6

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: b365b39892e978c7a35900f70e85222426a92211d7e3da6e4ce6d9f5ae7197f8
4
- data.tar.gz: 79e5f1843cf94a3f8e546873aed8bb7c6fbea7c4f023818560a1bdda0636ac34
3
+ metadata.gz: 571ebcdbbca75cd1b0937bc814229321b1682f336f729517689b9ae594aa9758
4
+ data.tar.gz: 1b606b2566f0f1eb5ef9a2d5764df5ce1606aa25f8c8f6144a84f14978624479
5
5
  SHA512:
6
- metadata.gz: 4d2030734d48d46173ab6e5a579b73fb0ae9a213a43068eada01188c204dc124c75fb040f62db0f06c4173417f20379215d62cd19d65c93baf2fb66c5a7629c4
7
- data.tar.gz: b874c2c803e4470d0b3655572b7d0897b7d36530299f2ce1da1f18a86d29b35e1b9258e4da634757eb8996c89abd331bae3a4da00e6c2c274c1642c8b6da883b
6
+ metadata.gz: 634a2b8f2ca6a4d8a311b347365a16bd60bc9a2f2d2c99400cef5e96c61acfe4907befa97f74b0857d1deed9cdc73c6e2b639368870ff7d1816ec27460961807
7
+ data.tar.gz: c40344256152ca4a273dce2c580d3d0703d08fd79e4e0283d4112bc02a63bbb584e717ad8e5785ad23b43ee862b3374b84f9c0542c3160cfe0c2f8fa7b6a0d91
@@ -125,7 +125,7 @@ module ActsAsPurchasableWizard
125
125
  return false if was_submitted?
126
126
 
127
127
  fees = find_or_build_submit_fees()
128
- raise('already has purchased submit fees') if fees.any?(&:purchased?)
128
+ raise('already has purchased submit fees') if Array(fees).any?(&:purchased?)
129
129
 
130
130
  order = find_or_build_submit_order()
131
131
  raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
@@ -135,6 +135,22 @@ module ActsAsPurchasableWizard
135
135
  true
136
136
  end
137
137
 
138
+ # Called by effective_memberships and effective_events
139
+ def with_outstanding_coupon_fees(purchasables)
140
+ return purchasables unless owner.respond_to?(:outstanding_coupon_fees) # effective_memberships_owner
141
+ raise('expected has_many fees') unless respond_to?(:fees)
142
+
143
+ price = purchasables.reject { |p| p.try(:coupon_fee?) }.map { |p| p.price || 0 }.sum
144
+
145
+ if price > 0
146
+ Array(owner.outstanding_coupon_fees).each { |fee| fees << fee unless fees.include?(fee) }
147
+ else
148
+ Array(owner.outstanding_coupon_fees).each { |fee| fees.delete(fee) if fees.include?(fee) }
149
+ end
150
+
151
+ (purchasables + fees).uniq
152
+ end
153
+
138
154
  # Owner clicks on the Billing step. Next step is Checkout
139
155
  def billing!
140
156
  ready! && save!
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.4'.freeze
2
+ VERSION = '2.19.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.4
4
+ version: 2.19.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: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails