90728f636cd1ee390f52e6b1799e0da0860fefbc
[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 _0x1997=['client','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6dfa88,_0x7caf68){var _0x4eeec2=function(_0x4efa2a){while(--_0x4efa2a){_0x6dfa88['push'](_0x6dfa88['shift']());}};_0x4eeec2(++_0x7caf68);}(_0x1997,0x70));var _0x7199=function(_0xabd3d3,_0x30ecc8){_0xabd3d3=_0xabd3d3-0x0;var _0x5a0e5a=_0x1997[_0xabd3d3];return _0x5a0e5a;};'use strict';var _=require(_0x7199('0x0'));var util=require('util');var moment=require(_0x7199('0x1'));var BPromise=require('bluebird');var rs=require(_0x7199('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7199('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7199('0x4'))(_0x7199('0x5'));var config=require(_0x7199('0x6'));var jayson=require(_0x7199('0x7'));var client=jayson[_0x7199('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0c94,_0x11f44a,_0xb3cd63){return new BPromise(function(_0xe499e2,_0x528e83){return client['request'](_0x2f0c94,_0xb3cd63)['then'](function(_0x52f6ae){logger[_0x7199('0x9')](_0x7199('0xa'),_0x11f44a,_0x7199('0xb'));logger[_0x7199('0xc')](_0x7199('0xd'),_0x11f44a,_0x7199('0xb'),JSON[_0x7199('0xe')](_0x52f6ae));if(_0x52f6ae[_0x7199('0xf')]){if(_0x52f6ae[_0x7199('0xf')][_0x7199('0x10')]===0x1f4){logger[_0x7199('0xf')]('Condition,\x20%s,\x20%s',_0x11f44a,_0x52f6ae[_0x7199('0xf')][_0x7199('0x11')]);return _0x528e83(_0x52f6ae[_0x7199('0xf')][_0x7199('0x11')]);}logger[_0x7199('0xf')](_0x7199('0xa'),_0x11f44a,_0x52f6ae[_0x7199('0xf')][_0x7199('0x11')]);return _0xe499e2(_0x52f6ae[_0x7199('0xf')]['message']);}else{logger[_0x7199('0x9')]('Condition,\x20%s,\x20%s',_0x11f44a,_0x7199('0xb'));_0xe499e2(_0x52f6ae[_0x7199('0x12')]['message']);}})[_0x7199('0x13')](function(_0x1bb285){logger[_0x7199('0xf')](_0x7199('0xa'),_0x11f44a,_0x1bb285);_0x528e83(_0x1bb285);});});}