Built motion from commit 20b39a97.|2.6.29
[motion2.git] / server / api / mailSubstatus / mailSubstatus.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 _0x82e4=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x317a2a,_0x8a0a1c){var _0x3e75e8=function(_0x16937c){while(--_0x16937c){_0x317a2a['push'](_0x317a2a['shift']());}};_0x3e75e8(++_0x8a0a1c);}(_0x82e4,0xd1));var _0x482e=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x82e4[_0x38987f];return _0x4cb697;};'use strict';var _=require(_0x482e('0x0'));var util=require(_0x482e('0x1'));var moment=require('moment');var BPromise=require(_0x482e('0x2'));var rs=require(_0x482e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x482e('0x4'))('rpc');var config=require(_0x482e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x482e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xefb1e5,_0x11caa5,_0x5ed955){return new BPromise(function(_0x53206d,_0xbcef93){return client[_0x482e('0x7')](_0xefb1e5,_0x5ed955)[_0x482e('0x8')](function(_0x1e12cf){logger[_0x482e('0x9')](_0x482e('0xa'),_0x11caa5,_0x482e('0xb'));logger[_0x482e('0xc')](_0x482e('0xd'),_0x11caa5,_0x482e('0xb'),JSON[_0x482e('0xe')](_0x1e12cf));if(_0x1e12cf['error']){if(_0x1e12cf['error']['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x1e12cf[_0x482e('0xf')]['message']);return _0xbcef93(_0x1e12cf[_0x482e('0xf')][_0x482e('0x10')]);}logger['error'](_0x482e('0xa'),_0x11caa5,_0x1e12cf[_0x482e('0xf')][_0x482e('0x10')]);return _0x53206d(_0x1e12cf[_0x482e('0xf')]['message']);}else{logger[_0x482e('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x482e('0xb'));_0x53206d(_0x1e12cf['result']['message']);}})['catch'](function(_0x2c0b40){logger[_0x482e('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x2c0b40);_0xbcef93(_0x2c0b40);});});}