d07d2135d98e87c2034a6f1b6b56a5f17782c16c
[motion2.git] / server / api / userWhatsappQueue / userWhatsappQueue.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 _0x77a0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3fe47a,_0x5610b9){var _0x39d23b=function(_0x3c9200){while(--_0x3c9200){_0x3fe47a['push'](_0x3fe47a['shift']());}};_0x39d23b(++_0x5610b9);}(_0x77a0,0x1f0));var _0x077a=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0x77a0[_0x104662];return _0x19cba7;};'use strict';var _=require(_0x077a('0x0'));var util=require(_0x077a('0x1'));var moment=require(_0x077a('0x2'));var BPromise=require(_0x077a('0x3'));var rs=require(_0x077a('0x4'));var fs=require('fs');var Redis=require(_0x077a('0x5'));var db=require(_0x077a('0x6'))['db'];var utils=require(_0x077a('0x7'));var logger=require(_0x077a('0x8'))('rpc');var config=require(_0x077a('0x9'));var jayson=require(_0x077a('0xa'));var client=jayson[_0x077a('0xb')][_0x077a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f9888,_0x5f2451,_0x269a1f){return new BPromise(function(_0x939ba3,_0x4795d1){return client[_0x077a('0xd')](_0x1f9888,_0x269a1f)[_0x077a('0xe')](function(_0x37ab12){logger[_0x077a('0xf')](_0x077a('0x10'),_0x5f2451,_0x077a('0x11'));logger[_0x077a('0x12')](_0x077a('0x13'),_0x5f2451,'request\x20sent',JSON['stringify'](_0x37ab12));if(_0x37ab12[_0x077a('0x14')]){if(_0x37ab12[_0x077a('0x14')][_0x077a('0x15')]===0x1f4){logger[_0x077a('0x14')](_0x077a('0x10'),_0x5f2451,_0x37ab12[_0x077a('0x14')]['message']);return _0x4795d1(_0x37ab12[_0x077a('0x14')][_0x077a('0x16')]);}logger['error'](_0x077a('0x10'),_0x5f2451,_0x37ab12['error'][_0x077a('0x16')]);return _0x939ba3(_0x37ab12['error'][_0x077a('0x16')]);}else{logger[_0x077a('0xf')](_0x077a('0x10'),_0x5f2451,_0x077a('0x11'));_0x939ba3(_0x37ab12[_0x077a('0x17')]['message']);}})[_0x077a('0x18')](function(_0x5028ef){logger['error'](_0x077a('0x10'),_0x5f2451,_0x5028ef);_0x4795d1(_0x5028ef);});});}