28eeb807b9186947804d42cea8d4c682581b285d
[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 _0x2b40=['../../config/environment','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x5c56fa,_0x320e5a){var _0x64b637=function(_0x34fdb9){while(--_0x34fdb9){_0x5c56fa['push'](_0x5c56fa['shift']());}};_0x64b637(++_0x320e5a);}(_0x2b40,0x64));var _0x02b4=function(_0x5d9171,_0x5ccd64){_0x5d9171=_0x5d9171-0x0;var _0x49aa7b=_0x2b40[_0x5d9171];return _0x49aa7b;};'use strict';var _=require('lodash');var util=require(_0x02b4('0x0'));var moment=require(_0x02b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x02b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02b4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x02b4('0x4'))('rpc');var config=require(_0x02b4('0x5'));var jayson=require(_0x02b4('0x6'));var client=jayson[_0x02b4('0x7')][_0x02b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39acbe,_0x389833,_0x54a066){return new BPromise(function(_0x689a71,_0x19fa03){return client['request'](_0x39acbe,_0x54a066)['then'](function(_0x552e09){logger[_0x02b4('0x9')](_0x02b4('0xa'),_0x389833,'request\x20sent');logger['debug'](_0x02b4('0xb'),_0x389833,_0x02b4('0xc'),JSON['stringify'](_0x552e09));if(_0x552e09[_0x02b4('0xd')]){if(_0x552e09['error']['code']===0x1f4){logger[_0x02b4('0xd')](_0x02b4('0xa'),_0x389833,_0x552e09['error'][_0x02b4('0xe')]);return _0x19fa03(_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);}logger['error'](_0x02b4('0xa'),_0x389833,_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);return _0x689a71(_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);}else{logger[_0x02b4('0x9')](_0x02b4('0xa'),_0x389833,_0x02b4('0xc'));_0x689a71(_0x552e09['result']['message']);}})['catch'](function(_0x46c415){logger[_0x02b4('0xd')](_0x02b4('0xa'),_0x389833,_0x46c415);_0x19fa03(_0x46c415);});});}