shopify-gold 3.1.5 → 3.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b25280b1c511ebf2f9e0764bffdf3583af068260d3a9e08a46d4327c5dca52f1
|
4
|
+
data.tar.gz: 97dd3fc9a7854145683a0b3e85a2ff935e1be8b5d495d193c8ad8d163701359d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab1f2a8fff58ee961ccb0f573ab69ca53dd5638bd8065d3e8fe4e125b76c445221356152c58426bd5b557a5df3100bf581809eca8c8deabd2b162a2bed794467
|
7
|
+
data.tar.gz: ab03be2a520dc46553f27727e33aa46bf8e8b6fe6be7b5ac3992e4ade0841da107e978671c8570bf14c2c4a9eadbc92878faa78245e98719e92a215c9587e2df
|
@@ -103,8 +103,7 @@ module Gold
|
|
103
103
|
|
104
104
|
# Unsuspend a shop
|
105
105
|
def unsuspend
|
106
|
-
UnsuspendOp.new(billing).call
|
107
|
-
outcome = CheckChargeOp.new(billing).call
|
106
|
+
outcome = UnsuspendOp.new(billing).call
|
108
107
|
|
109
108
|
Gold::ChargeOp.new(billing, process_charge_url).call unless outcome.ok?
|
110
109
|
|
data/app/models/gold/machine.rb
CHANGED
@@ -122,13 +122,19 @@ module Gold
|
|
122
122
|
# Ensure that a shop has a certain type of plan before allowing a transition.
|
123
123
|
def self.ensure_plan_is(query_method)
|
124
124
|
test = proc { |billing| billing.shopify_plan.send(query_method) }
|
125
|
-
test.define_singleton_method(:to_s) { "Billing is #{query_method}" }
|
125
|
+
test.define_singleton_method(:to_s) { "Billing is #{query_method}?" }
|
126
126
|
test
|
127
127
|
end
|
128
128
|
|
129
129
|
def self.ensure_tier_is_not_free
|
130
130
|
test = proc { |billing| !billing.tier&.free? }
|
131
|
-
test.define_singleton_method(:to_s) { "Tier is not free" }
|
131
|
+
test.define_singleton_method(:to_s) { "Tier is not free?" }
|
132
|
+
test
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.ensure_tier_is_free
|
136
|
+
test = proc { |billing| billing.tier&.free? }
|
137
|
+
test.define_singleton_method(:to_s) { "Tier is free?" }
|
132
138
|
test
|
133
139
|
end
|
134
140
|
|
@@ -196,7 +202,7 @@ module Gold
|
|
196
202
|
issue_credit
|
197
203
|
marked_as_suspended
|
198
204
|
marked_as_uninstalled]
|
199
|
-
|
205
|
+
guard_transition to: :check_charge, &ensure_tier_is_not_free
|
200
206
|
transition from: :check_charge, to: %i[check_charge
|
201
207
|
billing
|
202
208
|
charge_missing
|
@@ -276,7 +282,9 @@ module Gold
|
|
276
282
|
transition from: :marked_as_suspended, to: :suspended
|
277
283
|
transition from: :suspended, to: %i[affiliate
|
278
284
|
check_charge
|
285
|
+
billing
|
279
286
|
cleanup]
|
287
|
+
guard_transition from: :suspended, to: :billing, &ensure_tier_is_free
|
280
288
|
|
281
289
|
transition from: :marked_as_uninstalled, to: %i[uninstalled]
|
282
290
|
transition from: :uninstalled, to: %i[cleanup reinstalled]
|
@@ -8,13 +8,15 @@ module Gold
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call
|
11
|
-
|
12
|
-
|
11
|
+
# Transition to appropriate location
|
12
|
+
if @billing.transition_to(:affiliate)
|
13
|
+
Success.new
|
14
|
+
elsif @billing.transition_to(:check_charge)
|
15
|
+
CheckChargeOp.new(@billing).call
|
13
16
|
else
|
14
|
-
@billing.transition_to!(:
|
17
|
+
@billing.transition_to!(:billing)
|
18
|
+
Success.new
|
15
19
|
end
|
16
|
-
|
17
|
-
Success.new
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
data/lib/gold/version.rb
CHANGED
data/lib/tasks/gold_tasks.rake
CHANGED
@@ -54,7 +54,9 @@ namespace :gold do
|
|
54
54
|
billing.shop.with_shopify_session do
|
55
55
|
outcome = Gold::CheckChargeOp.new(billing).call
|
56
56
|
|
57
|
-
|
57
|
+
if outcome.ok?
|
58
|
+
print "✅"
|
59
|
+
else
|
58
60
|
puts "Check charge for shop '#{billing.shop.shopify_domain}': #{outcome}"
|
59
61
|
Gold::ChargeOp.new(billing,
|
60
62
|
Gold::Engine.routes.url_helpers.process_charge_url).call
|