spree_cm_commissioner 2.15.3 → 2.15.4
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9729da447b28b6f2e0beafb9333442257c6d9efb60a317dd8012810248085654
|
|
4
|
+
data.tar.gz: 5ff7d533406299db932f42c402b26e495d2e4127859611291344248083b7f1dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 014cf7cea9a4d55083a537cbcc4e9c4afa529edaf8fb8468b078200ccd92342991e050c58ffd139e8409cc1e85d08b0fa54214cac356ca2e93367f278527f295
|
|
7
|
+
data.tar.gz: 1312f2a920a682b616b907687576ea6e8a9b9170780270e4d41853fa343865645f93406bd88bd32ce86b0d8cef012e5c04d9e5a4bf5167cfcc6ff0c0bb787a5a
|
data/Gemfile.lock
CHANGED
|
@@ -10,6 +10,10 @@ module SpreeCmCommissioner
|
|
|
10
10
|
def call
|
|
11
11
|
return true if already_canceled?
|
|
12
12
|
|
|
13
|
+
# Every canceled order lands here, but only paid vote packages get a `purchase` transaction
|
|
14
|
+
# (free-claim packages record `free_claim` only), so anything else has nothing to refund.
|
|
15
|
+
return true unless paid_vote_line_items?
|
|
16
|
+
|
|
13
17
|
# DeAllocate#call
|
|
14
18
|
# → purchase_transaction_exists? → false
|
|
15
19
|
# → raise RuntimeError
|
|
@@ -41,6 +45,13 @@ module SpreeCmCommissioner
|
|
|
41
45
|
false
|
|
42
46
|
end
|
|
43
47
|
|
|
48
|
+
def paid_vote_line_items?
|
|
49
|
+
order.line_items
|
|
50
|
+
.joins(variant: :product)
|
|
51
|
+
.where(spree_products: { type: SpreeCmCommissioner::ShowEpisode.name, product_type: :vote_package })
|
|
52
|
+
.any? { |line_item| !line_item.product.claimable_vote_package }
|
|
53
|
+
end
|
|
54
|
+
|
|
44
55
|
def purchase_transaction_exists?
|
|
45
56
|
SpreeCmCommissioner::VotingCreditTransaction.exists?(
|
|
46
57
|
idempotency_key: "#{order.number}::purchase"
|