app_manager 1.6.3 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +121 -86
- data/app/controllers/app_manager/charges_controller.rb +2 -2
- data/lib/app_manager/fail_safe.rb +5 -0
- data/lib/app_manager/graphql_helper.rb +19 -3
- data/lib/app_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939c279b78c14a7e781d74177e6df92a287a2e463d6c3af39346760e6891115b
|
4
|
+
data.tar.gz: 9a3abefe3f42d4c40b34d597a0b850d128afbff33094cbe8ddf06b66dd473fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769614783e6d231a4b75303003b8da1143787d10cae09f093647bfeb6b246c28d4e604255a23530ad6332cad3d6796cec7fd99a80a3b5c46c8d74660f8dd17ee
|
7
|
+
data.tar.gz: da7329819695c265587a36c8c34ef922176e5fd40a5109acd88849695bbbf1143eff43d2d699f08c044d90eaf58bb3f45ea5f5ec09fbbc9c5d34bcb2c980b6b9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
app_manager (1.
|
4
|
+
app_manager (1.7.0)
|
5
5
|
activerecord-import (~> 1.4)
|
6
6
|
httparty
|
7
7
|
kaminari (>= 0.16.3)
|
@@ -10,93 +10,111 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (7.
|
14
|
-
actionpack (= 7.
|
15
|
-
activesupport (= 7.
|
13
|
+
actioncable (7.1.2)
|
14
|
+
actionpack (= 7.1.2)
|
15
|
+
activesupport (= 7.1.2)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
zeitwerk (~> 2.6)
|
19
|
+
actionmailbox (7.1.2)
|
20
|
+
actionpack (= 7.1.2)
|
21
|
+
activejob (= 7.1.2)
|
22
|
+
activerecord (= 7.1.2)
|
23
|
+
activestorage (= 7.1.2)
|
24
|
+
activesupport (= 7.1.2)
|
24
25
|
mail (>= 2.7.1)
|
25
26
|
net-imap
|
26
27
|
net-pop
|
27
28
|
net-smtp
|
28
|
-
actionmailer (7.
|
29
|
-
actionpack (= 7.
|
30
|
-
actionview (= 7.
|
31
|
-
activejob (= 7.
|
32
|
-
activesupport (= 7.
|
29
|
+
actionmailer (7.1.2)
|
30
|
+
actionpack (= 7.1.2)
|
31
|
+
actionview (= 7.1.2)
|
32
|
+
activejob (= 7.1.2)
|
33
|
+
activesupport (= 7.1.2)
|
33
34
|
mail (~> 2.5, >= 2.5.4)
|
34
35
|
net-imap
|
35
36
|
net-pop
|
36
37
|
net-smtp
|
37
|
-
rails-dom-testing (~> 2.
|
38
|
-
actionpack (7.
|
39
|
-
actionview (= 7.
|
40
|
-
activesupport (= 7.
|
41
|
-
|
38
|
+
rails-dom-testing (~> 2.2)
|
39
|
+
actionpack (7.1.2)
|
40
|
+
actionview (= 7.1.2)
|
41
|
+
activesupport (= 7.1.2)
|
42
|
+
nokogiri (>= 1.8.5)
|
43
|
+
racc
|
44
|
+
rack (>= 2.2.4)
|
45
|
+
rack-session (>= 1.0.1)
|
42
46
|
rack-test (>= 0.6.3)
|
43
|
-
rails-dom-testing (~> 2.
|
44
|
-
rails-html-sanitizer (~> 1.
|
45
|
-
actiontext (7.
|
46
|
-
actionpack (= 7.
|
47
|
-
activerecord (= 7.
|
48
|
-
activestorage (= 7.
|
49
|
-
activesupport (= 7.
|
47
|
+
rails-dom-testing (~> 2.2)
|
48
|
+
rails-html-sanitizer (~> 1.6)
|
49
|
+
actiontext (7.1.2)
|
50
|
+
actionpack (= 7.1.2)
|
51
|
+
activerecord (= 7.1.2)
|
52
|
+
activestorage (= 7.1.2)
|
53
|
+
activesupport (= 7.1.2)
|
50
54
|
globalid (>= 0.6.0)
|
51
55
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.
|
53
|
-
activesupport (= 7.
|
56
|
+
actionview (7.1.2)
|
57
|
+
activesupport (= 7.1.2)
|
54
58
|
builder (~> 3.1)
|
55
|
-
erubi (~> 1.
|
56
|
-
rails-dom-testing (~> 2.
|
57
|
-
rails-html-sanitizer (~> 1.
|
58
|
-
activejob (7.
|
59
|
-
activesupport (= 7.
|
59
|
+
erubi (~> 1.11)
|
60
|
+
rails-dom-testing (~> 2.2)
|
61
|
+
rails-html-sanitizer (~> 1.6)
|
62
|
+
activejob (7.1.2)
|
63
|
+
activesupport (= 7.1.2)
|
60
64
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.
|
62
|
-
activesupport (= 7.
|
63
|
-
activerecord (7.
|
64
|
-
activemodel (= 7.
|
65
|
-
activesupport (= 7.
|
66
|
-
|
65
|
+
activemodel (7.1.2)
|
66
|
+
activesupport (= 7.1.2)
|
67
|
+
activerecord (7.1.2)
|
68
|
+
activemodel (= 7.1.2)
|
69
|
+
activesupport (= 7.1.2)
|
70
|
+
timeout (>= 0.4.0)
|
71
|
+
activerecord-import (1.5.1)
|
67
72
|
activerecord (>= 4.2)
|
68
|
-
activestorage (7.
|
69
|
-
actionpack (= 7.
|
70
|
-
activejob (= 7.
|
71
|
-
activerecord (= 7.
|
72
|
-
activesupport (= 7.
|
73
|
+
activestorage (7.1.2)
|
74
|
+
actionpack (= 7.1.2)
|
75
|
+
activejob (= 7.1.2)
|
76
|
+
activerecord (= 7.1.2)
|
77
|
+
activesupport (= 7.1.2)
|
73
78
|
marcel (~> 1.0)
|
74
|
-
|
75
|
-
|
79
|
+
activesupport (7.1.2)
|
80
|
+
base64
|
81
|
+
bigdecimal
|
76
82
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
83
|
+
connection_pool (>= 2.2.5)
|
84
|
+
drb
|
77
85
|
i18n (>= 1.6, < 2)
|
78
86
|
minitest (>= 5.1)
|
87
|
+
mutex_m
|
79
88
|
tzinfo (~> 2.0)
|
80
89
|
addressable (2.8.0)
|
81
90
|
public_suffix (>= 2.0.2, < 5.0)
|
91
|
+
base64 (0.2.0)
|
92
|
+
bigdecimal (3.1.5)
|
82
93
|
builder (3.2.4)
|
83
94
|
coderay (1.1.3)
|
84
95
|
concurrent-ruby (1.2.2)
|
96
|
+
connection_pool (2.4.1)
|
85
97
|
crack (0.4.5)
|
86
98
|
rexml
|
87
99
|
crass (1.0.6)
|
88
|
-
date (3.3.
|
100
|
+
date (3.3.4)
|
89
101
|
diff-lcs (1.5.0)
|
90
102
|
dotenv (2.1.2)
|
103
|
+
drb (2.2.0)
|
104
|
+
ruby2_keywords
|
91
105
|
erubi (1.12.0)
|
92
|
-
globalid (1.1
|
93
|
-
activesupport (>=
|
106
|
+
globalid (1.2.1)
|
107
|
+
activesupport (>= 6.1)
|
94
108
|
hashdiff (1.0.1)
|
95
109
|
httparty (0.21.0)
|
96
110
|
mini_mime (>= 1.0.0)
|
97
111
|
multi_xml (>= 0.5.2)
|
98
112
|
i18n (1.14.1)
|
99
113
|
concurrent-ruby (~> 1.0)
|
114
|
+
io-console (0.7.1)
|
115
|
+
irb (1.11.0)
|
116
|
+
rdoc
|
117
|
+
reline (>= 0.3.8)
|
100
118
|
kaminari (1.2.2)
|
101
119
|
activesupport (>= 4.1.0)
|
102
120
|
kaminari-actionview (= 1.2.2)
|
@@ -109,7 +127,7 @@ GEM
|
|
109
127
|
activerecord
|
110
128
|
kaminari-core (= 1.2.2)
|
111
129
|
kaminari-core (1.2.2)
|
112
|
-
loofah (2.
|
130
|
+
loofah (2.22.0)
|
113
131
|
crass (~> 1.0.2)
|
114
132
|
nokogiri (>= 1.12.0)
|
115
133
|
mail (2.8.1)
|
@@ -119,59 +137,73 @@ GEM
|
|
119
137
|
net-smtp
|
120
138
|
marcel (1.0.2)
|
121
139
|
method_source (1.0.0)
|
122
|
-
mini_mime (1.1.
|
123
|
-
mini_portile2 (2.8.
|
124
|
-
minitest (5.
|
140
|
+
mini_mime (1.1.5)
|
141
|
+
mini_portile2 (2.8.5)
|
142
|
+
minitest (5.20.0)
|
125
143
|
multi_xml (0.6.0)
|
126
|
-
|
144
|
+
mutex_m (0.2.0)
|
145
|
+
net-imap (0.3.7)
|
127
146
|
date
|
128
147
|
net-protocol
|
129
148
|
net-pop (0.1.2)
|
130
149
|
net-protocol
|
131
|
-
net-protocol (0.2.
|
150
|
+
net-protocol (0.2.2)
|
132
151
|
timeout
|
133
|
-
net-smtp (0.
|
152
|
+
net-smtp (0.4.0.1)
|
134
153
|
net-protocol
|
135
|
-
nio4r (2.
|
136
|
-
nokogiri (1.15.
|
154
|
+
nio4r (2.7.0)
|
155
|
+
nokogiri (1.15.5)
|
137
156
|
mini_portile2 (~> 2.8.2)
|
138
157
|
racc (~> 1.4)
|
139
158
|
pry (0.14.1)
|
140
159
|
coderay (~> 1.1)
|
141
160
|
method_source (~> 1.0)
|
161
|
+
psych (5.1.2)
|
162
|
+
stringio
|
142
163
|
public_suffix (4.0.6)
|
143
|
-
racc (1.7.
|
144
|
-
rack (
|
164
|
+
racc (1.7.3)
|
165
|
+
rack (3.0.8)
|
166
|
+
rack-session (2.0.0)
|
167
|
+
rack (>= 3.0.0)
|
145
168
|
rack-test (2.1.0)
|
146
169
|
rack (>= 1.3)
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
170
|
+
rackup (2.1.0)
|
171
|
+
rack (>= 3)
|
172
|
+
webrick (~> 1.8)
|
173
|
+
rails (7.1.2)
|
174
|
+
actioncable (= 7.1.2)
|
175
|
+
actionmailbox (= 7.1.2)
|
176
|
+
actionmailer (= 7.1.2)
|
177
|
+
actionpack (= 7.1.2)
|
178
|
+
actiontext (= 7.1.2)
|
179
|
+
actionview (= 7.1.2)
|
180
|
+
activejob (= 7.1.2)
|
181
|
+
activemodel (= 7.1.2)
|
182
|
+
activerecord (= 7.1.2)
|
183
|
+
activestorage (= 7.1.2)
|
184
|
+
activesupport (= 7.1.2)
|
159
185
|
bundler (>= 1.15.0)
|
160
|
-
railties (= 7.
|
161
|
-
rails-dom-testing (2.0
|
162
|
-
activesupport (>=
|
186
|
+
railties (= 7.1.2)
|
187
|
+
rails-dom-testing (2.2.0)
|
188
|
+
activesupport (>= 5.0.0)
|
189
|
+
minitest
|
163
190
|
nokogiri (>= 1.6)
|
164
191
|
rails-html-sanitizer (1.6.0)
|
165
192
|
loofah (~> 2.21)
|
166
193
|
nokogiri (~> 1.14)
|
167
|
-
railties (7.
|
168
|
-
actionpack (= 7.
|
169
|
-
activesupport (= 7.
|
170
|
-
|
194
|
+
railties (7.1.2)
|
195
|
+
actionpack (= 7.1.2)
|
196
|
+
activesupport (= 7.1.2)
|
197
|
+
irb
|
198
|
+
rackup (>= 1.0.0)
|
171
199
|
rake (>= 12.2)
|
172
|
-
thor (~> 1.0)
|
173
|
-
zeitwerk (~> 2.
|
200
|
+
thor (~> 1.0, >= 1.2.2)
|
201
|
+
zeitwerk (~> 2.6)
|
174
202
|
rake (13.0.6)
|
203
|
+
rdoc (6.6.2)
|
204
|
+
psych (>= 4.0.0)
|
205
|
+
reline (0.4.2)
|
206
|
+
io-console (~> 0.5)
|
175
207
|
rexml (3.2.5)
|
176
208
|
rspec (3.11.0)
|
177
209
|
rspec-core (~> 3.11.0)
|
@@ -188,18 +220,21 @@ GEM
|
|
188
220
|
diff-lcs (>= 1.2.0, < 2.0)
|
189
221
|
rspec-support (~> 3.11.0)
|
190
222
|
rspec-support (3.11.0)
|
191
|
-
|
192
|
-
|
223
|
+
ruby2_keywords (0.0.5)
|
224
|
+
stringio (3.1.0)
|
225
|
+
thor (1.3.0)
|
226
|
+
timeout (0.4.1)
|
193
227
|
tzinfo (2.0.6)
|
194
228
|
concurrent-ruby (~> 1.0)
|
195
229
|
webmock (3.14.0)
|
196
230
|
addressable (>= 2.8.0)
|
197
231
|
crack (>= 0.3.2)
|
198
232
|
hashdiff (>= 0.4.0, < 2.0.0)
|
199
|
-
|
233
|
+
webrick (1.8.1)
|
234
|
+
websocket-driver (0.7.6)
|
200
235
|
websocket-extensions (>= 0.1.0)
|
201
236
|
websocket-extensions (0.1.5)
|
202
|
-
zeitwerk (2.6.
|
237
|
+
zeitwerk (2.6.12)
|
203
238
|
|
204
239
|
PLATFORMS
|
205
240
|
ruby
|
@@ -61,14 +61,14 @@ module AppManager
|
|
61
61
|
return_url = "#{app_url}#{plan_callback_path}?#{Rack::Utils.build_query(request_data)}"
|
62
62
|
gq_obj = AppManager::GraphqlHelper.new(@shop.shopify_domain, @shop.shopify_token)
|
63
63
|
data = gq_obj.recurring_charge_api_call(plan_data, return_url, @shop)
|
64
|
-
if !data["errors"].present? && (data["data"].present? && data["data"]["appSubscriptionCreate"].present? && (!data["data"]["appSubscriptionCreate"]["userErrors"].any? && data["data"]["appSubscriptionCreate"]["confirmationUrl"]))
|
64
|
+
if data.present? && !data["errors"].present? && (data["data"].present? && data["data"]["appSubscriptionCreate"].present? && (!data["data"]["appSubscriptionCreate"]["userErrors"].any? && data["data"]["appSubscriptionCreate"]["confirmationUrl"]))
|
65
65
|
redirect_charge = data["data"]["appSubscriptionCreate"]["confirmationUrl"]
|
66
66
|
render json: {'redirect_url' => redirect_charge}
|
67
67
|
else
|
68
68
|
raise Error, "#{data.inspect}"
|
69
69
|
end
|
70
70
|
else
|
71
|
-
raise Error, "
|
71
|
+
raise Error, "Plan not found"
|
72
72
|
end
|
73
73
|
else
|
74
74
|
raise ModelNotFound, "Shop not found"
|
@@ -262,6 +262,9 @@ module AppManager
|
|
262
262
|
value = eval(value)
|
263
263
|
value = value.each { |e| e.delete("id") }.each { |e| e.delete("created_at") }.each { |e| e.delete("updated_at") }
|
264
264
|
new_plan[key] = value
|
265
|
+
elsif ['plan_id'].include?(key)
|
266
|
+
# puts value.inspect
|
267
|
+
new_plan["id"] = value if value rescue {}
|
265
268
|
else
|
266
269
|
new_plan[key] = value unless key.class == Integer
|
267
270
|
end
|
@@ -350,6 +353,8 @@ module AppManager
|
|
350
353
|
new_plan[key] = (value == 0 || value == false ? false : true)
|
351
354
|
elsif ['test'].include?(key)
|
352
355
|
new_plan[key] = (value == 0 || value == false ? nil : true)
|
356
|
+
elsif ['plan_id'].include?(key)
|
357
|
+
new_plan["id"] = value if value rescue nil
|
353
358
|
else
|
354
359
|
new_plan[key] = value unless key.class == Integer
|
355
360
|
end
|
@@ -33,7 +33,7 @@ module AppManager
|
|
33
33
|
response = ActiveSupport::JSON.decode(response.read_body) rescue nil
|
34
34
|
return response
|
35
35
|
else
|
36
|
-
Rollbar.error("=== params missing from any of these api_key, api_version, shopify_domain, shopify_token
|
36
|
+
Rollbar.error("=== params missing from any of these api_key=#{@api_key}, api_version=#{@api_version}, shopify_domain=#{@shopify_domain}, shopify_token ===#{@shopify_token}")
|
37
37
|
return []
|
38
38
|
end
|
39
39
|
end
|
@@ -84,8 +84,24 @@ module AppManager
|
|
84
84
|
|
85
85
|
discount_type = plan['discount_type'] || "percentage"
|
86
86
|
discount_val = discount_type == "percentage" ? (plan['discount'].to_f/ 100) : "#{plan['discount']}"
|
87
|
-
|
88
|
-
|
87
|
+
if !@api_version.nil? && @api_version.to_s.include?('2024')
|
88
|
+
plan_discount = if plan['discount'] && plan['cycle_count']
|
89
|
+
{
|
90
|
+
"discount" => { "durationLimitInIntervals" => (plan['cycle_count'].to_i),
|
91
|
+
"value" => {"#{discount_type}" => discount_val}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
elsif plan['discount']
|
95
|
+
{
|
96
|
+
"discount" => { "value" => {"#{discount_type}" => discount_val}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
else
|
100
|
+
{}
|
101
|
+
end
|
102
|
+
else
|
103
|
+
plan_discount = plan['discount'] ? { "discount" => { "durationLimitInIntervals" => (plan['cycle_count'].to_i), "value" => {"#{discount_type}" => discount_val} } } : {}
|
104
|
+
end
|
89
105
|
price_details = {
|
90
106
|
"price": { "amount": plan['price'], "currencyCode": 'USD' },
|
91
107
|
"interval": plan['interval']['value']
|
data/lib/app_manager/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Tiwari @ Hulkapps
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|