app_manager 2.2.4 → 2.3.1

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: b79e8f73435de3ded9d7a71d76c5658884d624c96944ae4a1fa6aa9d96504fcc
4
- data.tar.gz: cca64ffae23b40444c8abc95ea1d9474b201c74569661e958d145744eff2195e
3
+ metadata.gz: b31e9471677527b7f6face01beac639469cab8dc2ff202978da8817466cad8cb
4
+ data.tar.gz: '08708078a2e0fc375969590f7542946102754c8d01c9e321a84f8bb172c9e956'
5
5
  SHA512:
6
- metadata.gz: ce51ba456521c7877e92602bcea65a7238eaf2f57b275d2746d8931e75f6074be343386ff96c3d51d5b674800bf56c2e4423c65e80addaaae7777f281d6dd455
7
- data.tar.gz: 42d2907e6918b99dd9bceb0f1cf720c08a17bb71de1f4f520b2d17ad741a800ba617c4955c6de68ea894efd667915487dbad522f68646738d34943e907a4bcf0
6
+ metadata.gz: 803859a49d8698a6f6f1e706ce54c7505f992c8fde1974e505f37fa5113ffdcd553d1efb52c42774ae50a33d0b8808015171b739fe1442a4001c89d913b4e022
7
+ data.tar.gz: bb3e910739a76c982f5510cb1bdd4610a20854f55f969fde0916550005da5da525c7f83e7ca0331e8090d2a35d591dce40b6f3233d55870a93fbe7ca50fec239
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (2.2.4)
4
+ app_manager (2.3.1)
5
5
  activerecord-import (~> 1.4)
6
6
  httparty
7
7
  kaminari (>= 0.16.3)
@@ -10,35 +10,35 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (7.1.3.2)
14
- actionpack (= 7.1.3.2)
15
- activesupport (= 7.1.3.2)
13
+ actioncable (7.1.4)
14
+ actionpack (= 7.1.4)
15
+ activesupport (= 7.1.4)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
18
  zeitwerk (~> 2.6)
19
- actionmailbox (7.1.3.2)
20
- actionpack (= 7.1.3.2)
21
- activejob (= 7.1.3.2)
22
- activerecord (= 7.1.3.2)
23
- activestorage (= 7.1.3.2)
24
- activesupport (= 7.1.3.2)
19
+ actionmailbox (7.1.4)
20
+ actionpack (= 7.1.4)
21
+ activejob (= 7.1.4)
22
+ activerecord (= 7.1.4)
23
+ activestorage (= 7.1.4)
24
+ activesupport (= 7.1.4)
25
25
  mail (>= 2.7.1)
26
26
  net-imap
27
27
  net-pop
28
28
  net-smtp
29
- actionmailer (7.1.3.2)
30
- actionpack (= 7.1.3.2)
31
- actionview (= 7.1.3.2)
32
- activejob (= 7.1.3.2)
33
- activesupport (= 7.1.3.2)
29
+ actionmailer (7.1.4)
30
+ actionpack (= 7.1.4)
31
+ actionview (= 7.1.4)
32
+ activejob (= 7.1.4)
33
+ activesupport (= 7.1.4)
34
34
  mail (~> 2.5, >= 2.5.4)
35
35
  net-imap
36
36
  net-pop
37
37
  net-smtp
38
38
  rails-dom-testing (~> 2.2)
39
- actionpack (7.1.3.2)
40
- actionview (= 7.1.3.2)
41
- activesupport (= 7.1.3.2)
39
+ actionpack (7.1.4)
40
+ actionview (= 7.1.4)
41
+ activesupport (= 7.1.4)
42
42
  nokogiri (>= 1.8.5)
43
43
  racc
44
44
  rack (>= 2.2.4)
@@ -46,37 +46,37 @@ GEM
46
46
  rack-test (>= 0.6.3)
47
47
  rails-dom-testing (~> 2.2)
48
48
  rails-html-sanitizer (~> 1.6)
49
- actiontext (7.1.3.2)
50
- actionpack (= 7.1.3.2)
51
- activerecord (= 7.1.3.2)
52
- activestorage (= 7.1.3.2)
53
- activesupport (= 7.1.3.2)
49
+ actiontext (7.1.4)
50
+ actionpack (= 7.1.4)
51
+ activerecord (= 7.1.4)
52
+ activestorage (= 7.1.4)
53
+ activesupport (= 7.1.4)
54
54
  globalid (>= 0.6.0)
55
55
  nokogiri (>= 1.8.5)
