lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb in imperituroard-0.4.0 vs lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb in imperituroard-0.4.1
- old
+ new
@@ -47,23 +47,58 @@
p "send_responce_formatter(hub_answer)"
p hub_answer
for a in hub_answer[:body][:res_body]["messages"]
- s1 = {"to": a["phone_number"], "status": {"groupId": 1,
+ s1 = {"to": {"phoneNumber": a["phone_number"]}, "status": {"groupId": 1,
"groupName": "PENDING",
"id": 26,
"name": "MESSAGE_ACCEPTED",
"description": "Message sent to next instance"},
"messageId": a["message_id"]}
+
messages_sect.append(s1)
end
p messages_sect
- mess_to_recip = {"messages": messages_sect}
-
+ mess_to_recip = {"bulkId": "00000000-0000-0000-0000-000000000000", "messages": messages_sect}
{:code => 200, :result => "Data processed", :body => {:mess_to_recip => mess_to_recip}}
+ end
+
+
+ def delivery_report_transform(hub_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", "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"}}
+
+ report_to_recip = {
+ "results": [
+ {
+
+ # "bulkId": "9a410cb0-091e-41cf-a640-5d37bee14d9a",
+ "messageId": hub_report["report"]["message_id"],
+ "to": hub_report["report"]["number"],
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
+ "status": {
+ "groupId": 3,
+ "groupName": "DELIVERED",
+ "id": 5,
+ "name": "DELIVERED_TO_HANDSET",
+ "description": "Message delivered to handset"
+ },
+ "error": {
+ "groupId": 0,
+ "groupName": "Ok",
+ "id": 0,
+ "name": "NO_ERROR",
+ "description": "No Error",
+ "permanent": false
+ }
+ }
+ ]
+ }
+
+ {:code => 200, :result => "Data processed", :body => {:report_to_recip => report_to_recip}}
end
end