7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/app_manager/model.rb', line 7
def has_plan
if !self[AppManager.configuration.plan_id_or_name_field]
return false;
end
if self[AppManager.configuration.field_names['grandfathered']]
return true;
end
plan_id = self[AppManager.configuration.plan_id_or_name_field]
if !plan_id
Rails.logger.info "Plan id found nil or not set"
return false;
end
remaining_days = self.get_remaining_days
if remaining_days > 0
return true
end
plan_obj = AppManager::Client.new
shop_domain = self[AppManager.configuration.shopify_domain_field]
active_charge = plan_obj.get_charge(shop_domain) rescue nil
return active_charge['active_charge'].present? && !active_charge['active_charge'].nil? ? true : false
end
|