effective_orders 4.5.1 → 4.5.2
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: 36b254eb8e99a4c04b3b63135b2b1caa15f5a8d7803bcad0fff8323b0aab957a
|
4
|
+
data.tar.gz: 699ccd522afef972528e9dcee5b5eae8abad124cf11e0002f84e5c7a06bf0e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 784ec95030d906ab226f26d7f50651062979a3e50fdf286135fc81e3907d6bc23a93c77e1504433012ea59e49bcb4613702723b69a9fe58b858fd36a15ae1590
|
7
|
+
data.tar.gz: 7f1cf4534c235f84a025a040b2988fcfa8664046d7026de8665f4c14b139afdbd570a4491ffb46ade0d5ba40f80bd6403064f6de6aa5fa4e3ace5e1032331f83
|
@@ -14,11 +14,13 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
14
14
|
end
|
15
15
|
|
16
16
|
filters do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
if attributes[:user_id].blank? && attributes[:parent_id].blank?
|
18
|
+
scope :purchased, default: true
|
19
|
+
scope :deferred
|
20
|
+
scope :refunds
|
21
|
+
scope :not_purchased
|
22
|
+
scope :all
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
datatable do
|
@@ -43,6 +45,8 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
43
45
|
col :email, visible: false
|
44
46
|
end
|
45
47
|
|
48
|
+
col :parent, visible: false, search: :string
|
49
|
+
|
46
50
|
col :cc, visible: false
|
47
51
|
|
48
52
|
if EffectiveOrders.billing_address
|
@@ -90,6 +94,10 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
90
94
|
scope = scope.where(user: user)
|
91
95
|
end
|
92
96
|
|
97
|
+
if attributes[:parent_id].present? && attributes[:parent_type].present?
|
98
|
+
scope = scope.where(parent_id: attributes[:parent_id], parent_type: attributes[:parent_type])
|
99
|
+
end
|
100
|
+
|
93
101
|
scope
|
94
102
|
end
|
95
103
|
|
@@ -21,6 +21,8 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
21
21
|
'#' + order.to_param
|
22
22
|
end
|
23
23
|
|
24
|
+
col :parent, visible: false, search: :string
|
25
|
+
|
24
26
|
unless attributes[:not_purchased]
|
25
27
|
col :purchased_at do |order|
|
26
28
|
order.purchased_at&.strftime('%F %H:%M') || 'not purchased'
|
@@ -69,6 +71,10 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
69
71
|
scope = scope.not_purchased
|
70
72
|
end
|
71
73
|
|
74
|
+
if attributes[:parent_id].present? && attributes[:parent_type].present?
|
75
|
+
scope = scope.where(parent_id: attributes[:parent_id], parent_type: attributes[:parent_type])
|
76
|
+
end
|
77
|
+
|
72
78
|
scope
|
73
79
|
end
|
74
80
|
|
@@ -225,6 +225,24 @@ module Effective
|
|
225
225
|
retval.size == 1 ? retval.first : retval
|
226
226
|
end
|
227
227
|
|
228
|
+
|
229
|
+
def update_prices!
|
230
|
+
raise('already purchased') if purchased?
|
231
|
+
raise('must be pending') unless pending?
|
232
|
+
|
233
|
+
order_items.each do |item|
|
234
|
+
purchasable = item.purchasable
|
235
|
+
|
236
|
+
if purchasable.blank? || purchasable.marked_for_destruction?
|
237
|
+
item.mark_for_destruction
|
238
|
+
else
|
239
|
+
item.price = purchasable.price
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
save!
|
244
|
+
end
|
245
|
+
|
228
246
|
def to_s
|
229
247
|
if refund?
|
230
248
|
"Refund ##{to_param}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.2
|
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: 2020-07-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|