Built motion from commit 47436d59.|2.6.7
[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 _0x8199=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','MailTransferReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8199,0x105));var _0x9819=function(_0x4a8184,_0x5a195a){_0x4a8184=_0x4a8184-0x0;var _0x426cf9=_0x8199[_0x4a8184];return _0x426cf9;};'use strict';var _=require(_0x9819('0x0'));var util=require(_0x9819('0x1'));var moment=require(_0x9819('0x2'));var BPromise=require(_0x9819('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9819('0x4'));var db=require(_0x9819('0x5'))['db'];var utils=require(_0x9819('0x6'));var logger=require(_0x9819('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9819('0x8'));var client=jayson[_0x9819('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dbac8,_0x38585a,_0x45ad26){return new BPromise(function(_0x384f51,_0xd090d6){return client[_0x9819('0xa')](_0x2dbac8,_0x45ad26)['then'](function(_0x37f48b){logger[_0x9819('0xb')](_0x9819('0xc'),_0x38585a,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x38585a,'request\x20sent',JSON[_0x9819('0xd')](_0x37f48b));if(_0x37f48b[_0x9819('0xe')]){if(_0x37f48b[_0x9819('0xe')]['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x38585a,_0x37f48b['error']['message']);return _0xd090d6(_0x37f48b['error'][_0x9819('0xf')]);}logger['error'](_0x9819('0xc'),_0x38585a,_0x37f48b[_0x9819('0xe')]['message']);return _0x384f51(_0x37f48b[_0x9819('0xe')][_0x9819('0xf')]);}else{logger[_0x9819('0xb')](_0x9819('0xc'),_0x38585a,_0x9819('0x10'));_0x384f51(_0x37f48b[_0x9819('0x11')][_0x9819('0xf')]);}})[_0x9819('0x12')](function(_0xf49ad0){logger[_0x9819('0xe')](_0x9819('0xc'),_0x38585a,_0xf49ad0);_0xd090d6(_0xf49ad0);});});}