75995780405f08bdeccbb6e57abbaa0d8fee157d
[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 _0x33b5=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33b5,0x109));var _0x533b=function(_0x280b48,_0x581053){_0x280b48=_0x280b48-0x0;var _0x2df710=_0x33b5[_0x280b48];return _0x2df710;};'use strict';var _=require('lodash');var util=require(_0x533b('0x0'));var moment=require(_0x533b('0x1'));var BPromise=require(_0x533b('0x2'));var rs=require(_0x533b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x533b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x533b('0x5'))(_0x533b('0x6'));var config=require(_0x533b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x85feb2,_0x13c5d0,_0x35fa61){return new BPromise(function(_0x7ae589,_0x4836ef){return client[_0x533b('0x8')](_0x85feb2,_0x35fa61)[_0x533b('0x9')](function(_0x390e5d){logger[_0x533b('0xa')](_0x533b('0xb'),_0x13c5d0,_0x533b('0xc'));logger[_0x533b('0xd')](_0x533b('0xe'),_0x13c5d0,_0x533b('0xc'),JSON[_0x533b('0xf')](_0x390e5d));if(_0x390e5d[_0x533b('0x10')]){if(_0x390e5d['error']['code']===0x1f4){logger[_0x533b('0x10')](_0x533b('0xb'),_0x13c5d0,_0x390e5d['error'][_0x533b('0x11')]);return _0x4836ef(_0x390e5d['error'][_0x533b('0x11')]);}logger[_0x533b('0x10')](_0x533b('0xb'),_0x13c5d0,_0x390e5d[_0x533b('0x10')]['message']);return _0x7ae589(_0x390e5d[_0x533b('0x10')][_0x533b('0x11')]);}else{logger[_0x533b('0xa')](_0x533b('0xb'),_0x13c5d0,_0x533b('0xc'));_0x7ae589(_0x390e5d[_0x533b('0x12')][_0x533b('0x11')]);}})['catch'](function(_0x51c06f){logger['error']('Condition,\x20%s,\x20%s',_0x13c5d0,_0x51c06f);_0x4836ef(_0x51c06f);});});}