9a178bacc9597d10b777ff8165e83e46266f7146
[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 _0x5d77=['create','body','options','raw','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x5d77,0xee));var _0x75d7=function(_0x39b69b,_0x7e3b73){_0x39b69b=_0x39b69b-0x0;var _0x1c0ab7=_0x5d77[_0x39b69b];return _0x1c0ab7;};'use strict';var _=require(_0x75d7('0x0'));var util=require(_0x75d7('0x1'));var moment=require('moment');var BPromise=require(_0x75d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75d7('0x3'))(_0x75d7('0x4'));var config=require('../../config/environment');var jayson=require(_0x75d7('0x5'));var client=jayson[_0x75d7('0x6')][_0x75d7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4319dc,_0x200d53,_0x484cf4){return new BPromise(function(_0x50274c,_0x45d0cf){return client[_0x75d7('0x8')](_0x4319dc,_0x484cf4)[_0x75d7('0x9')](function(_0x599e96){logger[_0x75d7('0xa')](_0x75d7('0xb'),_0x200d53,_0x75d7('0xc'));logger[_0x75d7('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x200d53,_0x75d7('0xc'),JSON[_0x75d7('0xe')](_0x599e96));if(_0x599e96[_0x75d7('0xf')]){if(_0x599e96[_0x75d7('0xf')][_0x75d7('0x10')]===0x1f4){logger[_0x75d7('0xf')](_0x75d7('0xb'),_0x200d53,_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);return _0x45d0cf(_0x599e96[_0x75d7('0xf')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x200d53,_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);return _0x50274c(_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);}else{logger[_0x75d7('0xa')](_0x75d7('0xb'),_0x200d53,_0x75d7('0xc'));_0x50274c(_0x599e96[_0x75d7('0x12')][_0x75d7('0x11')]);}})[_0x75d7('0x13')](function(_0x592b2d){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x200d53,_0x592b2d);_0x45d0cf(_0x592b2d);});});}exports[_0x75d7('0x14')]=function(_0x38a0b9){var _0x1e0ffa=this;return new Promise(function(_0x477bee,_0xbc5e3b){return db[_0x75d7('0x15')][_0x75d7('0x16')](_0x38a0b9[_0x75d7('0x17')],{'raw':_0x38a0b9['options']?_0x38a0b9[_0x75d7('0x18')][_0x75d7('0x19')]===undefined?!![]:![]:!![]})[_0x75d7('0x9')](function(_0x2e06df){logger['info']('CreateCmHopperFinal',_0x38a0b9);logger[_0x75d7('0xd')](_0x75d7('0x14'),_0x38a0b9,JSON[_0x75d7('0xe')](_0x2e06df));_0x477bee(_0x2e06df);})['catch'](function(_0x1bf52b){logger[_0x75d7('0xf')]('CreateCmHopperFinal',_0x1bf52b[_0x75d7('0x11')],_0x38a0b9);_0xbc5e3b(_0x1e0ffa['error'](0x1f4,_0x1bf52b[_0x75d7('0x11')]));});});};