afdcb960f535f54c252a8fbf4954757184f24314
[motion2.git] / server / api / voiceTransferReport / voiceTransferReport.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 _0x0440=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info'];(function(_0x15b1d2,_0x477ba2){var _0x33f85b=function(_0x146a3f){while(--_0x146a3f){_0x15b1d2['push'](_0x15b1d2['shift']());}};_0x33f85b(++_0x477ba2);}(_0x0440,0x109));var _0x0044=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x0440[_0x35c5a8];return _0x34782c;};'use strict';var _=require(_0x0044('0x0'));var util=require('util');var moment=require(_0x0044('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0044('0x2'));var db=require(_0x0044('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0044('0x4'))(_0x0044('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0044('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c75e,_0x433daf,_0x57d879){return new BPromise(function(_0x53ba03,_0x410214){return client[_0x0044('0x7')](_0x25c75e,_0x57d879)[_0x0044('0x8')](function(_0x3b4057){logger[_0x0044('0x9')](_0x0044('0xa'),_0x433daf,'request\x20sent');logger[_0x0044('0xb')](_0x0044('0xc'),_0x433daf,_0x0044('0xd'),JSON[_0x0044('0xe')](_0x3b4057));if(_0x3b4057[_0x0044('0xf')]){if(_0x3b4057[_0x0044('0xf')][_0x0044('0x10')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x433daf,_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);return _0x410214(_0x3b4057[_0x0044('0xf')]['message']);}logger[_0x0044('0xf')](_0x0044('0xa'),_0x433daf,_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);return _0x53ba03(_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);}else{logger[_0x0044('0x9')](_0x0044('0xa'),_0x433daf,_0x0044('0xd'));_0x53ba03(_0x3b4057[_0x0044('0x12')]['message']);}})[_0x0044('0x13')](function(_0xcd7370){logger[_0x0044('0xf')](_0x0044('0xa'),_0x433daf,_0xcd7370);_0x410214(_0xcd7370);});});}exports[_0x0044('0x14')]=function(_0x4ba251){var _0x3e46af=this;return new Promise(function(_0x129dd8,_0x1542f5){return db[_0x0044('0x15')][_0x0044('0x16')](_0x4ba251[_0x0044('0x17')],{'raw':_0x4ba251['options']?_0x4ba251['options'][_0x0044('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7386){logger[_0x0044('0x9')](_0x0044('0x14'),_0x4ba251);logger[_0x0044('0xb')](_0x0044('0x14'),_0x4ba251,JSON[_0x0044('0xe')](_0x1c7386));_0x129dd8(_0x1c7386);})['catch'](function(_0x59175a){logger[_0x0044('0xf')](_0x0044('0x14'),_0x59175a[_0x0044('0x11')],_0x4ba251);_0x1542f5(_0x3e46af[_0x0044('0xf')](0x1f4,_0x59175a['message']));});});};