app_manager 1.4.4 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +61 -61
- data/app/controllers/app_manager/charges_controller.rb +1 -0
- data/lib/app_manager/fail_safe.rb +14 -13
- data/lib/app_manager/graphql_helper.rb +24 -6
- data/lib/app_manager/version.rb +1 -1
- data/lib/generators/app_manager/install/install_generator.rb +8 -0
- data/lib/generators/app_manager/install/templates/add_external_charge_field.erb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb9bc0a4313a949cced988b7ffa0e53024315cfb2b9eb569ff894ed88ac8560
|
4
|
+
data.tar.gz: 0e472449feeed50f948429654a88af26270e04458a5b17c71ac1de744cea4561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9af3ef94b7b03ab0cfeaac11b0a86cca8f52aaf7fbb06505948284b85c50bec857d1c1299204213ca2e65b967d8a08f1856e3de74aaec8ffc4d5c541cecb5d62
|
7
|
+
data.tar.gz: 9cbb882ff71992dc5653257c53906cea1f5db98f981ffc74001f0aa00f81ff16c4103774140a4053a941f99ba1cc7d115dc27e21b6031817bd8da2cd692cceb5
|
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.5.1)
|
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
|
@@ -133,7 +133,7 @@ GEM
|
|
133
133
|
net-smtp (0.3.3)
|
134
134
|
net-protocol
|
135
135
|
nio4r (2.5.8)
|
136
|
-
nokogiri (1.
|
136
|
+
nokogiri (1.14.1)
|
137
137
|
mini_portile2 (~> 2.8.0)
|
138
138
|
racc (~> 1.4)
|
139
139
|
pry (0.14.1)
|
@@ -141,31 +141,31 @@ GEM
|
|
141
141
|
method_source (~> 1.0)
|
142
142
|
public_suffix (4.0.6)
|
143
143
|
racc (1.6.2)
|
144
|
-
rack (2.2.
|
144
|
+
rack (2.2.6.2)
|
145
145
|
rack-test (2.0.2)
|
146
146
|
rack (>= 1.3)
|
147
|
-
rails (7.0.4)
|
148
|
-
actioncable (= 7.0.4)
|
149
|
-
actionmailbox (= 7.0.4)
|
150
|
-
actionmailer (= 7.0.4)
|
151
|
-
actionpack (= 7.0.4)
|
152
|
-
actiontext (= 7.0.4)
|
153
|
-
actionview (= 7.0.4)
|
154
|
-
activejob (= 7.0.4)
|
155
|
-
activemodel (= 7.0.4)
|
156
|
-
activerecord (= 7.0.4)
|
157
|
-
activestorage (= 7.0.4)
|
158
|
-
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)
|
159
159
|
bundler (>= 1.15.0)
|
160
|
-
railties (= 7.0.4)
|
160
|
+
railties (= 7.0.4.2)
|
161
161
|
rails-dom-testing (2.0.3)
|
162
162
|
activesupport (>= 4.2.0)
|
163
163
|
nokogiri (>= 1.6)
|
164
|
-
rails-html-sanitizer (1.
|
164
|
+
rails-html-sanitizer (1.5.0)
|
165
165
|
loofah (~> 2.19, >= 2.19.1)
|
166
|
-
railties (7.0.4)
|
167
|
-
actionpack (= 7.0.4)
|
168
|
-
activesupport (= 7.0.4)
|
166
|
+
railties (7.0.4.2)
|
167
|
+
actionpack (= 7.0.4.2)
|
168
|
+
activesupport (= 7.0.4.2)
|
169
169
|
method_source
|
170
170
|
rake (>= 12.2)
|
171
171
|
thor (~> 1.0)
|
@@ -189,7 +189,7 @@ GEM
|
|
189
189
|
rspec-support (3.11.0)
|
190
190
|
thor (1.2.1)
|
191
191
|
timeout (0.3.1)
|
192
|
-
tzinfo (2.0.
|
192
|
+
tzinfo (2.0.6)
|
193
193
|
concurrent-ruby (~> 1.0)
|
194
194
|
webmock (3.14.0)
|
195
195
|
addressable (>= 2.8.0)
|
@@ -98,6 +98,7 @@ module AppManager
|
|
98
98
|
charge['shop_domain'] = params[:shop]
|
99
99
|
charge['interval'] = plan_data['interval']['value']
|
100
100
|
|
101
|
+
['api_client_id', 'return_url', 'decorated_return_url','id','id','currency'].each { |k| charge.delete k }
|
101
102
|
# new_plan_obj = AppManager::Client.new
|
102
103
|
# if !@plan_field.nil?
|
103
104
|
# begin
|
@@ -84,7 +84,8 @@ module AppManager
|
|
84
84
|
public_val = plan['public'] ? 1 : 0
|
85
85
|
store_base_plan = plan['store_base_plan'] ? 1 : 0
|
86
86
|
choose_later_plan = plan['choose_later_plan'] ? 1 : 0
|
87
|
-
|
87
|
+
is_external_charge = plan['is_external_charge'] ? 1 : 0
|
88
|
+
plan_data << AppManager::Plan.new(plan_id: plan["id"], type: plan["type"], name: plan["name"], price: plan["price"], offer_text: plan["offer_text"], description: plan["description"], interval: interval, shopify_plans: shopify_plans, trial_days: plan["trial_days"], test: plan_test, on_install: plan["on_install"], is_custom: is_custom, app_id: plan["app_id"], base_plan: plan["base_plan"], created_at: plan["created_at"], updated_at: plan["updated_at"], public: public_val, discount: plan["discount"], cycle_count: plan["cycle_count"], store_base_plan: store_base_plan, choose_later_plan: choose_later_plan, discount_type: plan["discount_type"], affiliate: affiliate, features: features, deleted_at: plan["deleted_at"],is_external_charge: plan["is_external_charge"],external_charge_limit: plan["external_charge_limit"],terms: plan["terms"])
|
88
89
|
end
|
89
90
|
AppManager::Plan.bulk_import plan_data
|
90
91
|
end
|
@@ -102,7 +103,7 @@ module AppManager
|
|
102
103
|
charge_data = []
|
103
104
|
charges.each do |charge|
|
104
105
|
charge_test = charge['test'] ? true : false
|
105
|
-
charge_data << AppManager::Charge.new(charge_id: charge["charge_id"], test: charge_test, status: charge["status"], name: charge["name"], type: charge["type"], price: charge["price"], interval: charge["interval"], trial_days: charge["trial_days"], billing_on: charge["billing_on"], activated_on: charge["activated_on"], trial_ends_on: charge["trial_ends_on"], cancelled_on: charge["cancelled_on"], expires_on: charge["expires_on"], plan_id: charge["plan_id"], description: charge["description"], shop_domain: charge["shop_domain"], created_at: charge["created_at"], updated_at: charge["updated_at"], app_id: charge["app_id"], sync: true)
|
106
|
+
charge_data << AppManager::Charge.new(c_id: charge["id"],charge_id: charge["charge_id"], test: charge_test, status: charge["status"], name: charge["name"], type: charge["type"], price: charge["price"], interval: charge["interval"], trial_days: charge["trial_days"], billing_on: charge["billing_on"], activated_on: charge["activated_on"], trial_ends_on: charge["trial_ends_on"], cancelled_on: charge["cancelled_on"], expires_on: charge["expires_on"], plan_id: charge["plan_id"], description: charge["description"], shop_domain: charge["shop_domain"], created_at: charge["created_at"], updated_at: charge["updated_at"], app_id: charge["app_id"], sync: true)
|
106
107
|
end
|
107
108
|
AppManager::Charge.bulk_import charge_data
|
108
109
|
end
|
@@ -120,7 +121,7 @@ module AppManager
|
|
120
121
|
apps_data = []
|
121
122
|
apps.each do |app|
|
122
123
|
# apps_data << AppManager::App.new(id: app['id'], name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
|
123
|
-
apps_data << AppManager::App.new(name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
|
124
|
+
apps_data << AppManager::App.new(app_id: app['id'],name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
|
124
125
|
end
|
125
126
|
AppManager::Charge.bulk_import apps_data
|
126
127
|
end
|
@@ -147,7 +148,7 @@ module AppManager
|
|
147
148
|
if discount_plans.any?
|
148
149
|
discount_plans_data = []
|
149
150
|
discount_plans.each do |discount_plan|
|
150
|
-
discount_plans_data << AppManager::DiscountPlan.new(discount: discount_plan['discount'], shop_domain: discount_plan['shop_domain'], cycle_count: discount_plan['cycle_count'], plan_id: discount_plan['plan_id'], created_by: discount_plan['created_by'], created_at: discount_plan['created_at'], updated_at: discount_plan['updated_at'], app_id: discount_plan['app_id'], discount_type: discount_plan['discount_type'])
|
151
|
+
discount_plans_data << AppManager::DiscountPlan.new(discount_plan_id: discount_plan['id'],discount: discount_plan['discount'], shop_domain: discount_plan['shop_domain'], cycle_count: discount_plan['cycle_count'], plan_id: discount_plan['plan_id'], created_by: discount_plan['created_by'], created_at: discount_plan['created_at'], updated_at: discount_plan['updated_at'], app_id: discount_plan['app_id'], discount_type: discount_plan['discount_type'])
|
151
152
|
# discount_plans_data << AppManager::DiscountPlan.new(id: discount_plan['id'], discount: discount_plan['discount'], shop_domain: discount_plan['shop_domain'], cycle_count: discount_plan['cycle_count'], plan_id: discount_plan['plan_id'], created_by: discount_plan['created_by'], created_at: discount_plan['created_at'], updated_at: discount_plan['updated_at'], app_id: discount_plan['app_id'], discount_type: discount_plan['discount_type'])
|
152
153
|
end
|
153
154
|
AppManager::DiscountPlan.bulk_import discount_plans_data
|
@@ -164,7 +165,7 @@ module AppManager
|
|
164
165
|
if extend_trials.any?
|
165
166
|
extend_trials_data = []
|
166
167
|
extend_trials.each do |extend_trial|
|
167
|
-
extend_trials_data << AppManager::ExtendTrial.new(shop_domain: extend_trial['shop_domain'], plan_id: extend_trial['plan_id'], app_id: extend_trial['app_id'], days: extend_trial['days'], created_by: extend_trial['created_by'], created_at: extend_trial['created_at'], updated_at: extend_trial['updated_at'], extend_trial_start_at: extend_trial['extend_trial_start_at'])
|
168
|
+
extend_trials_data << AppManager::ExtendTrial.new(extend_trial_id: extend_trial['id'],shop_domain: extend_trial['shop_domain'], plan_id: extend_trial['plan_id'], app_id: extend_trial['app_id'], days: extend_trial['days'], created_by: extend_trial['created_by'], created_at: extend_trial['created_at'], updated_at: extend_trial['updated_at'], extend_trial_start_at: extend_trial['extend_trial_start_at'])
|
168
169
|
# extend_trials_data << AppManager::ExtendTrial.new(id: extend_trial['id'], shop_domain: extend_trial['shop_domain'], plan_id: extend_trial['plan_id'], app_id: extend_trial['app_id'], days: extend_trial['days'], created_by: extend_trial['created_by'], created_at: extend_trial['created_at'], updated_at: extend_trial['updated_at'], extend_trial_start_at: extend_trial['extend_trial_start_at'])
|
169
170
|
end
|
170
171
|
AppManager::ExtendTrial.bulk_import extend_trials_data
|
@@ -181,7 +182,7 @@ module AppManager
|
|
181
182
|
if plan_users.any?
|
182
183
|
extend_plan_users = []
|
183
184
|
plan_users.each do |plan_user|
|
184
|
-
extend_plan_users << AppManager::PlanUser.new(shop_domain: plan_user['shop_domain'], plan_id: plan_user['plan_id'], created_by: plan_user['created_by'], created_at: plan_user['created_at'], updated_at: plan_user['updated_at'])
|
185
|
+
extend_plan_users << AppManager::PlanUser.new(plan_user_id: plan_user['id'],shop_domain: plan_user['shop_domain'], plan_id: plan_user['plan_id'], created_by: plan_user['created_by'], created_at: plan_user['created_at'], updated_at: plan_user['updated_at'])
|
185
186
|
# extend_plan_users << AppManager::PlanUser.new(id: plan_user['id'], shop_domain: plan_user['shop_domain'], plan_id: plan_user['plan_id'], created_by: plan_user['created_by'], created_at: plan_user['created_at'], updated_at: plan_user['updated_at'])
|
186
187
|
end
|
187
188
|
AppManager::ExtendTrial.bulk_import extend_plan_users
|
@@ -210,7 +211,7 @@ module AppManager
|
|
210
211
|
active_charge_price = charges.first['price']
|
211
212
|
elsif params['active_plan_id'].present? && !params['active_plan_id'].nil?
|
212
213
|
active_plan_id = params['active_plan_id']
|
213
|
-
plan_data = AppManager::Plan.where(
|
214
|
+
plan_data = AppManager::Plan.where(plan_id: active_plan_id)
|
214
215
|
active_charge_price = plan_data.first['price'] if plan_data.present?
|
215
216
|
end
|
216
217
|
|
@@ -219,7 +220,7 @@ module AppManager
|
|
219
220
|
custom_plan_ids = plan_users.pluck(:plan_id) if plan_users.present?
|
220
221
|
|
221
222
|
custom_plan_base_ids = []
|
222
|
-
plan_data = AppManager::Plan.where(
|
223
|
+
plan_data = AppManager::Plan.where(plan_id: custom_plan_ids).where.not(base_plan: nil)
|
223
224
|
custom_plan_base_ids = plan_data.pluck(:base_plan) if plan_data.present?
|
224
225
|
|
225
226
|
if active_plan_id && custom_plan_base_ids.include?(active_plan_id)
|
@@ -228,13 +229,13 @@ module AppManager
|
|
228
229
|
|
229
230
|
if custom_plan_base_ids.any?
|
230
231
|
if custom_plan_ids.present?
|
231
|
-
plans = AppManager::Plan.where("public = ? OR
|
232
|
+
plans = AppManager::Plan.where("public = ? OR plan_id IN (?)",true,custom_plan_ids).where.not(plan_id: custom_plan_base_ids)
|
232
233
|
else
|
233
|
-
plans = AppManager::Plan.where(public: true).where.not(
|
234
|
+
plans = AppManager::Plan.where(public: true).where.not(plan_id: custom_plan_base_ids)
|
234
235
|
end
|
235
236
|
else
|
236
237
|
if custom_plan_ids.present?
|
237
|
-
plans = AppManager::Plan.where("public = ? OR
|
238
|
+
plans = AppManager::Plan.where("public = ? OR plan_id IN (?)",true,custom_plan_ids)
|
238
239
|
else
|
239
240
|
plans = AppManager::Plan.where(public: true)
|
240
241
|
end
|
@@ -336,7 +337,7 @@ module AppManager
|
|
336
337
|
plan_data = {}
|
337
338
|
if params.any?
|
338
339
|
if params["plan_id"].present? && !params["plan_id"].nil?
|
339
|
-
plans = AppManager::Plan.where(
|
340
|
+
plans = AppManager::Plan.where(plan_id: params["plan_id"])
|
340
341
|
plans.each do |plan|
|
341
342
|
new_plan = {}
|
342
343
|
plan.as_json.each_with_index do |(key, value), index|
|
@@ -388,7 +389,7 @@ module AppManager
|
|
388
389
|
if params && params['trial_activated_at'].present? && !params['trial_activated_at'].nil? && params['shop_domain'].present? && params['plan_id'].present? && !params['plan_id'].nil?
|
389
390
|
@trial_activated_at = params['trial_activated_at']
|
390
391
|
@plan_id = params['plan_id']
|
391
|
-
plan_data = AppManager::Plan.where(
|
392
|
+
plan_data = AppManager::Plan.where(plan_id: @plan_id)
|
392
393
|
if plan_data.any?
|
393
394
|
trial_days = plan_data.first['trial_days']
|
394
395
|
trial_start_date = Date.parse(@trial_activated_at)
|
@@ -90,6 +90,28 @@ module AppManager
|
|
90
90
|
}
|
91
91
|
price_details.merge! plan_discount if plan_discount.any?
|
92
92
|
|
93
|
+
plan_var = {
|
94
|
+
"appRecurringPricingDetails": price_details,
|
95
|
+
}
|
96
|
+
|
97
|
+
line_items_data = [{
|
98
|
+
"plan": plan_var
|
99
|
+
}]
|
100
|
+
|
101
|
+
if plan['interval']['value'] == 'EVERY_30_DAYS' && plan['is_external_charge'].present? && plan['is_external_charge'] == true && plan['external_charge_limit'] != ''
|
102
|
+
plan_var_usage = {
|
103
|
+
"plan": {
|
104
|
+
"appUsagePricingDetails": {
|
105
|
+
"cappedAmount": {
|
106
|
+
"amount": plan['external_charge_limit'],
|
107
|
+
"currencyCode": "USD"
|
108
|
+
},
|
109
|
+
"terms": plan['terms']
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
line_items_data.push(plan_var_usage)
|
114
|
+
end
|
93
115
|
|
94
116
|
query = 'mutation(
|
95
117
|
$name: String!,
|
@@ -121,14 +143,10 @@ module AppManager
|
|
121
143
|
"returnUrl": return_url,
|
122
144
|
"trialDays": trial_days,
|
123
145
|
"test": plan_test,
|
124
|
-
"lineItems":
|
125
|
-
"plan": {
|
126
|
-
"appRecurringPricingDetails": price_details
|
127
|
-
}
|
128
|
-
}]
|
146
|
+
"lineItems": line_items_data
|
129
147
|
}
|
130
148
|
|
131
|
-
|
149
|
+
data = run_graph_api(query,variables)
|
132
150
|
return data
|
133
151
|
end
|
134
152
|
|
data/lib/app_manager/version.rb
CHANGED
@@ -31,6 +31,14 @@ module AppManager
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def create_external_charge_field
|
35
|
+
if self.class.migration_exists?("db/app_manager", "add_external_charge_field")
|
36
|
+
say_status("skipped", "Migration add_external_charge_field.rb already exists")
|
37
|
+
else
|
38
|
+
migration_template("add_external_charge_field.erb", "db/app_manager/add_external_charge_field.rb")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
34
42
|
|
35
43
|
private
|
36
44
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddExternalChargeField < ActiveRecord::Migration[<%= rails_migration_version %>]
|
2
|
+
def change
|
3
|
+
add_column :plans, :is_external_charge, :boolean unless column_exists? :plans, :is_external_charge, default: false
|
4
|
+
add_column :plans, :external_charge_limit, :bigint unless column_exists? :plans, :external_charge_limit
|
5
|
+
add_column :plans, :terms, :string unless column_exists? :plans, :terms
|
6
|
+
|
7
|
+
add_column :plans, :plan_id, :bigint unless column_exists? :plans, :plan_id
|
8
|
+
add_column :charges, :c_id, :bigint unless column_exists? :charges, :c_id
|
9
|
+
add_column :apps, :app_id, :bigint unless column_exists? :apps, :app_id
|
10
|
+
add_column :discount_plans, :discount_plan_id, :bigint unless column_exists? :discount_plans, :discount_plan_id
|
11
|
+
add_column :extend_trials, :extend_trial_id, :bigint unless column_exists? :extend_trials, :extend_trial_id
|
12
|
+
add_column :plan_users, :plan_user_id, :bigint unless column_exists? :plan_users, :plan_user_id
|
13
|
+
|
14
|
+
end
|
15
|
+
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: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hulkapps
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/app_manager/tasks/sync/local_app_manager.rake
|
119
119
|
- lib/app_manager/version.rb
|
120
120
|
- lib/generators/app_manager/install/install_generator.rb
|
121
|
+
- lib/generators/app_manager/install/templates/add_external_charge_field.erb
|
121
122
|
- lib/generators/app_manager/install/templates/add_plan_trial_grandfathered_to_shops.erb
|
122
123
|
- lib/generators/app_manager/install/templates/app_manager.rb.tt
|
123
124
|
- lib/generators/app_manager/install/templates/failsafe_tables.erb
|