949d9a2902d4d8888a7208805dc6be624b3cc156
[motion2.git] / server / api / condition / condition.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 _0x6262=['Condition,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2b395a,_0x35db69){var _0x1beba0=function(_0x2cb135){while(--_0x2cb135){_0x2b395a['push'](_0x2b395a['shift']());}};_0x1beba0(++_0x35db69);}(_0x6262,0xa4));var _0x2626=function(_0x3b918b,_0x2edc55){_0x3b918b=_0x3b918b-0x0;var _0x57d988=_0x6262[_0x3b918b];return _0x57d988;};'use strict';var _=require(_0x2626('0x0'));var util=require(_0x2626('0x1'));var moment=require(_0x2626('0x2'));var BPromise=require(_0x2626('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2626('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2626('0x5'));var logger=require(_0x2626('0x6'))(_0x2626('0x7'));var config=require(_0x2626('0x8'));var jayson=require(_0x2626('0x9'));var client=jayson[_0x2626('0xa')][_0x2626('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52db9d,_0x11896a,_0x49944f){return new BPromise(function(_0x5593a3,_0x163212){return client[_0x2626('0xc')](_0x52db9d,_0x49944f)['then'](function(_0x442904){logger[_0x2626('0xd')]('Condition,\x20%s,\x20%s',_0x11896a,'request\x20sent');logger[_0x2626('0xe')](_0x2626('0xf'),_0x11896a,_0x2626('0x10'),JSON[_0x2626('0x11')](_0x442904));if(_0x442904[_0x2626('0x12')]){if(_0x442904[_0x2626('0x12')][_0x2626('0x13')]===0x1f4){logger['error'](_0x2626('0x14'),_0x11896a,_0x442904[_0x2626('0x12')][_0x2626('0x15')]);return _0x163212(_0x442904['error'][_0x2626('0x15')]);}logger[_0x2626('0x12')](_0x2626('0x14'),_0x11896a,_0x442904['error'][_0x2626('0x15')]);return _0x5593a3(_0x442904[_0x2626('0x12')]['message']);}else{logger[_0x2626('0xd')](_0x2626('0x14'),_0x11896a,_0x2626('0x10'));_0x5593a3(_0x442904[_0x2626('0x16')][_0x2626('0x15')]);}})['catch'](function(_0x359cdf){logger[_0x2626('0x12')]('Condition,\x20%s,\x20%s',_0x11896a,_0x359cdf);_0x163212(_0x359cdf);});});}