56
- actionview (7.1.3.2)
57
- activesupport (= 7.1.3.2)
56
+ actionview (7.1.4)
57
+ activesupport (= 7.1.4)
58
58
  builder (~> 3.1)
59
59
  erubi (~> 1.11)
60
60
  rails-dom-testing (~> 2.2)
61
61
  rails-html-sanitizer (~> 1.6)
62
- activejob (7.1.3.2)
63
- activesupport (= 7.1.3.2)
62
+ activejob (7.1.4)
63
+ activesupport (= 7.1.4)
64
64
  globalid (>= 0.3.6)
65
- activemodel (7.1.3.2)
66
- activesupport (= 7.1.3.2)
67
- activerecord (7.1.3.2)
68
- activemodel (= 7.1.3.2)
69
- activesupport (= 7.1.3.2)
65
+ activemodel (7.1.4)
66
+ activesupport (= 7.1.4)
67
+ activerecord (7.1.4)
68
+ activemodel (= 7.1.4)
69
+ activesupport (= 7.1.4)
70
70
  timeout (>= 0.4.0)
71
- activerecord-import (1.6.0)
71
+ activerecord-import (1.7.0)
72
72
  activerecord (>= 4.2)
73
- activestorage (7.1.3.2)
74
- actionpack (= 7.1.3.2)
75
- activejob (= 7.1.3.2)
76
- activerecord (= 7.1.3.2)
77
- activesupport (= 7.1.3.2)
73
+ activestorage (7.1.4)
74
+ actionpack (= 7.1.4)
75
+ activejob (= 7.1.4)
76
+ activerecord (= 7.1.4)
77
+ activesupport (= 7.1.4)
78
78
  marcel (~> 1.0)
79
- activesupport (7.1.3.2)
79
+ activesupport (7.1.4)
80
80
  base64
81
81
  bigdecimal
82
82
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -89,10 +89,10 @@ GEM
89
89
  addressable (2.8.0)
90
90
  public_suffix (>= 2.0.2, < 5.0)
91
91
  base64 (0.2.0)
92
- bigdecimal (3.1.7)
93
- builder (3.2.4)
92
+ bigdecimal (3.1.8)
93
+ builder (3.3.0)
94
94
  coderay (1.1.3)
95
- concurrent-ruby (1.2.3)
95
+ concurrent-ruby (1.3.4)
96
96
  connection_pool (2.4.1)
97
97
  crack (0.4.5)
98
98
  rexml
@@ -102,7 +102,7 @@ GEM
102
102
  diff-lcs (1.5.0)
103
103
  dotenv (2.1.2)
104
104
  drb (2.2.1)
105
- erubi (1.12.0)
105
+ erubi (1.13.0)
106
106
  globalid (1.2.1)
107
107
  activesupport (>= 6.1)
108
108
  hashdiff (1.0.1)
@@ -110,11 +110,11 @@ GEM
110
110
  csv
111
111
  mini_mime (>= 1.0.0)
112
112
  multi_xml (>= 0.5.2)
113
- i18n (1.14.4)
113
+ i18n (1.14.5)
114
114
  concurrent-ruby (~> 1.0)
115
115
  io-console (0.7.2)
116
- irb (1.12.0)
117
- rdoc
116
+ irb (1.14.0)
117
+ rdoc (>= 4.0.0)
118
118
  reline (>= 0.4.2)
119
119
  kaminari (1.2.2)
120
120
  activesupport (>= 4.1.0)
@@ -139,8 +139,8 @@ GEM
139
139
  marcel (1.0.4)
140
140
  method_source (1.0.0)
141
141
  mini_mime (1.1.5)
142
- mini_portile2 (2.8.6)
143
- minitest (5.22.3)
142
+ mini_portile2 (2.8.7)
143
+ minitest (5.25.1)
144
144
  multi_xml (0.6.0)
145
145
  mutex_m (0.2.0)
146
146
  net-imap (0.3.7)
@@ -152,7 +152,7 @@ GEM
152
152
  timeout
153
153
  net-smtp (0.5.0)
154
154
  net-protocol
155
- nio4r (2.7.1)
155
+ nio4r (2.7.3)
156
156
  nokogiri (1.15.6)
157
157
  mini_portile2 (~> 2.8.2)
158
158
  racc (~> 1.4)
@@ -162,8 +162,8 @@ GEM
162
162
  psych (5.1.2)
163
163
  stringio
164
164
  public_suffix (4.0.6)
