7c0b110e6a6e67043ae9f6e3c0c5885ed7f2345a
[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 _0x80cf=['info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x58ac9b,_0x34477f){var _0x523cfe=function(_0x2cdad4){while(--_0x2cdad4){_0x58ac9b['push'](_0x58ac9b['shift']());}};_0x523cfe(++_0x34477f);}(_0x80cf,0xfc));var _0xf80c=function(_0x15f68a,_0x1cdaad){_0x15f68a=_0x15f68a-0x0;var _0x33b4b1=_0x80cf[_0x15f68a];return _0x33b4b1;};'use strict';var _=require(_0xf80c('0x0'));var util=require(_0xf80c('0x1'));var moment=require(_0xf80c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf80c('0x3'))['db'];var utils=require(_0xf80c('0x4'));var logger=require(_0xf80c('0x5'))(_0xf80c('0x6'));var config=require(_0xf80c('0x7'));var jayson=require(_0xf80c('0x8'));var client=jayson[_0xf80c('0x9')][_0xf80c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ca158,_0x38cdd8,_0xa86276){return new BPromise(function(_0x54d8fd,_0x45e775){return client[_0xf80c('0xb')](_0x2ca158,_0xa86276)['then'](function(_0x32644e){logger[_0xf80c('0xc')](_0xf80c('0xd'),_0x38cdd8,_0xf80c('0xe'));logger[_0xf80c('0xf')](_0xf80c('0x10'),_0x38cdd8,'request\x20sent',JSON[_0xf80c('0x11')](_0x32644e));if(_0x32644e[_0xf80c('0x12')]){if(_0x32644e[_0xf80c('0x12')]['code']===0x1f4){logger[_0xf80c('0x12')](_0xf80c('0xd'),_0x38cdd8,_0x32644e[_0xf80c('0x12')][_0xf80c('0x13')]);return _0x45e775(_0x32644e[_0xf80c('0x12')]['message']);}logger['error'](_0xf80c('0xd'),_0x38cdd8,_0x32644e[_0xf80c('0x12')][_0xf80c('0x13')]);return _0x54d8fd(_0x32644e[_0xf80c('0x12')]['message']);}else{logger['info'](_0xf80c('0xd'),_0x38cdd8,_0xf80c('0xe'));_0x54d8fd(_0x32644e[_0xf80c('0x14')][_0xf80c('0x13')]);}})[_0xf80c('0x15')](function(_0x4672a8){logger['error'](_0xf80c('0xd'),_0x38cdd8,_0x4672a8);_0x45e775(_0x4672a8);});});}