f94fdea8ffe66a6a77ec279dfaea12e0799c84fc
[motion2.git] / server / api / userMailQueue / userMailQueue.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 _0xf3d0=['http','request','then','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4e5f04,_0x42f942){var _0xd6b5e8=function(_0x53c925){while(--_0x53c925){_0x4e5f04['push'](_0x4e5f04['shift']());}};_0xd6b5e8(++_0x42f942);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x3ef55b,_0x5942da){_0x3ef55b=_0x3ef55b-0x0;var _0x350391=_0xf3d0[_0x3ef55b];return _0x350391;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var moment=require('moment');var BPromise=require(_0x0f3d('0x2'));var rs=require(_0x0f3d('0x3'));var fs=require('fs');var Redis=require(_0x0f3d('0x4'));var db=require(_0x0f3d('0x5'))['db'];var utils=require(_0x0f3d('0x6'));var logger=require(_0x0f3d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f3d('0x8'));var client=jayson[_0x0f3d('0x9')][_0x0f3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d14c5,_0x2e168c,_0x2dbd7c){return new BPromise(function(_0x4246a8,_0x3fb2f8){return client[_0x0f3d('0xb')](_0x1d14c5,_0x2dbd7c)[_0x0f3d('0xc')](function(_0x3e9a5a){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x2e168c,'request\x20sent');logger[_0x0f3d('0xd')](_0x0f3d('0xe'),_0x2e168c,_0x0f3d('0xf'),JSON[_0x0f3d('0x10')](_0x3e9a5a));if(_0x3e9a5a['error']){if(_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x12')]===0x1f4){logger[_0x0f3d('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')]['message']);return _0x3fb2f8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x14')]);return _0x4246a8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}else{logger[_0x0f3d('0x15')](_0x0f3d('0x13'),_0x2e168c,_0x0f3d('0xf'));_0x4246a8(_0x3e9a5a[_0x0f3d('0x16')][_0x0f3d('0x14')]);}})[_0x0f3d('0x17')](function(_0x17500d){logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x17500d);_0x3fb2f8(_0x17500d);});});}