165
- racc (1.7.3)
166
- rack (3.0.10)
165
+ racc (1.8.1)
166
+ rack (3.1.7)
167
167
  rack-session (2.0.0)
168
168
  rack (>= 3.0.0)
169
169
  rack-test (2.1.0)
@@ -171,20 +171,20 @@ GEM
171
171
  rackup (2.1.0)
172
172
  rack (>= 3)
173
173
  webrick (~> 1.8)
174
- rails (7.1.3.2)
175
- actioncable (= 7.1.3.2)
176
- actionmailbox (= 7.1.3.2)
177
- actionmailer (= 7.1.3.2)
178
- actionpack (= 7.1.3.2)
179
- actiontext (= 7.1.3.2)
180
- actionview (= 7.1.3.2)
181
- activejob (= 7.1.3.2)
182
- activemodel (= 7.1.3.2)
183
- activerecord (= 7.1.3.2)
184
- activestorage (= 7.1.3.2)
185
- activesupport (= 7.1.3.2)
174
+ rails (7.1.4)
175
+ actioncable (= 7.1.4)
176
+ actionmailbox (= 7.1.4)
177
+ actionmailer (= 7.1.4)
178
+ actionpack (= 7.1.4)
179
+ actiontext (= 7.1.4)
180
+ actionview (= 7.1.4)
181
+ activejob (= 7.1.4)
182
+ activemodel (= 7.1.4)
183
+ activerecord (= 7.1.4)
184
+ activestorage (= 7.1.4)
185
+ activesupport (= 7.1.4)
186
186
  bundler (>= 1.15.0)
187
- railties (= 7.1.3.2)
187
+ railties (= 7.1.4)
188
188
  rails-dom-testing (2.2.0)
189
189
  activesupport (>= 5.0.0)
190
190
  minitest
@@ -192,18 +192,18 @@ GEM
192
192
  rails-html-sanitizer (1.6.0)
193
193
  loofah (~> 2.21)
194
194
  nokogiri (~> 1.14)
195
- railties (7.1.3.2)
196
- actionpack (= 7.1.3.2)
197
- activesupport (= 7.1.3.2)
195
+ railties (7.1.4)
196
+ actionpack (= 7.1.4)
197
+ activesupport (= 7.1.4)
198
198
  irb
199
199
  rackup (>= 1.0.0)
200
200
  rake (>= 12.2)
201
201
  thor (~> 1.0, >= 1.2.2)
202
202
  zeitwerk (~> 2.6)
203
203
  rake (13.0.6)
204
- rdoc (6.6.3.1)
204
+ rdoc (6.7.0)
205
205
  psych (>= 4.0.0)
206
- reline (0.5.4)
206
+ reline (0.5.9)
207
207
  io-console (~> 0.5)
208
208
  rexml (3.2.5)
209
209
  rspec (3.11.0)
@@ -221,7 +221,7 @@ GEM
221
221
  diff-lcs (>= 1.2.0, < 2.0)
222
222
  rspec-support (~> 3.11.0)
223
223
  rspec-support (3.11.0)
224
- stringio (3.1.0)
224
+ stringio (3.1.1)
225
225
  thor (1.3.1)
226
226
  timeout (0.4.1)
227
227
  tzinfo (2.0.6)
@@ -234,7 +234,7 @@ GEM
234
234
  websocket-driver (0.7.6)
235
235
  websocket-extensions (>= 0.1.0)
236
236
  websocket-extensions (0.1.5)
237
- zeitwerk (2.6.13)
237
+ zeitwerk (2.6.17)
238
238
 
239
239
  PLATFORMS
240
240
  ruby
@@ -2,7 +2,7 @@ require_dependency "app_manager/application_controller"
2
2
  module AppManager
3
3
  class ChargesController < ApplicationController
4
4
  include HTTParty
5
- skip_before_action :verify_authenticity_token, :only => [:process_plan]
5
+ skip_before_action :verify_authenticity_token, :only => [:process_plan,:activate_global,:cancel_charge,:cancel_global]
6
6
  before_action :params_permit
7
7
  require 'time'
8
8
  require 'rack'
@@ -140,7 +140,7 @@ module AppManager
140
140
 
141
141
  begin
142
142
  plan_obj = AppManager::Client.new
143
- if params[:discount].present? && !params[:discount].nil? && params[:discount] != '0'
143
+ if params[:discount].present? && !params[:discount].nil? && params[:discount] != '0' && !plan_data['is_global']
144
144
  discounted_plans = plan_obj.get_related_discounted_plans(params[:discount])
