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 _0x2052=['jayson/promise','client','http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateCmHopperFinal','CmHopperFinal','create','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c9c25,_0x4b0692){var _0x55d540=function(_0x38afc0){while(--_0x38afc0){_0x1c9c25['push'](_0x1c9c25['shift']());}};_0x55d540(++_0x4b0692);}(_0x2052,0x7a));var _0x2205=function(_0x1a3100,_0x460bf6){_0x1a3100=_0x1a3100-0x0;var _0x1ede64=_0x2052[_0x1a3100];return _0x1ede64;};'use strict';var _=require('lodash');var util=require(_0x2205('0x0'));var moment=require('moment');var BPromise=require(_0x2205('0x1'));var rs=require(_0x2205('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2205('0x3'))['db'];var utils=require(_0x2205('0x4'));var logger=require(_0x2205('0x5'))(_0x2205('0x6'));var config=require(_0x2205('0x7'));var jayson=require(_0x2205('0x8'));var client=jayson[_0x2205('0x9')][_0x2205('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22c3f4,_0xff2cff,_0x5c9006){return new BPromise(function(_0x29da17,_0x44e561){return client['request'](_0x22c3f4,_0x5c9006)[_0x2205('0xb')](function(_0x3434e9){logger[_0x2205('0xc')](_0x2205('0xd'),_0xff2cff,_0x2205('0xe'));logger[_0x2205('0xf')](_0x2205('0x10'),_0xff2cff,_0x2205('0xe'),JSON[_0x2205('0x11')](_0x3434e9));if(_0x3434e9['error']){if(_0x3434e9[_0x2205('0x12')][_0x2205('0x13')]===0x1f4){logger['error'](_0x2205('0xd'),_0xff2cff,_0x3434e9[_0x2205('0x12')]['message']);return _0x44e561(_0x3434e9[_0x2205('0x12')][_0x2205('0x14')]);}logger[_0x2205('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0xff2cff,_0x3434e9[_0x2205('0x12')][_0x2205('0x14')]);return _0x29da17(_0x3434e9[_0x2205('0x12')][_0x2205('0x14')]);}else{logger['info'](_0x2205('0xd'),_0xff2cff,_0x2205('0xe'));_0x29da17(_0x3434e9['result'][_0x2205('0x14')]);}})['catch'](function(_0x445bd4){logger[_0x2205('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0xff2cff,_0x445bd4);_0x44e561(_0x445bd4);});});}exports[_0x2205('0x15')]=function(_0xb80c69){var _0x3fafdf=this;return new Promise(function(_0x14f2c7,_0x1aab74){return db[_0x2205('0x16')][_0x2205('0x17')](_0xb80c69['body'],{'raw':_0xb80c69[_0x2205('0x18')]?_0xb80c69[_0x2205('0x18')][_0x2205('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2df78a){logger[_0x2205('0xc')](_0x2205('0x15'),_0xb80c69);logger[_0x2205('0xf')](_0x2205('0x15'),_0xb80c69,JSON[_0x2205('0x11')](_0x2df78a));_0x14f2c7(_0x2df78a);})['catch'](function(_0xb0d12f){logger[_0x2205('0x12')](_0x2205('0x15'),_0xb0d12f[_0x2205('0x14')],_0xb80c69);_0x1aab74(_0x3fafdf[_0x2205('0x12')](0x1f4,_0xb0d12f[_0x2205('0x14')]));});});};