ddc66d4b8b8e865dce035ab0f482db6d7363820a
[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 _0x64ca=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x64ca,0x1de));var _0xa64c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x64ca[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa64c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa64c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa64c('0x2'));var logger=require('../../config/logger')(_0xa64c('0x3'));var config=require(_0xa64c('0x4'));var jayson=require(_0xa64c('0x5'));var client=jayson[_0xa64c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cb916,_0x3baf75,_0x285335){return new BPromise(function(_0x315c7a,_0x1df20d){return client[_0xa64c('0x7')](_0x5cb916,_0x285335)[_0xa64c('0x8')](function(_0x592a6e){logger[_0xa64c('0x9')](_0xa64c('0xa'),_0x3baf75,_0xa64c('0xb'));logger[_0xa64c('0xc')](_0xa64c('0xd'),_0x3baf75,_0xa64c('0xb'),JSON[_0xa64c('0xe')](_0x592a6e));if(_0x592a6e[_0xa64c('0xf')]){if(_0x592a6e['error'][_0xa64c('0x10')]===0x1f4){logger[_0xa64c('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3baf75,_0x592a6e[_0xa64c('0xf')][_0xa64c('0x11')]);return _0x1df20d(_0x592a6e['error'][_0xa64c('0x11')]);}logger[_0xa64c('0xf')](_0xa64c('0xa'),_0x3baf75,_0x592a6e[_0xa64c('0xf')][_0xa64c('0x11')]);return _0x315c7a(_0x592a6e[_0xa64c('0xf')][_0xa64c('0x11')]);}else{logger['info'](_0xa64c('0xa'),_0x3baf75,_0xa64c('0xb'));_0x315c7a(_0x592a6e[_0xa64c('0x12')][_0xa64c('0x11')]);}})[_0xa64c('0x13')](function(_0xaea138){logger[_0xa64c('0xf')](_0xa64c('0xa'),_0x3baf75,_0xaea138);_0x1df20d(_0xaea138);});});}