145
145
  if discounted_plans.empty? || discounted_plans.include?(params[:plan].to_i)
146
146
  plan_obj.discount_used(@shop[shopify_domain], params[:discount])
@@ -191,6 +191,71 @@ module AppManager
191
191
  end
192
192
  end
193
193
 
194
+ def cancel_charge
195
+ if params[:charge_id].present? && params[:shop].present?
196
+ @shop = shop_data
197
+ shopify_token = @field_names['shopify_token']
198
+ begin
199
+ gq_obj = AppManager::GraphqlHelper.new(@shop[@shopify_domain], @shop[shopify_token])
200
+ rec_cancel_data = gq_obj.recurring_charge_cancel_api_call(params[:charge_id], @shop)
201
+ rescue Exception => e
202
+ Rollbar.error("APP MANAGER Cancel Plan Failed #{e.inspect}-#{e.backtrace}")
203
+ end
204
+ end
205
+ head :ok
206
+ end
207
+
208
+ def activate_global
209
+ if params[:shop].present? && params[:plan_id].present?
210
+ @shop = shop_data
211
+ grandfathered_field = @field_names['grandfathered']
212
+ trial_activated_field = @field_names['trial_activated_at']
213
+ if !@shop.nil?
214
+ plan_obj = AppManager::Client.new
215
+ plan_data = plan_obj.get_plan(params[:plan_id], params[:shop])
216
+ update_info = {@plan_field => params[:plan_id], trial_activated_field => nil,grandfathered_field => 0}
217
+ if !config_trial_days.nil? && !plan_data.nil?
218
+ trial_days = plan_data['trial_days'] || 0
219
+ update_info[config_trial_days] = trial_days
220
+ end
221
+ if @shop.update(update_info)
222
+ begin
223
+ plan_data['shop_domain'] = params[:shop];
224
+ plan_data['old_plan'] = params[:old_plan] || nil;
225
+ AppManager::EventHandler.new('charge_created', {
226
+ "plan" => plan_data,
227
+ "charge" => nil,
228
+ "previous_charge" => nil,
229
+ "shopify_domain" => params[:shop]
230
+ })
231
+ rescue Exception => e
232
+ Rollbar.error("APP MANAGER Error in Activate Global plan #{e.inspect}-#{e.backtrace}")
233
+ end
234
+ AppManager.clear_cache
235
+ end
236
+ end
237
+ render json: {'status' => true,'plan_type' => 'global_plan'} and return true
238
+ end
239
+ end
240
+
241
+ def cancel_global
242
+ if params[:shop].present?
243
+ @shop = shop_data
244
+ grandfathered_field = @field_names['grandfathered']
245
+ trial_activated_field = @field_names['trial_activated_at']
246
+ if !@shop.nil?
247
+ update_info = {@plan_field => nil, trial_activated_field => nil,grandfathered_field => 0}
248
+ if !config_trial_days.nil?
249
+ update_info[config_trial_days] = 0
250
+ end
251
+ @shop.update(update_info)
252
+ AppManager.clear_cache
253
+ end
254
+ render json: {'status' => true,'plan_type' => 'cancel_plan'} and return true
255
+ end
256
+ end
257
+
258
+
194
259
  private
195
260
 
196
261
  def params_permit
@@ -20,6 +20,7 @@ module AppManager
20
20
  default_plan_id = nil
21
21
  choose_later = false
22
22
  trial_activated_at = nil
23
+ global_plan = nil
23
24
  plan_obj = AppManager::Client.new
24
25
  plans = []
25
26
  if params[:shop_domain].present? && !AppManager.configuration.plan_features.nil?
@@ -32,7 +33,7 @@ module AppManager
32
33
  shopify_plan_field = AppManager.configuration.field_names['shopify_plan']
33
34
  shopify_plan = @shop[shopify_plan_field] rescue nil
34
35
  plan = plans && plans.any? && !active_plan_id_or_name.nil? ? (plans.find { |x| x["id"] == active_plan_id_or_name }.present? ? plans.find { |x| x["id"] == active_plan_id_or_name } : nil) : nil
35
-
36
+ global_plan = plans&.find { |x| x["is_global"] == 1 or x["is_global"] == true }
36
37
  @trial_activated_field = AppManager.configuration.field_names['trial_activated_at']
37
38
  trial_activated_at = @shop[@trial_activated_field] rescue nil
38
39
  active_charge = plan_obj.get_charge(params[:shop_domain])
