191129dc5dda2bd69f2266ce4e3ac5678b2a0b06
[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 _0x328b=['../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x3c9e44,_0x2fee15){var _0x17da1f=function(_0x460b7a){while(--_0x460b7a){_0x3c9e44['push'](_0x3c9e44['shift']());}};_0x17da1f(++_0x2fee15);}(_0x328b,0x1ea));var _0xb328=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x328b[_0x4350c2];return _0x8b6406;};'use strict';var _=require(_0xb328('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb328('0x1'));var fs=require('fs');var Redis=require(_0xb328('0x2'));var db=require(_0xb328('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb328('0x4'))(_0xb328('0x5'));var config=require('../../config/environment');var jayson=require(_0xb328('0x6'));var client=jayson[_0xb328('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b4a1,_0x57135b,_0x4628b8){return new BPromise(function(_0x3d8b4d,_0x4d0706){return client[_0xb328('0x8')](_0x10b4a1,_0x4628b8)[_0xb328('0x9')](function(_0x410746){logger[_0xb328('0xa')](_0xb328('0xb'),_0x57135b,_0xb328('0xc'));logger['debug'](_0xb328('0xd'),_0x57135b,_0xb328('0xc'),JSON[_0xb328('0xe')](_0x410746));if(_0x410746[_0xb328('0xf')]){if(_0x410746[_0xb328('0xf')]['code']===0x1f4){logger['error'](_0xb328('0xb'),_0x57135b,_0x410746[_0xb328('0xf')][_0xb328('0x10')]);return _0x4d0706(_0x410746['error'][_0xb328('0x10')]);}logger[_0xb328('0xf')](_0xb328('0xb'),_0x57135b,_0x410746[_0xb328('0xf')][_0xb328('0x10')]);return _0x3d8b4d(_0x410746[_0xb328('0xf')]['message']);}else{logger[_0xb328('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x57135b,_0xb328('0xc'));_0x3d8b4d(_0x410746[_0xb328('0x11')]['message']);}})[_0xb328('0x12')](function(_0x36dea1){logger[_0xb328('0xf')](_0xb328('0xb'),_0x57135b,_0x36dea1);_0x4d0706(_0x36dea1);});});}