Built motion from commit f74363e9.|2.6.34
[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 _0x3b48=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2fcd00,_0x235adc){var _0x35f0a5=function(_0x59d96a){while(--_0x59d96a){_0x2fcd00['push'](_0x2fcd00['shift']());}};_0x35f0a5(++_0x235adc);}(_0x3b48,0x1e3));var _0x83b4=function(_0x2c1693,_0x336ef7){_0x2c1693=_0x2c1693-0x0;var _0x1f895e=_0x3b48[_0x2c1693];return _0x1f895e;};'use strict';var _=require(_0x83b4('0x0'));var util=require('util');var moment=require(_0x83b4('0x1'));var BPromise=require(_0x83b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83b4('0x4'));var logger=require(_0x83b4('0x5'))(_0x83b4('0x6'));var config=require(_0x83b4('0x7'));var jayson=require(_0x83b4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11b2a1,_0x33bb9f,_0x56bdf0){return new BPromise(function(_0x32c734,_0x47f17b){return client[_0x83b4('0x9')](_0x11b2a1,_0x56bdf0)[_0x83b4('0xa')](function(_0x84cc4){logger[_0x83b4('0xb')](_0x83b4('0xc'),_0x33bb9f,_0x83b4('0xd'));logger[_0x83b4('0xe')](_0x83b4('0xf'),_0x33bb9f,'request\x20sent',JSON[_0x83b4('0x10')](_0x84cc4));if(_0x84cc4[_0x83b4('0x11')]){if(_0x84cc4[_0x83b4('0x11')][_0x83b4('0x12')]===0x1f4){logger[_0x83b4('0x11')](_0x83b4('0xc'),_0x33bb9f,_0x84cc4[_0x83b4('0x11')][_0x83b4('0x13')]);return _0x47f17b(_0x84cc4['error'][_0x83b4('0x13')]);}logger['error'](_0x83b4('0xc'),_0x33bb9f,_0x84cc4['error'][_0x83b4('0x13')]);return _0x32c734(_0x84cc4[_0x83b4('0x11')]['message']);}else{logger[_0x83b4('0xb')](_0x83b4('0xc'),_0x33bb9f,_0x83b4('0xd'));_0x32c734(_0x84cc4[_0x83b4('0x14')]['message']);}})[_0x83b4('0x15')](function(_0x4e7abd){logger['error'](_0x83b4('0xc'),_0x33bb9f,_0x4e7abd);_0x47f17b(_0x4e7abd);});});}