5c7699ee4f23da1263e8aad4824997353ef9ad43
[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 _0x7d10=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0x7d10,0x1ce));var _0x07d1=function(_0x1f1927,_0x50ab1d){_0x1f1927=_0x1f1927-0x0;var _0x3521e4=_0x7d10[_0x1f1927];return _0x3521e4;};'use strict';var _=require('lodash');var util=require(_0x07d1('0x0'));var moment=require(_0x07d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x07d1('0x2'));var fs=require('fs');var Redis=require(_0x07d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07d1('0x4'));var logger=require(_0x07d1('0x5'))('rpc');var config=require(_0x07d1('0x6'));var jayson=require(_0x07d1('0x7'));var client=jayson[_0x07d1('0x8')][_0x07d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ab5c9,_0x3e5bbe,_0xc20041){return new BPromise(function(_0x65e41c,_0x3fd763){return client[_0x07d1('0xa')](_0x4ab5c9,_0xc20041)[_0x07d1('0xb')](function(_0x21ab00){logger[_0x07d1('0xc')](_0x07d1('0xd'),_0x3e5bbe,_0x07d1('0xe'));logger[_0x07d1('0xf')](_0x07d1('0x10'),_0x3e5bbe,_0x07d1('0xe'),JSON[_0x07d1('0x11')](_0x21ab00));if(_0x21ab00[_0x07d1('0x12')]){if(_0x21ab00['error']['code']===0x1f4){logger[_0x07d1('0x12')](_0x07d1('0xd'),_0x3e5bbe,_0x21ab00[_0x07d1('0x12')][_0x07d1('0x13')]);return _0x3fd763(_0x21ab00[_0x07d1('0x12')][_0x07d1('0x13')]);}logger[_0x07d1('0x12')](_0x07d1('0xd'),_0x3e5bbe,_0x21ab00[_0x07d1('0x12')][_0x07d1('0x13')]);return _0x65e41c(_0x21ab00['error'][_0x07d1('0x13')]);}else{logger[_0x07d1('0xc')](_0x07d1('0xd'),_0x3e5bbe,_0x07d1('0xe'));_0x65e41c(_0x21ab00['result'][_0x07d1('0x13')]);}})[_0x07d1('0x14')](function(_0x32021f){logger['error'](_0x07d1('0xd'),_0x3e5bbe,_0x32021f);_0x3fd763(_0x32021f);});});}