lib/imperituroard/projects/mhub.rb in imperituroard-0.5.1 vs lib/imperituroard/projects/mhub.rb in imperituroard-0.5.2
- old
+ new
@@ -126,11 +126,15 @@
output_params = {}
hub_resp = {}
begin
mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
- result = crm_connector.crm_status_1(mes_report)
- output_params = {"code": 200, "result": "Data processed", "body": {"answer": {"code": 200, "status": "Success"}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ result = crm_connector.crm_status_2(mes_report)
+ if result[:body][:res_body]["GetReportsResult"]==""
+ output_params = {"code": 200, "result": "Data processed", "body": {"answer": {"code": 200, "status": "Success"}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ else
+ output_params = {"code": 202, "result": "CRM returned error #{result[:body][:res_body]["GetReportsResult"].to_s}", "body": {"answer": {"code": 200, "status": "Success"}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ end
rescue
output_params = {"code": 500, "result": "MhubFunctions_2.rec_deliv_report_2: Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
telegram_connector.telegram_message(output_params)
end
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"}, "debug")
\ No newline at end of file