0bd0d55ce30f16a81e32e6dbb082a892e038f351
[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 _0xdc7c=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x406062,_0x1fd25a){var _0x5b188d=function(_0x29d535){while(--_0x29d535){_0x406062['push'](_0x406062['shift']());}};_0x5b188d(++_0x1fd25a);}(_0xdc7c,0xb4));var _0xcdc7=function(_0x4303a0,_0x5a7592){_0x4303a0=_0x4303a0-0x0;var _0x3af3e8=_0xdc7c[_0x4303a0];return _0x3af3e8;};'use strict';var _=require('lodash');var util=require(_0xcdc7('0x0'));var moment=require('moment');var BPromise=require(_0xcdc7('0x1'));var rs=require(_0xcdc7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdc7('0x3'))['db'];var utils=require(_0xcdc7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xcdc7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcdc7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2306,_0x3364c7,_0x1815f5){return new BPromise(function(_0x4bbcd5,_0xea7317){return client[_0xcdc7('0x7')](_0x2d2306,_0x1815f5)['then'](function(_0xde92e5){logger[_0xcdc7('0x8')](_0xcdc7('0x9'),_0x3364c7,_0xcdc7('0xa'));logger[_0xcdc7('0xb')](_0xcdc7('0xc'),_0x3364c7,_0xcdc7('0xa'),JSON[_0xcdc7('0xd')](_0xde92e5));if(_0xde92e5['error']){if(_0xde92e5['error']['code']===0x1f4){logger[_0xcdc7('0xe')]('Condition,\x20%s,\x20%s',_0x3364c7,_0xde92e5[_0xcdc7('0xe')][_0xcdc7('0xf')]);return _0xea7317(_0xde92e5[_0xcdc7('0xe')][_0xcdc7('0xf')]);}logger[_0xcdc7('0xe')]('Condition,\x20%s,\x20%s',_0x3364c7,_0xde92e5['error'][_0xcdc7('0xf')]);return _0x4bbcd5(_0xde92e5[_0xcdc7('0xe')][_0xcdc7('0xf')]);}else{logger['info'](_0xcdc7('0x9'),_0x3364c7,'request\x20sent');_0x4bbcd5(_0xde92e5[_0xcdc7('0x10')][_0xcdc7('0xf')]);}})[_0xcdc7('0x11')](function(_0x560446){logger['error'](_0xcdc7('0x9'),_0x3364c7,_0x560446);_0xea7317(_0x560446);});});}