34f2473b9752418d2b20c2866410dd40c4911c24
[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 _0x8f62=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','result','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','bluebird','../../mysqldb'];(function(_0x5174f9,_0x12a4f8){var _0x547d00=function(_0x3a091b){while(--_0x3a091b){_0x5174f9['push'](_0x5174f9['shift']());}};_0x547d00(++_0x12a4f8);}(_0x8f62,0x1af));var _0x28f6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f62[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x28f6('0x0'));var util=require(_0x28f6('0x1'));var moment=require('moment');var BPromise=require(_0x28f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28f6('0x3'))['db'];var utils=require(_0x28f6('0x4'));var logger=require(_0x28f6('0x5'))(_0x28f6('0x6'));var config=require(_0x28f6('0x7'));var jayson=require(_0x28f6('0x8'));var client=jayson[_0x28f6('0x9')][_0x28f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x608d0d,_0x37b437,_0x348f61){return new BPromise(function(_0xb2578f,_0x203e0a){return client[_0x28f6('0xb')](_0x608d0d,_0x348f61)['then'](function(_0x49682d){logger[_0x28f6('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x37b437,_0x28f6('0xd'));logger[_0x28f6('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x37b437,_0x28f6('0xd'),JSON[_0x28f6('0xf')](_0x49682d));if(_0x49682d[_0x28f6('0x10')]){if(_0x49682d[_0x28f6('0x10')][_0x28f6('0x11')]===0x1f4){logger[_0x28f6('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x37b437,_0x49682d['error']['message']);return _0x203e0a(_0x49682d['error']['message']);}logger[_0x28f6('0x10')](_0x28f6('0x12'),_0x37b437,_0x49682d[_0x28f6('0x10')]['message']);return _0xb2578f(_0x49682d[_0x28f6('0x10')]['message']);}else{logger[_0x28f6('0xc')](_0x28f6('0x12'),_0x37b437,_0x28f6('0xd'));_0xb2578f(_0x49682d[_0x28f6('0x13')][_0x28f6('0x14')]);}})[_0x28f6('0x15')](function(_0x4cc684){logger[_0x28f6('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x37b437,_0x4cc684);_0x203e0a(_0x4cc684);});});}exports[_0x28f6('0x16')]=function(_0xafa269){var _0x5a5cad=this;return new Promise(function(_0x2bf8ec,_0x10c3c8){return db[_0x28f6('0x17')][_0x28f6('0x18')](_0xafa269[_0x28f6('0x19')],{'raw':_0xafa269[_0x28f6('0x1a')]?_0xafa269[_0x28f6('0x1a')][_0x28f6('0x1b')]===undefined?!![]:![]:!![]})[_0x28f6('0x1c')](function(_0x52986f){logger[_0x28f6('0xc')](_0x28f6('0x16'),_0xafa269);logger[_0x28f6('0xe')](_0x28f6('0x16'),_0xafa269,JSON[_0x28f6('0xf')](_0x52986f));_0x2bf8ec(_0x52986f);})['catch'](function(_0x402e7d){logger[_0x28f6('0x10')](_0x28f6('0x16'),_0x402e7d['message'],_0xafa269);_0x10c3c8(_0x5a5cad[_0x28f6('0x10')](0x1f4,_0x402e7d['message']));});});};