Built motion from commit 00bf23f6.|2.6.16
[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 _0x6583=['rpc','client','then','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1b2b7e,_0x543746){var _0x598f57=function(_0x5bfd9f){while(--_0x5bfd9f){_0x1b2b7e['push'](_0x1b2b7e['shift']());}};_0x598f57(++_0x543746);}(_0x6583,0x6c));var _0x3658=function(_0x4978de,_0x5912e4){_0x4978de=_0x4978de-0x0;var _0x675221=_0x6583[_0x4978de];return _0x675221;};'use strict';var _=require(_0x3658('0x0'));var util=require('util');var moment=require(_0x3658('0x1'));var BPromise=require(_0x3658('0x2'));var rs=require(_0x3658('0x3'));var fs=require('fs');var Redis=require(_0x3658('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3658('0x5'));var logger=require('../../config/logger')(_0x3658('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3658('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50316f,_0x1e6aad,_0x1a48e2){return new BPromise(function(_0x22e3d1,_0xe68c81){return client['request'](_0x50316f,_0x1a48e2)[_0x3658('0x8')](function(_0x27a49a){logger['info'](_0x3658('0x9'),_0x1e6aad,'request\x20sent');logger[_0x3658('0xa')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x1e6aad,_0x3658('0xb'),JSON[_0x3658('0xc')](_0x27a49a));if(_0x27a49a[_0x3658('0xd')]){if(_0x27a49a[_0x3658('0xd')][_0x3658('0xe')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1e6aad,_0x27a49a['error'][_0x3658('0xf')]);return _0xe68c81(_0x27a49a['error'][_0x3658('0xf')]);}logger[_0x3658('0xd')](_0x3658('0x9'),_0x1e6aad,_0x27a49a['error'][_0x3658('0xf')]);return _0x22e3d1(_0x27a49a['error'][_0x3658('0xf')]);}else{logger[_0x3658('0x10')](_0x3658('0x9'),_0x1e6aad,_0x3658('0xb'));_0x22e3d1(_0x27a49a[_0x3658('0x11')][_0x3658('0xf')]);}})[_0x3658('0x12')](function(_0x432d12){logger[_0x3658('0xd')](_0x3658('0x9'),_0x1e6aad,_0x432d12);_0xe68c81(_0x432d12);});});}