94ca9bfb174f8887c3b21f12527ada71b89fb10c
[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 _0x2f43=['error','code','message','request\x20sent','result','VoiceTransferReport','create','body','raw','then','CreateVoiceTransferReport','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x2f43,0xfc));var _0x32f4=function(_0x4ba20e,_0x5d7255){_0x4ba20e=_0x4ba20e-0x0;var _0x1cda38=_0x2f43[_0x4ba20e];return _0x1cda38;};'use strict';var _=require(_0x32f4('0x0'));var util=require(_0x32f4('0x1'));var moment=require('moment');var BPromise=require(_0x32f4('0x2'));var rs=require(_0x32f4('0x3'));var fs=require('fs');var Redis=require(_0x32f4('0x4'));var db=require(_0x32f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32f4('0x6'))(_0x32f4('0x7'));var config=require(_0x32f4('0x8'));var jayson=require(_0x32f4('0x9'));var client=jayson[_0x32f4('0xa')][_0x32f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539f88,_0x5d235a,_0xe1a13){return new BPromise(function(_0x435c7c,_0x5a2007){return client[_0x32f4('0xc')](_0x539f88,_0xe1a13)['then'](function(_0x510894){logger[_0x32f4('0xd')](_0x32f4('0xe'),_0x5d235a,'request\x20sent');logger[_0x32f4('0xf')](_0x32f4('0x10'),_0x5d235a,'request\x20sent',JSON[_0x32f4('0x11')](_0x510894));if(_0x510894[_0x32f4('0x12')]){if(_0x510894[_0x32f4('0x12')][_0x32f4('0x13')]===0x1f4){logger[_0x32f4('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);return _0x5a2007(_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);}logger[_0x32f4('0x12')](_0x32f4('0xe'),_0x5d235a,_0x510894[_0x32f4('0x12')]['message']);return _0x435c7c(_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);}else{logger[_0x32f4('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x32f4('0x15'));_0x435c7c(_0x510894[_0x32f4('0x16')][_0x32f4('0x14')]);}})['catch'](function(_0x4375c1){logger[_0x32f4('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x4375c1);_0x5a2007(_0x4375c1);});});}exports['CreateVoiceTransferReport']=function(_0x46d135){var _0x240b55=this;return new Promise(function(_0x19322,_0x44c2a9){return db[_0x32f4('0x17')][_0x32f4('0x18')](_0x46d135[_0x32f4('0x19')],{'raw':_0x46d135['options']?_0x46d135['options'][_0x32f4('0x1a')]===undefined?!![]:![]:!![]})[_0x32f4('0x1b')](function(_0x88d094){logger['info'](_0x32f4('0x1c'),_0x46d135);logger[_0x32f4('0xf')](_0x32f4('0x1c'),_0x46d135,JSON[_0x32f4('0x11')](_0x88d094));_0x19322(_0x88d094);})[_0x32f4('0x1d')](function(_0x4a8620){logger[_0x32f4('0x12')](_0x32f4('0x1c'),_0x4a8620[_0x32f4('0x14')],_0x46d135);_0x44c2a9(_0x240b55['error'](0x1f4,_0x4a8620[_0x32f4('0x14')]));});});};