@@ -72,11 +73,17 @@ module AppManager
72
73
  promotional_discount = plan_obj.get_promotional_discount(params[:shop_domain],discount_local_storage)
73
74
  promotional_discount = [] if promotional_discount.class.to_s == "Hash" && promotional_discount.has_key?('status') && promotional_discount['status'] == 404
74
75
  end
76
+
77
+ bundle_obj = AppManager::Client.new
78
+ app_bundle_data = bundle_obj.get_app_bundle_data
79
+
75
80
  response = {
76
81
  'plans' => plans,
77
82
  'promotional_discount' => promotional_discount,
78
83
  'shopify_plan' => shopify_plan,
79
84
  'plan' => plan,
85
+ 'bundle_plan' => global_plan,
86
+ 'bundle_details' => app_bundle_data,
80
87
  'default_plan_id' => default_plan_id,
81
88
  'choose_later' => choose_later,
82
89
  'has_active_charge' => (((active_charge && active_charge.any? && !active_charge['active_charge'].nil?) or !trial_activated_at) ? true : false)
data/config/routes.rb CHANGED
@@ -11,6 +11,11 @@ AppManager::Engine.routes.draw do
11
11
  get 'plan/process/:plan_id' => 'charges#process_plan'
12
12
  get 'plan/callback' => 'charges#callback', as: :plan_callback
13
13
 
14
+ post 'cancel-charge' => 'charges#cancel_charge'
15
+ post 'plan/activate-global' => 'charges#activate_global'
16
+ post 'plan/cancel-global' => 'charges#cancel_global'
17
+
18
+
14
19
  scope 'app-manager-api' do
15
20
  post 'store-charge' => 'plans#store_charge'
16
21
  end
@@ -37,7 +37,7 @@ module AppManager
37
37
  end
38
38
 
39
39
  def cache_path
40
- @cache_path = "app-manager-cache"
40
+ @cache_path = "app-manager-cache/#{ENV['SHOPIFY_APP_SLUG']}"
41
41
  if @options[:cache_path].present?
42
42
  @cache_path = "#{@cache_path}#{@options[:cache_path]}"
43
43
  elsif AppManager.configuration.refresh_by_request_params?
@@ -24,7 +24,7 @@ module AppManager
24
24
 
25
25
  def request(http_method, path, options)
26
26
  failsafe_or_caching_done = false
27
- if http_method.to_s == 'get' && !path.include?("/get-status") && !path.include?("/sync-charge")
27
+ if http_method.to_s == 'get' && !path.include?("/get-status") && !path.include?("/sync-charge") && AppManager.configuration.enable_caching
28
28
  response = response_from_cache_for_api(http_method, path, options)
29
29
  failsafe_or_caching_done = true
30
30
  else
@@ -69,7 +69,8 @@ module AppManager
69
69
  end
70
70
 
71
71
  def response_from_cache_for_api(http_method, path, options)
72
- cache_key = "app-manager-cache/#{path}"
72
+ Rails.logger.info "Caching data enabled >>>>>>>>>>>>>>>>>>>>>>>>"
73
+ cache_key = "app-manager-cache/#{ENV['SHOPIFY_APP_SLUG']}/#{path}"
73
74
  if fetch_static_cached_response(cache_key).present?
74
75
  return fetch_static_cached_response(cache_key)
75
76
  end
@@ -133,6 +134,10 @@ module AppManager
133
134
  return @fs.store_discount_used(params,options)
134
135
  when 'get-related-discounted-plans'
135
136
  return @fs.get_local_related_discounted_plans(params,options)
137
+ when 'app-bundle-data'
138
+ return []
139
+ when 'activate-global-plan'
140
+ return nil
136
141
  else
137
142
  return nil
138
143
  end
@@ -43,6 +43,14 @@ module AppManager
43
43
  get("/has-plan?shop_domain=#{shop_domain}&plan_id=#{plan_id}&trial_activated_at=#{trial_activated_at}&grandfathered=#{grandfathered}")
44
44
  end
45
45
 
46
+ def get_app_bundle_data
47
+ get("/app-bundle-data")
48
+ end
49
+
50
+ def check_and_activate_global_plan(shop_domain)
51
+ get("/activate-global-plan?shop_domain=#{shop_domain}")
52
+ end
53
+
46
54
  def get_promotional_discount(shop_domain = nil,code)
47
55
  get("/discount?shop_domain=#{shop_domain}&code=#{code}")
48
56
  end
@@ -94,7 +94,7 @@ module AppManager
94
94
  discount_type = plan['discount_type'] || "percentage"
95
95
  discount_val = discount_type == "percentage" ? (plan['discount'].to_f/ 100) : "#{plan['discount']}"
96
96
  if !@api_version.nil? && @api_version.to_s.include?('2024')
97
- plan_discount = if plan['discount'] && plan['cycle_count']
97
+ plan_discount = if plan['discount'] && plan['cycle_count'] && plan['cycle_count'].to_i != 0
98
98
  {
99
99
  "discount" => { "durationLimitInIntervals" => (plan['cycle_count'].to_i),
100
100
  "value" => {"#{discount_type}" => discount_val}
@@ -115,7 +115,7 @@ module AppManager
115
115
 
116
116
  if promotional_discount.any?
117
117
 
118
- if promotional_discount['plan_relation'].any? && !promotional_discount['plan_relation'].include?(plan['id'])
118
+ if promotional_discount['plan_relation'].any? && !promotional_discount['plan_relation'].include?(plan['id']) && plan['is_global']
119
119
  plan_discount = {}
120
120
  else
121
121
 
@@ -403,7 +403,7 @@ module AppManager
403
403
 
404
404
 
405
405
  def fetch_static_remaining_days
406
- @remaining_cache_key = "app-manager-cache/#{self.shopify_domain}-remaining_days"
406
+ @remaining_cache_key = "app-manager-cache/#{ENV['SHOPIFY_APP_SLUG']}/#{self.shopify_domain}-remaining_days"
407
407
  if fetch_cached_static_remaining_days(@remaining_cache_key).present?
408
408
  return fetch_cached_static_remaining_days(@remaining_cache_key)
409
409
  end
@@ -420,7 +420,7 @@ module AppManager
420
420
 
421
421
 
422
422
  def fetch_static_get_charge
423
- @get_charge_key = "app-manager-cache/#{self.shopify_domain}-get_charge"
423
+ @get_charge_key = "app-manager-cache/#{ENV['SHOPIFY_APP_SLUG']}/#{self.shopify_domain}-get_charge"
424
424
  if fetch_cached_static_get_charge(@get_charge_key).present?
425
425
  return fetch_cached_static_get_charge(@get_charge_key)
426
426
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "2.2.4"
4
+ VERSION = "2.3.1"
5
5
  end
data/lib/app_manager.rb CHANGED
@@ -28,7 +28,8 @@ module AppManager
28
28
 
29
29
  def self.clear_cache
30
30
  begin
31
- Rails.cache.delete_matched('app-manager-cache/*')
31
+ Rails.cache.delete_matched("app-manager-cache/*")
32
+ Rails.cache.delete_matched("app-manager-cache/#{ENV['SHOPIFY_APP_SLUG']}/*")
32
33
  rescue Exception => e
33
34
  Rollbar.error("APP MANAGER Error in Clear Cache #{e}")
34
35
  end
@@ -47,6 +47,14 @@ module AppManager
47
47
  end
48
48
  end
49
49
 
50
+ def create_global_field_to_plans_migration
51
+ if self.class.migration_exists?("db/app_manager", "add_is_global_to_plans")
52
+ say_status("skipped", "Migration add_is_global_to_plans.rb already exists")
53
+ else
54
+ migration_template("add_is_global_to_plans.erb", "db/app_manager/add_is_global_to_plans.rb")
55
+ end
56
+ end
57
+
50
58
 
51
59
  private
52
60
 
@@ -0,0 +1,7 @@
1
+ class AddIsGlobalToPlans < ActiveRecord::Migration[<%= rails_migration_version %>]
2
+ def change
3
+ unless column_exists?(:plans, :is_global)
4
+ add_column :plans, :is_global, :boolean, default: false
5
+ end
6
+ end
7
+ end
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: 2.2.4
4
+ version: 2.3.1
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: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -125,6 +125,7 @@ files:
125
125
  - lib/generators/app_manager/install/install_generator.rb
126
126
  - lib/generators/app_manager/install/templates/add_discount_tables.erb
127
127
  - lib/generators/app_manager/install/templates/add_external_charge_field.erb
128
+ - lib/generators/app_manager/install/templates/add_is_global_to_plans.erb
128
129
  - lib/generators/app_manager/install/templates/add_plan_trial_grandfathered_to_shops.erb
129
130
  - lib/generators/app_manager/install/templates/app_manager.rb.tt
130
131
  - lib/generators/app_manager/install/templates/failsafe_tables.erb