8ac1bb97fcba2a2ec55604e15c55c7736d852d48
[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 _0x135b=['http','request','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x10f9b9,_0x447152){var _0x1cf467=function(_0x1882c5){while(--_0x1882c5){_0x10f9b9['push'](_0x10f9b9['shift']());}};_0x1cf467(++_0x447152);}(_0x135b,0xbf));var _0xb135=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x135b[_0x4e0eb6];return _0x46e432;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb135('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb135('0x1'));var db=require(_0xb135('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb135('0x3'));var config=require(_0xb135('0x4'));var jayson=require(_0xb135('0x5'));var client=jayson[_0xb135('0x6')][_0xb135('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2915d6,_0x20d248,_0x37a8d5){return new BPromise(function(_0x3177f7,_0x280f43){return client[_0xb135('0x8')](_0x2915d6,_0x37a8d5)['then'](function(_0xae0f8){logger[_0xb135('0x9')]('Condition,\x20%s,\x20%s',_0x20d248,_0xb135('0xa'));logger[_0xb135('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x20d248,_0xb135('0xa'),JSON[_0xb135('0xc')](_0xae0f8));if(_0xae0f8[_0xb135('0xd')]){if(_0xae0f8[_0xb135('0xd')][_0xb135('0xe')]===0x1f4){logger[_0xb135('0xd')](_0xb135('0xf'),_0x20d248,_0xae0f8[_0xb135('0xd')]['message']);return _0x280f43(_0xae0f8[_0xb135('0xd')][_0xb135('0x10')]);}logger[_0xb135('0xd')]('Condition,\x20%s,\x20%s',_0x20d248,_0xae0f8[_0xb135('0xd')][_0xb135('0x10')]);return _0x3177f7(_0xae0f8[_0xb135('0xd')][_0xb135('0x10')]);}else{logger[_0xb135('0x9')]('Condition,\x20%s,\x20%s',_0x20d248,'request\x20sent');_0x3177f7(_0xae0f8['result'][_0xb135('0x10')]);}})[_0xb135('0x11')](function(_0x444e24){logger[_0xb135('0xd')](_0xb135('0xf'),_0x20d248,_0x444e24);_0x280f43(_0x444e24);});});}