From 80a0cba537d8c9f2933571fe9ca6e6036ada1605 Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Tue, 6 Mar 2018 11:19:19 +0630 Subject: [PATCH] For Pull from master --- app/models/license.rb | 26 ++++++++++--------- .../transactions/bookings/index.html.erb | 2 +- app/views/transactions/bookings/show.html.erb | 2 +- app/views/transactions/orders/index.html.erb | 2 +- app/views/transactions/orders/show.html.erb | 2 +- config/license.yml | 15 +++++++++++ 6 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 config/license.yml diff --git a/app/models/license.rb b/app/models/license.rb index 1cbce908..7d935185 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -70,13 +70,11 @@ class License # For Local System def detail_with_local_file() renewal_date_str = read_license("renewable_date") - if check_expiring(renewal_date_str) # return for all ok return 1 else has_license = verify_license() - if has_license # return for expiring return 2 @@ -137,23 +135,27 @@ class License api_token = read_license_no_decrypt("api_token") @params = { query: {lookup_type: "application", api_token: api_token} } response = self.class.get("/verify", @params) - @varified = response.parsed_response - Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s - if (@varified["status"]) - if (!check_expired(@varified["renewable_date"])) - return true - end - else - delete_license_file - end + rescue SocketError => e + Rails.logger.debug "In Socket errror" + return true + rescue => e + @varified = response.parsed_response + Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s + if (@varified["status"]) + if (!check_expired(@varified["renewable_date"])) + return true + end + else + delete_license_file + end return false end # Check Expired before 30 days def check_expiring(renewal_date_str) if !renewal_date_str.empty? - renewal_date = DateTime.parse(renewal_date_str) + renewal_date = DateTime.parse(renewal_date_str) renewal_date > Date.today.advance(:days => 30) end end diff --git a/app/views/transactions/bookings/index.html.erb b/app/views/transactions/bookings/index.html.erb index 7c587d32..463ab27c 100755 --- a/app/views/transactions/bookings/index.html.erb +++ b/app/views/transactions/bookings/index.html.erb @@ -64,7 +64,7 @@ <%= link_to booking.booking_id, transactions_booking_path(booking) %> <%= link_to booking.sale_id, transactions_sale_path(booking.sale_id) rescue '-' %> - <%= booking.dining_facility.name %> + <%= booking.dining_facility.name rescue '' %> <%= booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> <%= booking.checkout_at.utc.getlocal.strftime("%I:%M %p") rescue '-' %> <%= booking.checkin_by rescue '-' %> diff --git a/app/views/transactions/bookings/show.html.erb b/app/views/transactions/bookings/show.html.erb index 06668d5e..67065b1c 100755 --- a/app/views/transactions/bookings/show.html.erb +++ b/app/views/transactions/bookings/show.html.erb @@ -46,7 +46,7 @@ <%= @booking.booking_id%> <%= link_to @booking.sale_id, transactions_sale_path(booking.sale_id) rescue '-' %> - <%= @booking.dining_facility.name %> + <%= @booking.dining_facility.name rescue '' %> <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") rescue '-' %> <%= @booking.checkin_by rescue '-' %> diff --git a/app/views/transactions/orders/index.html.erb b/app/views/transactions/orders/index.html.erb index 2fdef7bf..41aa63e6 100755 --- a/app/views/transactions/orders/index.html.erb +++ b/app/views/transactions/orders/index.html.erb @@ -66,7 +66,7 @@ <%= link_to order.order_id, transactions_order_path(order) %> - <%= @dining.type %>-<%= @dining.name %> + <%if !@dining.nil? %> <%= @dining.type %>-<%= @dining.name %> <% else %>  <% end %> <%= order.waiters %> <%= order.order_type %> <%= order.customer.name rescue '-' %> diff --git a/app/views/transactions/orders/show.html.erb b/app/views/transactions/orders/show.html.erb index 0a487437..1d260383 100755 --- a/app/views/transactions/orders/show.html.erb +++ b/app/views/transactions/orders/show.html.erb @@ -29,7 +29,7 @@ - <%= @dining.type %>-<%= @dining.name %> + <%if !@dining.nil? %> <%= @dining.type %>-<%= @dining.name %> <% else %>  <% end %> <%= @order.waiters rescue '-' %> <%= @order.order_type %> <%= @order.customer.name rescue '-' %> diff --git a/config/license.yml b/config/license.yml new file mode 100644 index 00000000..fefa7d40 --- /dev/null +++ b/config/license.yml @@ -0,0 +1,15 @@ +iv_key: f3ICP0M2HJLIeXURn3yv5A== +shop_name: sx_license_test3 +email: aungmyo.zaw@code2lab.com +telephone: 0099404923 +fax: 49494949432 +address: Yangon +dbhost: m4ZCds3ANyqjqCgZVSTfRQ== +dbschema: +mvY73HAjWqMrby9Zu+tBg== +dbusername: UO2rBxhoSfDEKutK2OEL4A== +dbpassword: sVpy+Lj6i3MpT+CjoJrDOw== +api_token: srTutEOCzphDFOXQqVWnZwQDTXiHdzwzY +app_token: pSzbojYfXLNpSLmhdNTfLCtxfzeUahO +plan_sku: +53eC6oiOsBRxtBgVjyULw== +renewable_date: hon6p5jvfirTFniaFrH0qw== +plan_name: eaMIWzHlTnljCEkE2oxoHg==