Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / cmHopperFinal / cmHopperFinal.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 _0x6f7c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','debug','lodash','util','moment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x6f7c,0xc8));var _0xc6f7=function(_0x3cae21,_0x97726f){_0x3cae21=_0x3cae21-0x0;var _0x4b13b8=_0x6f7c[_0x3cae21];return _0x4b13b8;};'use strict';var _=require(_0xc6f7('0x0'));var util=require(_0xc6f7('0x1'));var moment=require(_0xc6f7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6f7('0x3'));var fs=require('fs');var Redis=require(_0xc6f7('0x4'));var db=require(_0xc6f7('0x5'))['db'];var utils=require(_0xc6f7('0x6'));var logger=require(_0xc6f7('0x7'))(_0xc6f7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc6f7('0x9')][_0xc6f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a1175,_0x5bc463,_0x273ba4){return new BPromise(function(_0x78b86,_0x3c4ad3){return client[_0xc6f7('0xb')](_0x5a1175,_0x273ba4)[_0xc6f7('0xc')](function(_0x28f790){logger['info'](_0xc6f7('0xd'),_0x5bc463,_0xc6f7('0xe'));logger['debug'](_0xc6f7('0xf'),_0x5bc463,_0xc6f7('0xe'),JSON[_0xc6f7('0x10')](_0x28f790));if(_0x28f790[_0xc6f7('0x11')]){if(_0x28f790[_0xc6f7('0x11')]['code']===0x1f4){logger[_0xc6f7('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x5bc463,_0x28f790['error'][_0xc6f7('0x12')]);return _0x3c4ad3(_0x28f790['error'][_0xc6f7('0x12')]);}logger[_0xc6f7('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x5bc463,_0x28f790[_0xc6f7('0x11')][_0xc6f7('0x12')]);return _0x78b86(_0x28f790[_0xc6f7('0x11')]['message']);}else{logger[_0xc6f7('0x13')](_0xc6f7('0xd'),_0x5bc463,_0xc6f7('0xe'));_0x78b86(_0x28f790[_0xc6f7('0x14')]['message']);}})[_0xc6f7('0x15')](function(_0x19ef58){logger[_0xc6f7('0x11')](_0xc6f7('0xd'),_0x5bc463,_0x19ef58);_0x3c4ad3(_0x19ef58);});});}exports[_0xc6f7('0x16')]=function(_0x87a0b9){var _0xccf595=this;return new Promise(function(_0x53fef5,_0x388bb1){return db[_0xc6f7('0x17')][_0xc6f7('0x18')](_0x87a0b9[_0xc6f7('0x19')],{'raw':_0x87a0b9[_0xc6f7('0x1a')]?_0x87a0b9[_0xc6f7('0x1a')][_0xc6f7('0x1b')]===undefined?!![]:![]:!![]})[_0xc6f7('0xc')](function(_0x323fda){logger[_0xc6f7('0x13')](_0xc6f7('0x16'),_0x87a0b9);logger[_0xc6f7('0x1c')](_0xc6f7('0x16'),_0x87a0b9,JSON[_0xc6f7('0x10')](_0x323fda));_0x53fef5(_0x323fda);})[_0xc6f7('0x15')](function(_0x586e07){logger[_0xc6f7('0x11')](_0xc6f7('0x16'),_0x586e07['message'],_0x87a0b9);_0x388bb1(_0xccf595[_0xc6f7('0x11')](0x1f4,_0x586e07[_0xc6f7('0x12')]));});});};