app_manager 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd770dce16b7f6239b4d98067abafbf7701a3dd5b02cd4094b2f264c2ce9d8dd
4
- data.tar.gz: 466aa7a4aba2811f53b582b0d2fa6dd7b94b2eb0430ef146729214414175ad8c
3
+ metadata.gz: 9e3986aadebfd51cccf040bfd0a5ad36041de436ac3ab4c074fb0a2174a9da10
4
+ data.tar.gz: 83e772b1847481e9e91745f91569973d16e1809eb7732affe4f6f46ab3385c89
5
5
  SHA512:
6
- metadata.gz: 6d6e415883e4a5e08155776f041da234c099ec0a9c17814be2013d7efafa91263d117046c35b2dd95c4a0809230a637878cb1d9e1f785b385e9f9588269547db
7
- data.tar.gz: 0d3e02114538f9178a88cfc1e2f30409227852088755121c47dd1648d20bd1919e78228f197c41199ae02f2251fef66953ae6ee560b46389ded1bd555f48088a
6
+ metadata.gz: 8793bb25fdfbff2ed36e2c0f4f24f63d6c40c1bc6df999ef101cfa6f6b66d2732729743f1ab2298d66debfbd6785ea47bddcdacf7fa3d21efcebdd17bcda5b3b
7
+ data.tar.gz: 1b040a0afaedeb15cf4892f9010105e4f1ea1e6f7a92b75c5d65dc5e1c3a5870fd3eb4a01f825738a5c8fbc722a8f3dd63fe3be8eb217bf19ac4859bc1d716bd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.2.1)
4
+ app_manager (1.2.2)
5
5
  httparty
6
6
  kaminari (>= 0.16.3)
7
7
  rails (>= 5.2.0)
@@ -18,11 +18,12 @@ module AppManager
18
18
  if plan_data['price'] == 0
19
19
  active_charge_data = plan_obj.get_charge(params[:shop])
20
20
  begin
21
- if active_charge_data && active_charge_data.any? && !active_charge_data['active_charge']['charge_id'].nil?
21
+ if active_charge_data && active_charge_data.any? && !active_charge_data['active_charge'].nil? && !active_charge_data['active_charge']['charge_id'].nil?
22
22
  gq_obj = AppManager::GraphqlHelper.new(@shop.shopify_domain,@shop.shopify_token)
23
23
  rec_cancel_data = gq_obj.recurring_charge_cancel_api_call(active_charge_data['active_charge']['charge_id'],@shop)
24
- if !rec_cancel_data["errors"].present? && (rec_cancel_data["data"].present? && rec_cancel_data["data"]["appSubscriptionCancel"].present? && !rec_cancel_data["data"]["appSubscriptionCreate"]["userErrors"].any? && (rec_cancel_data["data"]["appSubscriptionCancel"]["appSubscription"]["status"] == 'CANCELLED'))
25
- plan_obj.cancel_charge(params[:shop],active_charge_data['active_charge']['plan_id'])
24
+ if !rec_cancel_data["errors"].present? && (rec_cancel_data["data"].present? && rec_cancel_data["data"]["appSubscriptionCancel"].present? && !rec_cancel_data["data"]["appSubscriptionCancel"]["userErrors"].any? && (rec_cancel_data["data"]["appSubscriptionCancel"]["appSubscription"]["status"] == 'CANCELLED'))
25
+ cancelled_charge_id = rec_cancel_data["data"]["appSubscriptionCancel"]["appSubscription"]["id"].split('/')[-1]
26
+ plan_obj.cancel_charge(params[:shop],cancelled_charge_id)
26
27
  end
27
28
  end
28
29
  rescue Exception => e
@@ -29,36 +29,90 @@ module AppManager
29
29
  save_api_plans(params["plans"])
30
30
  rescue Exception => e
31
31
  Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
32
+ begin
33
+ create_plan_table
34
+ save_api_plans(params["plans"])
35
+ rescue Exception => e
36
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
37
+ end
32
38
  end
39
+
40
+
33
41
  begin
34
42
  save_api_charges(params["charges"])
35
43
  rescue Exception => e
36
- Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
44
+ Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
45
+ begin
46
+ create_charges_table
47
+ save_api_charges(params["charges"])
48
+ rescue Exception => e
49
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
50
+ end
37
51
  end
52
+
53
+
38
54
  begin
39
55
  save_api_apps(params["apps"])
40
56
  rescue Exception => e
41
- Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
57
+ Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
58
+ begin
59
+ create_apps_table
60
+ save_api_apps(params["apps"])
61
+ rescue Exception => e
62
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
63
+ end
42
64
  end
65
+
66
+
43
67
  begin
44
68
  save_api_app_structures(params["app_structures"])
45
69
  rescue Exception => e
46
- Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
70
+ Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
71
+ begin
72
+ create_app_structures_table
73
+ save_api_app_structures(params["app_structures"])
74
+ rescue Exception => e
75
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
76
+ end
47
77
  end
78
+
79
+
48
80
  begin
49
81
  save_api_discount_plans(params["discount_plans"])
50
82
  rescue Exception => e
51
83
  Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
84
+ begin
85
+ create_discount_plans_table
86
+ save_api_discount_plans(params["discount_plans"])
87
+ rescue Exception => e
88
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
89
+ end
52
90
  end
91
+
92
+
53
93
  begin
54
94
  save_api_extend_trials(params["extend_trials"])
55
95
  rescue Exception => e
56
- Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
96
+ Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
97
+ begin
98
+ create_extend_trials_table
99
+ save_api_extend_trials(params["extend_trials"])
100
+ rescue Exception => e
101
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
102
+ end
57
103
  end
104
+
105
+
58
106
  begin
59
107
  save_api_plan_users(params["plan_users"])
60
108
  rescue Exception => e
61
- Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
109
+ Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
110
+ begin
111
+ create_plan_users_table
112
+ save_api_plan_users(params["plan_users"])
113
+ rescue Exception => e
114
+ Rails.logger.info "APP MANAGER FailSafe >>>> #{e.inspect}"
115
+ end
62
116
  end
63
117
  end
64
118
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.2.1"
4
+ VERSION = "1.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps