app_manager 1.5.0 → 1.6.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 +63 -61
- data/README.md +10 -2
- data/app_manager.gemspec +1 -1
- data/lib/app_manager/graphql_helper.rb +16 -0
- data/lib/app_manager/model.rb +136 -0
- data/lib/app_manager/version.rb +1 -1
- data/lib/generators/app_manager/install/templates/add_external_charge_field.erb +1 -1
- data/lib/generators/app_manager/install/templates/app_manager.rb.tt +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd3e056fce2196e44c5eb349cd910cf80a7d94bac2530a957c88bb3c5799685
|
4
|
+
data.tar.gz: 80ae23cafeb5680a542e3abe6050b9663e3407c395a0f293aea0b4815575ef17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3fc7ee4d7b213c658229d352234a4d43732fd8adc25685e58f3e16bceec6384b8c7dab4b51974c89cf59eba4ce6781aad7afa1638a41f20207957a08b937cd8
|
7
|
+
data.tar.gz: f1a631d14d3ef1633a773bff3a5bbda2b93f612703086caec1fddf36a2cf2901154422ccbd7ff17badc38de59e9f5ece5ce883b90b9b8b20b20988655265807a
|
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.6.0)
|
5
5
|
activerecord-import (~> 1.4)
|
6
6
|
httparty
|
7
7
|
kaminari (>= 0.16.3)
|
@@ -10,69 +10,69 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (7.0.4)
|
14
|
-
actionpack (= 7.0.4)
|
15
|
-
activesupport (= 7.0.4)
|
13
|
+
actioncable (7.0.4.2)
|
14
|
+
actionpack (= 7.0.4.2)
|
15
|
+
activesupport (= 7.0.4.2)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (7.0.4)
|
19
|
-
actionpack (= 7.0.4)
|
20
|
-
activejob (= 7.0.4)
|
21
|
-
activerecord (= 7.0.4)
|
22
|
-
activestorage (= 7.0.4)
|
23
|
-
activesupport (= 7.0.4)
|
18
|
+
actionmailbox (7.0.4.2)
|
19
|
+
actionpack (= 7.0.4.2)
|
20
|
+
activejob (= 7.0.4.2)
|
21
|
+
activerecord (= 7.0.4.2)
|
22
|
+
activestorage (= 7.0.4.2)
|
23
|
+
activesupport (= 7.0.4.2)
|
24
24
|
mail (>= 2.7.1)
|
25
25
|
net-imap
|
26
26
|
net-pop
|
27
27
|
net-smtp
|
28
|
-
actionmailer (7.0.4)
|
29
|
-
actionpack (= 7.0.4)
|
30
|
-
actionview (= 7.0.4)
|
31
|
-
activejob (= 7.0.4)
|
32
|
-
activesupport (= 7.0.4)
|
28
|
+
actionmailer (7.0.4.2)
|
29
|
+
actionpack (= 7.0.4.2)
|
30
|
+
actionview (= 7.0.4.2)
|
31
|
+
activejob (= 7.0.4.2)
|
32
|
+
activesupport (= 7.0.4.2)
|
33
33
|
mail (~> 2.5, >= 2.5.4)
|
34
34
|
net-imap
|
35
35
|
net-pop
|
36
36
|
net-smtp
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
|
-
actionpack (7.0.4)
|
39
|
-
actionview (= 7.0.4)
|
40
|
-
activesupport (= 7.0.4)
|
38
|
+
actionpack (7.0.4.2)
|
39
|
+
actionview (= 7.0.4.2)
|
40
|
+
activesupport (= 7.0.4.2)
|
41
41
|
rack (~> 2.0, >= 2.2.0)
|
42
42
|
rack-test (>= 0.6.3)
|
43
43
|
rails-dom-testing (~> 2.0)
|
44
44
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
45
|
-
actiontext (7.0.4)
|
46
|
-
actionpack (= 7.0.4)
|
47
|
-
activerecord (= 7.0.4)
|
48
|
-
activestorage (= 7.0.4)
|
49
|
-
activesupport (= 7.0.4)
|
45
|
+
actiontext (7.0.4.2)
|
46
|
+
actionpack (= 7.0.4.2)
|
47
|
+
activerecord (= 7.0.4.2)
|
48
|
+
activestorage (= 7.0.4.2)
|
49
|
+
activesupport (= 7.0.4.2)
|
50
50
|
globalid (>= 0.6.0)
|
51
51
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.0.4)
|
53
|
-
activesupport (= 7.0.4)
|
52
|
+
actionview (7.0.4.2)
|
53
|
+
activesupport (= 7.0.4.2)
|
54
54
|
builder (~> 3.1)
|
55
55
|
erubi (~> 1.4)
|
56
56
|
rails-dom-testing (~> 2.0)
|
57
57
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
58
|
-
activejob (7.0.4)
|
59
|
-
activesupport (= 7.0.4)
|
58
|
+
activejob (7.0.4.2)
|
59
|
+
activesupport (= 7.0.4.2)
|
60
60
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.0.4)
|
62
|
-
activesupport (= 7.0.4)
|
63
|
-
activerecord (7.0.4)
|
64
|
-
activemodel (= 7.0.4)
|
65
|
-
activesupport (= 7.0.4)
|
61
|
+
activemodel (7.0.4.2)
|
62
|
+
activesupport (= 7.0.4.2)
|
63
|
+
activerecord (7.0.4.2)
|
64
|
+
activemodel (= 7.0.4.2)
|
65
|
+
activesupport (= 7.0.4.2)
|
66
66
|
activerecord-import (1.4.1)
|
67
67
|
activerecord (>= 4.2)
|
68
|
-
activestorage (7.0.4)
|
69
|
-
actionpack (= 7.0.4)
|
70
|
-
activejob (= 7.0.4)
|
71
|
-
activerecord (= 7.0.4)
|
72
|
-
activesupport (= 7.0.4)
|
68
|
+
activestorage (7.0.4.2)
|
69
|
+
actionpack (= 7.0.4.2)
|
70
|
+
activejob (= 7.0.4.2)
|
71
|
+
activerecord (= 7.0.4.2)
|
72
|
+
activesupport (= 7.0.4.2)
|
73
73
|
marcel (~> 1.0)
|
74
74
|
mini_mime (>= 1.1.0)
|
75
|
-
activesupport (7.0.4)
|
75
|
+
activesupport (7.0.4.2)
|
76
76
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
77
77
|
i18n (>= 1.6, < 2)
|
78
78
|
minitest (>= 5.1)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
public_suffix (>= 2.0.2, < 5.0)
|
82
82
|
builder (3.2.4)
|
83
83
|
coderay (1.1.3)
|
84
|
-
concurrent-ruby (1.
|
84
|
+
concurrent-ruby (1.2.0)
|
85
85
|
crack (0.4.5)
|
86
86
|
rexml
|
87
87
|
crass (1.0.6)
|
@@ -89,7 +89,7 @@ GEM
|
|
89
89
|
diff-lcs (1.5.0)
|
90
90
|
dotenv (2.1.2)
|
91
91
|
erubi (1.12.0)
|
92
|
-
globalid (1.
|
92
|
+
globalid (1.1.0)
|
93
93
|
activesupport (>= 5.0)
|
94
94
|
hashdiff (1.0.1)
|
95
95
|
httparty (0.21.0)
|
@@ -112,7 +112,7 @@ GEM
|
|
112
112
|
loofah (2.19.1)
|
113
113
|
crass (~> 1.0.2)
|
114
114
|
nokogiri (>= 1.5.9)
|
115
|
-
mail (2.8.
|
115
|
+
mail (2.8.1)
|
116
116
|
mini_mime (>= 0.1.1)
|
117
117
|
net-imap
|
118
118
|
net-pop
|
@@ -120,6 +120,7 @@ GEM
|
|
120
120
|
marcel (1.0.2)
|
121
121
|
method_source (1.0.0)
|
122
122
|
mini_mime (1.1.2)
|
123
|
+
mini_portile2 (2.8.1)
|
123
124
|
minitest (5.17.0)
|
124
125
|
multi_xml (0.6.0)
|
125
126
|
net-imap (0.3.4)
|
@@ -132,38 +133,39 @@ GEM
|
|
132
133
|
net-smtp (0.3.3)
|
133
134
|
net-protocol
|
134
135
|
nio4r (2.5.8)
|
135
|
-
nokogiri (1.
|
136
|
+
nokogiri (1.14.1)
|
137
|
+
mini_portile2 (~> 2.8.0)
|
136
138
|
racc (~> 1.4)
|
137
139
|
pry (0.14.1)
|
138
140
|
coderay (~> 1.1)
|
139
141
|
method_source (~> 1.0)
|
140
142
|
public_suffix (4.0.6)
|
141
143
|
racc (1.6.2)
|
142
|
-
rack (2.2.
|
144
|
+
rack (2.2.6.2)
|
143
145
|
rack-test (2.0.2)
|
144
146
|
rack (>= 1.3)
|
145
|
-
rails (7.0.4)
|
146
|
-
actioncable (= 7.0.4)
|
147
|
-
actionmailbox (= 7.0.4)
|
148
|
-
actionmailer (= 7.0.4)
|
149
|
-
actionpack (= 7.0.4)
|
150
|
-
actiontext (= 7.0.4)
|
151
|
-
actionview (= 7.0.4)
|
152
|
-
activejob (= 7.0.4)
|
153
|
-
activemodel (= 7.0.4)
|
154
|
-
activerecord (= 7.0.4)
|
155
|
-
activestorage (= 7.0.4)
|
156
|
-
activesupport (= 7.0.4)
|
147
|
+
rails (7.0.4.2)
|
148
|
+
actioncable (= 7.0.4.2)
|
149
|
+
actionmailbox (= 7.0.4.2)
|
150
|
+
actionmailer (= 7.0.4.2)
|
151
|
+
actionpack (= 7.0.4.2)
|
152
|
+
actiontext (= 7.0.4.2)
|
153
|
+
actionview (= 7.0.4.2)
|
154
|
+
activejob (= 7.0.4.2)
|
155
|
+
activemodel (= 7.0.4.2)
|
156
|
+
activerecord (= 7.0.4.2)
|
157
|
+
activestorage (= 7.0.4.2)
|
158
|
+
activesupport (= 7.0.4.2)
|
157
159
|
bundler (>= 1.15.0)
|
158
|
-
railties (= 7.0.4)
|
160
|
+
railties (= 7.0.4.2)
|
159
161
|
rails-dom-testing (2.0.3)
|
160
162
|
activesupport (>= 4.2.0)
|
161
163
|
nokogiri (>= 1.6)
|
162
|
-
rails-html-sanitizer (1.
|
164
|
+
rails-html-sanitizer (1.5.0)
|
163
165
|
loofah (~> 2.19, >= 2.19.1)
|
164
|
-
railties (7.0.4)
|
165
|
-
actionpack (= 7.0.4)
|
166
|
-
activesupport (= 7.0.4)
|
166
|
+
railties (7.0.4.2)
|
167
|
+
actionpack (= 7.0.4.2)
|
168
|
+
activesupport (= 7.0.4.2)
|
167
169
|
method_source
|
168
170
|
rake (>= 12.2)
|
169
171
|
thor (~> 1.0)
|
@@ -187,7 +189,7 @@ GEM
|
|
187
189
|
rspec-support (3.11.0)
|
188
190
|
thor (1.2.1)
|
189
191
|
timeout (0.3.1)
|
190
|
-
tzinfo (2.0.
|
192
|
+
tzinfo (2.0.6)
|
191
193
|
concurrent-ruby (~> 1.0)
|
192
194
|
webmock (3.14.0)
|
193
195
|
addressable (>= 2.8.0)
|
data/README.md
CHANGED
@@ -55,6 +55,7 @@ AppManager.configure do |config|
|
|
55
55
|
config.shopify_table_name = 'shops' # Table name which is generated by shopify mostly it is 'shops'
|
56
56
|
config.shopify_domain_field = 'shopify_domain' #shopify domain field
|
57
57
|
config.plan_id_or_name_field = 'plan_id'
|
58
|
+
config.shopify_app_slug = '' #Add your app slug here
|
58
59
|
config.field_names = {
|
59
60
|
'name' => 'shopify_domain', # demo-rahul-tiwari.myshopify.com
|
60
61
|
'shopify_email' => 'email', # rahul.t@hulkapps.com
|
@@ -63,7 +64,8 @@ AppManager.configure do |config|
|
|
63
64
|
'plan_id' => 'plan_id', # 1. t
|
64
65
|
'created_at' => 'created_at', # 2022-04-15 10:43:05
|
65
66
|
'trial_activated_at' => 'trial_activated_at', # field name that stores trial start/activated date
|
66
|
-
'grandfathered' => 'grandfathered'
|
67
|
+
'grandfathered' => 'grandfathered',
|
68
|
+
'total_trial_days' => '' #optional, put a trial days field from your shops table otherwise leave it blank
|
67
69
|
}
|
68
70
|
config.plan_features = [
|
69
71
|
{
|
@@ -119,7 +121,7 @@ AppManager.configure do |config|
|
|
119
121
|
"group_order" => "1",
|
120
122
|
"group" => "Group Name",
|
121
123
|
}
|
122
|
-
]
|
124
|
+
]
|
123
125
|
end
|
124
126
|
#Required, Values type : integer, boolean, string, array #
|
125
127
|
#Format: percentage, count, string
|
@@ -191,6 +193,12 @@ and then you can use follwing methods with your shop objects.
|
|
191
193
|
|
192
194
|
@shop.get_all_plans # return all app plans array
|
193
195
|
|
196
|
+
@shop.active_shopify_charge_id # return active shopify charge id if shop has any current reccurring charge otherwise nil
|
197
|
+
|
198
|
+
@shop.get_active_charge_app_manager # return active charge hash from app manager otherwise nil
|
199
|
+
|
200
|
+
@shop.update_app_manager_charge # return true if shop has shopify recurring charge but app manager doesn't then it update to app manager and return true otherwise nil
|
201
|
+
|
194
202
|
```
|
195
203
|
|
196
204
|
|
data/app_manager.gemspec
CHANGED
@@ -5,7 +5,7 @@ require_relative "lib/app_manager/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "app_manager"
|
7
7
|
spec.version = AppManager::VERSION
|
8
|
-
spec.authors = "Hulkapps"
|
8
|
+
spec.authors = "Rahul Tiwari @ Hulkapps"
|
9
9
|
spec.email = "rahul.t@hulkapps.com"
|
10
10
|
|
11
11
|
spec.summary = "An API wrapper of Hulkapps AppManager portal"
|
@@ -42,6 +42,8 @@ module AppManager
|
|
42
42
|
query = query.dup.force_encoding("UTF-8")
|
43
43
|
if variables.present?
|
44
44
|
query = {"query": "#{query}","variables": variables }
|
45
|
+
else
|
46
|
+
query = {"query": "#{query}","variables": {} }
|
45
47
|
end
|
46
48
|
if is_json
|
47
49
|
response = api_call(query.to_json,true)
|
@@ -176,6 +178,20 @@ module AppManager
|
|
176
178
|
return data
|
177
179
|
end
|
178
180
|
|
181
|
+
def recurring_charge_current_api_call(shop)
|
182
|
+
query = 'query {
|
183
|
+
currentAppInstallation {
|
184
|
+
activeSubscriptions {
|
185
|
+
id
|
186
|
+
name
|
187
|
+
test
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}'
|
191
|
+
data = run_graph_api(query,{})
|
192
|
+
return data
|
193
|
+
end
|
194
|
+
|
179
195
|
end
|
180
196
|
end
|
181
197
|
|
data/lib/app_manager/model.rb
CHANGED
@@ -152,6 +152,142 @@ module AppManager
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
def get_active_charge_app_manager
|
156
|
+
active_charge = self.get_charge rescue nil
|
157
|
+
return active_charge && active_charge['active_charge'].present? && !active_charge['active_charge'].nil? ? active_charge['active_charge'] : nil
|
158
|
+
end
|
159
|
+
|
160
|
+
def has_valid_app_manager_plan_id
|
161
|
+
shop_plan_id = self[AppManager.configuration.plan_id_or_name_field]
|
162
|
+
shop_domain = self[AppManager.configuration.shopify_domain_field]
|
163
|
+
plan_obj = AppManager::Client.new
|
164
|
+
plans = plan_obj.get_plans(shop_domain) rescue nil
|
165
|
+
return shop_plan_id && (plans && plans.any? && plans.collect{|e| e['id']}.include?(shop_plan_id)) ? true : false
|
166
|
+
end
|
167
|
+
|
168
|
+
def update_app_manager_charge(current_shopify_charge_id=nil)
|
169
|
+
charge_updated = nil
|
170
|
+
begin
|
171
|
+
shop_plan_id = self[AppManager.configuration.plan_id_or_name_field]
|
172
|
+
shop_domain = self[AppManager.configuration.shopify_domain_field]
|
173
|
+
if get_active_charge_app_manager.nil?
|
174
|
+
current_charge_id = current_shopify_charge_id.present? ? current_shopify_charge_id : active_shopify_charge_id
|
175
|
+
if current_charge_id.present?
|
176
|
+
if has_valid_app_manager_plan_id
|
177
|
+
if charge_update_call(self,shop_plan_id,current_charge_id)
|
178
|
+
charge_updated = true
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
return charge_updated
|
184
|
+
rescue Exception => e
|
185
|
+
Rollbar.error("Warning in APP MANAGER, trying to get active shopify charge id >>>> #{e.inspect}")
|
186
|
+
return nil
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def active_shopify_charge_id
|
191
|
+
begin
|
192
|
+
gq_obj = AppManager::GraphqlHelper.new(self.shopify_domain, self.shopify_token)
|
193
|
+
data = gq_obj.recurring_charge_current_api_call(self)
|
194
|
+
if !data["errors"].present? && (data["data"].present? && data["data"]["currentAppInstallation"].present? && data["data"]["currentAppInstallation"]["activeSubscriptions"].present?)
|
195
|
+
current_shopify_charge_id = data["data"]["currentAppInstallation"]["activeSubscriptions"].first["id"]
|
196
|
+
if current_shopify_charge_id
|
197
|
+
return current_shopify_charge_id.split('/')[-1] rescue nil
|
198
|
+
else
|
199
|
+
return nil
|
200
|
+
end
|
201
|
+
else
|
202
|
+
return nil
|
203
|
+
end
|
204
|
+
rescue Exception => e
|
205
|
+
Rollbar.error("Warning in APP MANAGER, trying to get active shopify charge id >>>> #{e.inspect}")
|
206
|
+
return nil
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def app_manager_charge_update(shop,shopify_current_charge_obj)
|
211
|
+
if shop.present? && shop.plan_id.present? && shopify_current_charge_obj.present?
|
212
|
+
charge_update_call(shop,shop.plan_id,shopify_current_charge_obj['id'],shopify_current_charge_obj)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def charge_update_call(shop,shop_plan_id,current_charge_id,charge_obj={})
|
217
|
+
charge_callback_done = nil
|
218
|
+
# begin
|
219
|
+
@shop = shop
|
220
|
+
@field_names = AppManager.configuration.field_names
|
221
|
+
shopify_token = @field_names['shopify_token']
|
222
|
+
shopify_domain = @field_names['name']
|
223
|
+
grandfathered_field = @field_names['grandfathered']
|
224
|
+
shop_domain = @shop[AppManager.configuration.shopify_domain_field]
|
225
|
+
if !@shop.nil?
|
226
|
+
if charge_obj.present? && !charge_obj.nil?
|
227
|
+
shopify_charge_obj = charge_obj
|
228
|
+
else
|
229
|
+
headers = {"X-Shopify-Access-Token" => @shop[shopify_token]}
|
230
|
+
charges = HTTParty.get('https://' + shop_domain + '/admin/api/' + AppManager.configuration.shopify_api_version + '/recurring_application_charges/' + current_charge_id + '.json', :headers => headers)
|
231
|
+
shopify_charge_obj = charges.parsed_response && charges.parsed_response.is_a?(Hash) && charges.parsed_response.has_key?('recurring_application_charge') ? charges.parsed_response['recurring_application_charge'] : {}
|
232
|
+
end
|
233
|
+
|
234
|
+
if shopify_charge_obj.present?
|
235
|
+
plan_obj = AppManager::Client.new
|
236
|
+
plan_data = plan_obj.get_plan(shop_plan_id, shop_domain)
|
237
|
+
charge = shopify_charge_obj
|
238
|
+
charge['charge_id'] = charge['id']
|
239
|
+
charge['type'] = 'recurring'
|
240
|
+
charge['plan_id'] = shop_plan_id
|
241
|
+
charge['shop_domain'] = shop_domain
|
242
|
+
charge['interval'] = plan_data['interval']['value']
|
243
|
+
['api_client_id', 'return_url', 'decorated_return_url','id','id','currency'].each { |k| charge.delete k }
|
244
|
+
charge_ob = AppManager::Client.new(nil, json_req = true)
|
245
|
+
response = charge_ob.store_charge(charge.to_json)
|
246
|
+
|
247
|
+
if response['message'] == "success"
|
248
|
+
AppManager.clear_cache
|
249
|
+
|
250
|
+
update_info = {AppManager.configuration.plan_id_or_name_field => shop_plan_id,grandfathered_field => 0}
|
251
|
+
if !config_trial_days.nil? && !plan_data.nil?
|
252
|
+
trial_days = plan_data['trial_days'] || 0
|
253
|
+
update_info[config_trial_days] = trial_days
|
254
|
+
end
|
255
|
+
|
256
|
+
if @shop.update(update_info)
|
257
|
+
charge_callback_done = true
|
258
|
+
end
|
259
|
+
Thread.new do
|
260
|
+
charge_data = plan_obj.get_charge(@shop[shopify_domain])
|
261
|
+
begin
|
262
|
+
AppManager::EventHandler.new('charge_created', {
|
263
|
+
"plan" => plan_data,
|
264
|
+
"charge" => charge,
|
265
|
+
"previous_charge" => charge_data ? (charge_data['cancelled_charge'] || nil) : nil,
|
266
|
+
"shopify_domain" => shop_domain
|
267
|
+
})
|
268
|
+
rescue Exception => e
|
269
|
+
Rollbar.error("Warning in APP MANAGER model Charge Created Callback Event Fire>>>> #{e.inspect}")
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
return charge_callback_done
|
276
|
+
# rescue Exception => e
|
277
|
+
# Rollbar.error("Warning in APP MANAGER model charge_callback, trying to update active shopify charge in app manager>>>> #{e.inspect}")
|
278
|
+
# return nil
|
279
|
+
# end
|
280
|
+
end
|
281
|
+
|
282
|
+
def config_trial_days
|
283
|
+
@field_names = AppManager.configuration.field_names
|
284
|
+
if !@field_names.nil? && @field_names.has_key?('total_trial_days') && !@field_names['total_trial_days'].nil? && !@field_names['total_trial_days'].blank?
|
285
|
+
return @field_names['total_trial_days']
|
286
|
+
else
|
287
|
+
return nil
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
155
291
|
def set_default_plan(plan_id = nil)
|
156
292
|
begin
|
157
293
|
if plan_id.nil?
|
data/lib/app_manager/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class AddExternalChargeField < ActiveRecord::Migration[<%= rails_migration_version %>]
|
2
2
|
def change
|
3
3
|
add_column :plans, :is_external_charge, :boolean unless column_exists? :plans, :is_external_charge, default: false
|
4
4
|
add_column :plans, :external_charge_limit, :bigint unless column_exists? :plans, :external_charge_limit
|
@@ -7,6 +7,7 @@ AppManager.configure do |config|
|
|
7
7
|
config.shopify_table_name = 'shops' # Table name which is generated by shopify mostly it is 'shops'
|
8
8
|
config.shopify_domain_field = 'shopify_domain' #shopify domain field
|
9
9
|
config.plan_id_or_name_field = 'plan_id'
|
10
|
+
config.shopify_app_slug = '' #Add your app slug here
|
10
11
|
config.field_names = {
|
11
12
|
'name' => 'shopify_domain', # demo-rahul-tiwari.myshopify.com
|
12
13
|
'shopify_email' => 'email', # rahul.t@hulkapps.com
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Hulkapps
|
7
|
+
- Rahul Tiwari @ Hulkapps
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|