8bf72cbad54712bd250b3614e7506dedcffe8fdf
[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 _0x15dc=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x3ec939,_0x2869e5){var _0xfd3450=function(_0x57efc7){while(--_0x57efc7){_0x3ec939['push'](_0x3ec939['shift']());}};_0xfd3450(++_0x2869e5);}(_0x15dc,0x18c));var _0xc15d=function(_0x25ae57,_0x2df7c3){_0x25ae57=_0x25ae57-0x0;var _0x1d44d3=_0x15dc[_0x25ae57];return _0x1d44d3;};'use strict';var _=require(_0xc15d('0x0'));var util=require(_0xc15d('0x1'));var moment=require(_0xc15d('0x2'));var BPromise=require(_0xc15d('0x3'));var rs=require(_0xc15d('0x4'));var fs=require('fs');var Redis=require(_0xc15d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc15d('0x6'));var logger=require(_0xc15d('0x7'))(_0xc15d('0x8'));var config=require(_0xc15d('0x9'));var jayson=require(_0xc15d('0xa'));var client=jayson[_0xc15d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c4f4,_0x27617b,_0x2d152b){return new BPromise(function(_0x3a4f46,_0x7ef240){return client[_0xc15d('0xc')](_0x37c4f4,_0x2d152b)[_0xc15d('0xd')](function(_0x501887){logger[_0xc15d('0xe')](_0xc15d('0xf'),_0x27617b,_0xc15d('0x10'));logger[_0xc15d('0x11')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x27617b,_0xc15d('0x10'),JSON[_0xc15d('0x12')](_0x501887));if(_0x501887[_0xc15d('0x13')]){if(_0x501887[_0xc15d('0x13')]['code']===0x1f4){logger[_0xc15d('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x27617b,_0x501887['error'][_0xc15d('0x14')]);return _0x7ef240(_0x501887[_0xc15d('0x13')][_0xc15d('0x14')]);}logger[_0xc15d('0x13')](_0xc15d('0xf'),_0x27617b,_0x501887[_0xc15d('0x13')][_0xc15d('0x14')]);return _0x3a4f46(_0x501887[_0xc15d('0x13')][_0xc15d('0x14')]);}else{logger[_0xc15d('0xe')](_0xc15d('0xf'),_0x27617b,_0xc15d('0x10'));_0x3a4f46(_0x501887['result']['message']);}})[_0xc15d('0x15')](function(_0x5e0616){logger['error'](_0xc15d('0xf'),_0x27617b,_0x5e0616);_0x7ef240(_0x5e0616);});});}