a93cc81ff96804caa4f2072bf028a843c8902b45
[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 _0x647b=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xc0449a,_0x4628e9){var _0x3b2eda=function(_0x5e5ce1){while(--_0x5e5ce1){_0xc0449a['push'](_0xc0449a['shift']());}};_0x3b2eda(++_0x4628e9);}(_0x647b,0xea));var _0xb647=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x647b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb647('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb647('0x1'));var rs=require(_0xb647('0x2'));var fs=require('fs');var Redis=require(_0xb647('0x3'));var db=require(_0xb647('0x4'))['db'];var utils=require(_0xb647('0x5'));var logger=require(_0xb647('0x6'))(_0xb647('0x7'));var config=require(_0xb647('0x8'));var jayson=require(_0xb647('0x9'));var client=jayson[_0xb647('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x800c3f,_0x28806a,_0xa66f9b){return new BPromise(function(_0x11416d,_0x189388){return client[_0xb647('0xb')](_0x800c3f,_0xa66f9b)[_0xb647('0xc')](function(_0x2737ab){logger[_0xb647('0xd')](_0xb647('0xe'),_0x28806a,_0xb647('0xf'));logger[_0xb647('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x28806a,_0xb647('0xf'),JSON[_0xb647('0x11')](_0x2737ab));if(_0x2737ab['error']){if(_0x2737ab[_0xb647('0x12')][_0xb647('0x13')]===0x1f4){logger[_0xb647('0x12')](_0xb647('0xe'),_0x28806a,_0x2737ab[_0xb647('0x12')][_0xb647('0x14')]);return _0x189388(_0x2737ab['error']['message']);}logger['error'](_0xb647('0xe'),_0x28806a,_0x2737ab[_0xb647('0x12')]['message']);return _0x11416d(_0x2737ab[_0xb647('0x12')][_0xb647('0x14')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x28806a,_0xb647('0xf'));_0x11416d(_0x2737ab[_0xb647('0x15')][_0xb647('0x14')]);}})[_0xb647('0x16')](function(_0x1a6488){logger[_0xb647('0x12')](_0xb647('0xe'),_0x28806a,_0x1a6488);_0x189388(_0x1a6488);});});}