effective_resources 2.19.5 → 2.19.6
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 +4 -4
- data/app/models/concerns/acts_as_purchasable_wizard.rb +11 -13
- data/lib/effective_resources/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571ebcdbbca75cd1b0937bc814229321b1682f336f729517689b9ae594aa9758
|
4
|
+
data.tar.gz: 1b606b2566f0f1eb5ef9a2d5764df5ce1606aa25f8c8f6144a84f14978624479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 634a2b8f2ca6a4d8a311b347365a16bd60bc9a2f2d2c99400cef5e96c61acfe4907befa97f74b0857d1deed9cdc73c6e2b639368870ff7d1816ec27460961807
|
7
|
+
data.tar.gz: c40344256152ca4a273dce2c580d3d0703d08fd79e4e0283d4112bc02a63bbb584e717ad8e5785ad23b43ee862b3374b84f9c0542c3160cfe0c2f8fa7b6a0d91
|
@@ -127,9 +127,6 @@ module ActsAsPurchasableWizard
|
|
127
127
|
fees = find_or_build_submit_fees()
|
128
128
|
raise('already has purchased submit fees') if Array(fees).any?(&:purchased?)
|
129
129
|
|
130
|
-
coupon_fees = find_or_build_coupon_fees(fees)
|
131
|
-
raise('already has purchased coupon fees') if Array(coupon_fees).any?(&:purchased?)
|
132
|
-
|
133
130
|
order = find_or_build_submit_order()
|
134
131
|
raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
|
135
132
|
raise('already has purchased submit order') if order.purchased?
|
@@ -138,19 +135,20 @@ module ActsAsPurchasableWizard
|
|
138
135
|
true
|
139
136
|
end
|
140
137
|
|
141
|
-
|
142
|
-
|
143
|
-
return
|
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)
|
144
142
|
|
145
|
-
price = purchasables.map { |
|
146
|
-
return [] unless price > 0
|
143
|
+
price = purchasables.reject { |p| p.try(:coupon_fee?) }.map { |p| p.price || 0 }.sum
|
147
144
|
|
148
|
-
|
149
|
-
|
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
150
|
|
151
|
-
|
152
|
-
# Nothing to do.
|
153
|
-
# effective_events, effective_memberships override this method and opt-in to this behaviour
|
151
|
+
(purchasables + fees).uniq
|
154
152
|
end
|
155
153
|
|
156
154
|
# Owner clicks on the Billing step. Next step is Checkout
|