Built motion from commit (unavailable).|2.5.4
[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 _0x52fa=['moment','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateCmHopperFinal','create','raw','lodash','util'];(function(_0x438fa9,_0x1ed4b2){var _0x84b22=function(_0x22c433){while(--_0x22c433){_0x438fa9['push'](_0x438fa9['shift']());}};_0x84b22(++_0x1ed4b2);}(_0x52fa,0x82));var _0xa52f=function(_0x5a9a7e,_0x316413){_0x5a9a7e=_0x5a9a7e-0x0;var _0x34dd51=_0x52fa[_0x5a9a7e];return _0x34dd51;};'use strict';var _=require(_0xa52f('0x0'));var util=require(_0xa52f('0x1'));var moment=require(_0xa52f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa52f('0x3'));var db=require(_0xa52f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa52f('0x5'));var config=require(_0xa52f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa52f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x449efd,_0x22be8c,_0xc5d6bd){return new BPromise(function(_0x30e7ab,_0x4e739b){return client[_0xa52f('0x8')](_0x449efd,_0xc5d6bd)[_0xa52f('0x9')](function(_0x42e0f5){logger[_0xa52f('0xa')](_0xa52f('0xb'),_0x22be8c,_0xa52f('0xc'));logger[_0xa52f('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x22be8c,_0xa52f('0xc'),JSON[_0xa52f('0xe')](_0x42e0f5));if(_0x42e0f5[_0xa52f('0xf')]){if(_0x42e0f5[_0xa52f('0xf')]['code']===0x1f4){logger['error'](_0xa52f('0xb'),_0x22be8c,_0x42e0f5[_0xa52f('0xf')][_0xa52f('0x10')]);return _0x4e739b(_0x42e0f5[_0xa52f('0xf')][_0xa52f('0x10')]);}logger[_0xa52f('0xf')](_0xa52f('0xb'),_0x22be8c,_0x42e0f5[_0xa52f('0xf')][_0xa52f('0x10')]);return _0x30e7ab(_0x42e0f5['error'][_0xa52f('0x10')]);}else{logger['info'](_0xa52f('0xb'),_0x22be8c,_0xa52f('0xc'));_0x30e7ab(_0x42e0f5[_0xa52f('0x11')][_0xa52f('0x10')]);}})[_0xa52f('0x12')](function(_0x88aefb){logger['error'](_0xa52f('0xb'),_0x22be8c,_0x88aefb);_0x4e739b(_0x88aefb);});});}exports[_0xa52f('0x13')]=function(_0x2b5bce){var _0x531669=this;return new Promise(function(_0x56b723,_0x55803b){return db['CmHopperFinal'][_0xa52f('0x14')](_0x2b5bce['body'],{'raw':_0x2b5bce['options']?_0x2b5bce['options'][_0xa52f('0x15')]===undefined?!![]:![]:!![]})[_0xa52f('0x9')](function(_0x5cd49e){logger[_0xa52f('0xa')](_0xa52f('0x13'),_0x2b5bce);logger[_0xa52f('0xd')]('CreateCmHopperFinal',_0x2b5bce,JSON[_0xa52f('0xe')](_0x5cd49e));_0x56b723(_0x5cd49e);})['catch'](function(_0x10ab0a){logger[_0xa52f('0xf')]('CreateCmHopperFinal',_0x10ab0a['message'],_0x2b5bce);_0x55803b(_0x531669[_0xa52f('0xf')](0x1f4,_0x10ab0a[_0xa52f('0x10')]));});});};