effective_resources 2.19.4 → 2.19.5

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: b365b39892e978c7a35900f70e85222426a92211d7e3da6e4ce6d9f5ae7197f8
4
- data.tar.gz: 79e5f1843cf94a3f8e546873aed8bb7c6fbea7c4f023818560a1bdda0636ac34
3
+ metadata.gz: 18f56dd6a7835648efe65d8809611c96512caf3107d0287f28cc80b39155c1d6
4
+ data.tar.gz: 8b5185842adebc07719fc95b0a7b1669e1f0b5bd78ebdfed8051936cbdd55d6c
5
5
  SHA512:
6
- metadata.gz: 4d2030734d48d46173ab6e5a579b73fb0ae9a213a43068eada01188c204dc124c75fb040f62db0f06c4173417f20379215d62cd19d65c93baf2fb66c5a7629c4
7
- data.tar.gz: b874c2c803e4470d0b3655572b7d0897b7d36530299f2ce1da1f18a86d29b35e1b9258e4da634757eb8996c89abd331bae3a4da00e6c2c274c1642c8b6da883b
6
+ metadata.gz: 26af3e4f38cff93884b7d92aeb522db7350f2e25443ba24cdfa969f5f3b8b2992869bd58298f584ce229919b1066daaba22c8d478e18e0699ebd3771ac4b4b7d
7
+ data.tar.gz: d4583562b636737f806cbf349720d216e3fe02085fad7fa8961d5459c3a5a2af83a6ba03a3e32bc367ccfc6cfcef44558cc582a22d0e872a4dcdf4831b712034
@@ -125,7 +125,10 @@ 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
+
130
+ coupon_fees = find_or_build_coupon_fees(fees)
131
+ raise('already has purchased coupon fees') if Array(coupon_fees).any?(&:purchased?)
129
132
 
130
133
  order = find_or_build_submit_order()
131
134
  raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
@@ -135,6 +138,21 @@ module ActsAsPurchasableWizard
135
138
  true
136
139
  end
137
140
 
141
+ def find_or_build_coupon_fees(purchasables)
142
+ existing = purchasables.select { |purchasable| purchasable.try(:coupon_fee?) }
143
+ return existing if existing.present?
144
+
145
+ price = purchasables.map { |purchasable| purchasable.price || 0 }.sum
146
+ return [] unless price > 0
147
+
148
+ apply_outstanding_coupon_fees()
149
+ end
150
+
151
+ def apply_outstanding_coupon_fees
152
+ # Nothing to do.
153
+ # effective_events, effective_memberships override this method and opt-in to this behaviour
154
+ end
155
+
138
156
  # Owner clicks on the Billing step. Next step is Checkout
139
157
  def billing!
140
158
  ready! && save!
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.4'.freeze
2
+ VERSION = '2.19.5'.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.5
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