9de3ea6865d4f5664ff2c7d6db8ed4f5ba008665
[motion2.git] / server / api / mailTransferReport / mailTransferReport.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 _0x28b5=['request\x20sent','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x444c17,_0x20048c){var _0x6bbac2=function(_0x19ebaa){while(--_0x19ebaa){_0x444c17['push'](_0x444c17['shift']());}};_0x6bbac2(++_0x20048c);}(_0x28b5,0x69));var _0x528b=function(_0x15be32,_0x216976){_0x15be32=_0x15be32-0x0;var _0x5e9af0=_0x28b5[_0x15be32];return _0x5e9af0;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var moment=require('moment');var BPromise=require(_0x528b('0x2'));var rs=require(_0x528b('0x3'));var fs=require('fs');var Redis=require(_0x528b('0x4'));var db=require(_0x528b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x528b('0x6'));var config=require(_0x528b('0x7'));var jayson=require(_0x528b('0x8'));var client=jayson['client'][_0x528b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdb0183,_0x4e654d,_0x407eac){return new BPromise(function(_0x11cc77,_0x481f21){return client[_0x528b('0xa')](_0xdb0183,_0x407eac)[_0x528b('0xb')](function(_0x4d1402){logger[_0x528b('0xc')](_0x528b('0xd'),_0x4e654d,_0x528b('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4e654d,_0x528b('0xe'),JSON['stringify'](_0x4d1402));if(_0x4d1402[_0x528b('0xf')]){if(_0x4d1402[_0x528b('0xf')]['code']===0x1f4){logger[_0x528b('0xf')](_0x528b('0xd'),_0x4e654d,_0x4d1402[_0x528b('0xf')][_0x528b('0x10')]);return _0x481f21(_0x4d1402[_0x528b('0xf')][_0x528b('0x10')]);}logger['error'](_0x528b('0xd'),_0x4e654d,_0x4d1402[_0x528b('0xf')]['message']);return _0x11cc77(_0x4d1402['error'][_0x528b('0x10')]);}else{logger[_0x528b('0xc')](_0x528b('0xd'),_0x4e654d,_0x528b('0xe'));_0x11cc77(_0x4d1402['result'][_0x528b('0x10')]);}})['catch'](function(_0x385afe){logger[_0x528b('0xf')](_0x528b('0xd'),_0x4e654d,_0x385afe);_0x481f21(_0x385afe);});});}