6d9f28868604a2d7ca634b780ebe3dc1c15e2b56
[motion2.git] / server / api / whatsappTransferReport / whatsappTransferReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x69a3=['debug','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xc751f5,_0x41d3d6){var _0x4b98eb=function(_0x36d10d){while(--_0x36d10d){_0xc751f5['push'](_0xc751f5['shift']());}};_0x4b98eb(++_0x41d3d6);}(_0x69a3,0x18e));var _0x369a=function(_0x3bec89,_0xa9396a){_0x3bec89=_0x3bec89-0x0;var _0x1c3745=_0x69a3[_0x3bec89];return _0x1c3745;};'use strict';var _=require('lodash');var util=require(_0x369a('0x0'));var moment=require(_0x369a('0x1'));var BPromise=require(_0x369a('0x2'));var rs=require(_0x369a('0x3'));var fs=require('fs');var Redis=require(_0x369a('0x4'));var db=require(_0x369a('0x5'))['db'];var utils=require(_0x369a('0x6'));var logger=require(_0x369a('0x7'))(_0x369a('0x8'));var config=require(_0x369a('0x9'));var jayson=require(_0x369a('0xa'));var client=jayson[_0x369a('0xb')][_0x369a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10299c,_0x56ddf1,_0x34fb3c){return new BPromise(function(_0x4974c8,_0x46f3f5){return client['request'](_0x10299c,_0x34fb3c)[_0x369a('0xd')](function(_0x120d29){logger['info'](_0x369a('0xe'),_0x56ddf1,_0x369a('0xf'));logger[_0x369a('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x56ddf1,_0x369a('0xf'),JSON[_0x369a('0x11')](_0x120d29));if(_0x120d29[_0x369a('0x12')]){if(_0x120d29[_0x369a('0x12')][_0x369a('0x13')]===0x1f4){logger['error'](_0x369a('0xe'),_0x56ddf1,_0x120d29[_0x369a('0x12')]['message']);return _0x46f3f5(_0x120d29[_0x369a('0x12')]['message']);}logger[_0x369a('0x12')](_0x369a('0xe'),_0x56ddf1,_0x120d29[_0x369a('0x12')][_0x369a('0x14')]);return _0x4974c8(_0x120d29[_0x369a('0x12')][_0x369a('0x14')]);}else{logger[_0x369a('0x15')](_0x369a('0xe'),_0x56ddf1,'request\x20sent');_0x4974c8(_0x120d29['result']['message']);}})[_0x369a('0x16')](function(_0x21fed9){logger[_0x369a('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x56ddf1,_0x21fed9);_0x46f3f5(_0x21fed9);});});}