lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb in imperituroard-1.1.13 vs lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb in imperituroard-1.1.14
- old
+ new
@@ -1,7 +1,16 @@
+require 'imperituroard/projects/iot/internal_functions'
+
class Dabrab
+ attr_accessor :internal_func, :log_level
+
+ def initialize(log_level)
+ @internal_func = InternalFunc.new
+ @log_level = log_level
+ end
+
def dabrabyt_text_field_parse(stri)
button_url = ""
image = ""
button_text = ""
text = stri
@@ -190,10 +199,12 @@
end
def delivery_report_transform(hub_report_in)
+ internal_func.printer_texter({:input => "Start delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
+
#{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber", "controller"=>"reports", "action"=>"delivery", "report"=>{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber"}}
#p hub_report
#p "hub_report"
report_to_recip = []
@@ -219,11 +230,13 @@
36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
:error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
} #Viber subscriber not exists
}
- if hub_report_in.key?("msg_status")
+ if hub_report_in.key?("msg_status") && !hub_report_in.key?("_json") && !hub_report_in["report"].key?("_json")
+ internal_func.printer_texter({:input => "One message delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
+
hub_report = hub_report_in
if data_for_status[hub_report["msg_status"]] != nil && data_for_status[hub_report["msg_status"]] != {} && data_for_status[hub_report["msg_status"]] != [] && data_for_status[hub_report["msg_status"]] != ""
report_to_recip.push({
@@ -280,9 +293,14 @@
end
else
hub_report_in["_json"].each {|hub_report2|
+
+ internal_func.printer_texter({:input => "Start Mass message delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
+
+ internal_func.printer_texter({:input => {:hub_report2 => hub_report2}, :procedure => "Dabrab.delivery_report_transform"}, log_level)
+
if data_for_status[hub_report2["msg_status"]] != nil && data_for_status[hub_report2["msg_status"]] != {} && data_for_status[hub_report2["msg_status"]] != [] && data_for_status[hub_report2["msg_status"]] != ""
report_to_recip.push({
"bulkId": "00000000-0000-0000-0000-000000000000",