Built motion from commit (unavailable).|2.5.3
[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 _0x6b60=['message','result','catch','CreateCmHopperFinal','create','body','options','raw','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error'];(function(_0x1a05d8,_0x188aba){var _0x1f16bf=function(_0x34f1db){while(--_0x34f1db){_0x1a05d8['push'](_0x1a05d8['shift']());}};_0x1f16bf(++_0x188aba);}(_0x6b60,0xe9));var _0x06b6=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x6b60[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require('lodash');var util=require(_0x06b6('0x0'));var moment=require('moment');var BPromise=require(_0x06b6('0x1'));var rs=require(_0x06b6('0x2'));var fs=require('fs');var Redis=require(_0x06b6('0x3'));var db=require(_0x06b6('0x4'))['db'];var utils=require(_0x06b6('0x5'));var logger=require(_0x06b6('0x6'))(_0x06b6('0x7'));var config=require(_0x06b6('0x8'));var jayson=require(_0x06b6('0x9'));var client=jayson[_0x06b6('0xa')][_0x06b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x157746,_0x242017,_0x396a81){return new BPromise(function(_0x49d5ab,_0x853fa9){return client[_0x06b6('0xc')](_0x157746,_0x396a81)[_0x06b6('0xd')](function(_0x3c9a39){logger['info'](_0x06b6('0xe'),_0x242017,_0x06b6('0xf'));logger[_0x06b6('0x10')](_0x06b6('0x11'),_0x242017,_0x06b6('0xf'),JSON['stringify'](_0x3c9a39));if(_0x3c9a39['error']){if(_0x3c9a39[_0x06b6('0x12')]['code']===0x1f4){logger[_0x06b6('0x12')](_0x06b6('0xe'),_0x242017,_0x3c9a39['error'][_0x06b6('0x13')]);return _0x853fa9(_0x3c9a39[_0x06b6('0x12')]['message']);}logger[_0x06b6('0x12')](_0x06b6('0xe'),_0x242017,_0x3c9a39[_0x06b6('0x12')][_0x06b6('0x13')]);return _0x49d5ab(_0x3c9a39[_0x06b6('0x12')][_0x06b6('0x13')]);}else{logger['info'](_0x06b6('0xe'),_0x242017,_0x06b6('0xf'));_0x49d5ab(_0x3c9a39[_0x06b6('0x14')][_0x06b6('0x13')]);}})[_0x06b6('0x15')](function(_0x509299){logger[_0x06b6('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x242017,_0x509299);_0x853fa9(_0x509299);});});}exports[_0x06b6('0x16')]=function(_0x43d90d){var _0x4a3ecb=this;return new Promise(function(_0x347f51,_0x2a783b){return db['CmHopperFinal'][_0x06b6('0x17')](_0x43d90d[_0x06b6('0x18')],{'raw':_0x43d90d[_0x06b6('0x19')]?_0x43d90d['options'][_0x06b6('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2ca547){logger['info'](_0x06b6('0x16'),_0x43d90d);logger[_0x06b6('0x10')](_0x06b6('0x16'),_0x43d90d,JSON[_0x06b6('0x1b')](_0x2ca547));_0x347f51(_0x2ca547);})['catch'](function(_0x69620f){logger[_0x06b6('0x12')]('CreateCmHopperFinal',_0x69620f['message'],_0x43d90d);_0x2a783b(_0x4a3ecb[_0x06b6('0x12')](0x1f4,_0x69620f[_0x06b6('0x13')]));});});};