3983d85e4d4ac1b4d946b9e6dc072986b2559247
[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 _0x6c67=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x6c67,0x103));var _0x76c6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6c67[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var moment=require('moment');var BPromise=require(_0x76c6('0x2'));var rs=require(_0x76c6('0x3'));var fs=require('fs');var Redis=require(_0x76c6('0x4'));var db=require(_0x76c6('0x5'))['db'];var utils=require(_0x76c6('0x6'));var logger=require(_0x76c6('0x7'))(_0x76c6('0x8'));var config=require('../../config/environment');var jayson=require(_0x76c6('0x9'));var client=jayson['client'][_0x76c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ec257,_0x4b208f,_0xc4b26e){return new BPromise(function(_0x58dd89,_0x105563){return client[_0x76c6('0xb')](_0x5ec257,_0xc4b26e)[_0x76c6('0xc')](function(_0x1209f4){logger[_0x76c6('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4b208f,_0x76c6('0xe'));logger['debug'](_0x76c6('0xf'),_0x4b208f,'request\x20sent',JSON[_0x76c6('0x10')](_0x1209f4));if(_0x1209f4[_0x76c6('0x11')]){if(_0x1209f4[_0x76c6('0x11')]['code']===0x1f4){logger[_0x76c6('0x11')](_0x76c6('0x12'),_0x4b208f,_0x1209f4[_0x76c6('0x11')][_0x76c6('0x13')]);return _0x105563(_0x1209f4[_0x76c6('0x11')]['message']);}logger['error'](_0x76c6('0x12'),_0x4b208f,_0x1209f4['error']['message']);return _0x58dd89(_0x1209f4['error']['message']);}else{logger[_0x76c6('0xd')](_0x76c6('0x12'),_0x4b208f,_0x76c6('0xe'));_0x58dd89(_0x1209f4[_0x76c6('0x14')][_0x76c6('0x13')]);}})[_0x76c6('0x15')](function(_0x3a78c3){logger[_0x76c6('0x11')](_0x76c6('0x12'),_0x4b208f,_0x3a78c3);_0x105563(_0x3a78c3);});});}