2d9613950046e516f127770583366ee5521affc4
[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 _0x8f3d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','error','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x1bd9bc,_0x59b9d7){var _0x56cd90=function(_0x5f2f2d){while(--_0x5f2f2d){_0x1bd9bc['push'](_0x1bd9bc['shift']());}};_0x56cd90(++_0x59b9d7);}(_0x8f3d,0x1b6));var _0xd8f3=function(_0x35cc9a,_0x575f4e){_0x35cc9a=_0x35cc9a-0x0;var _0x2ee38e=_0x8f3d[_0x35cc9a];return _0x2ee38e;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var moment=require(_0xd8f3('0x2'));var BPromise=require(_0xd8f3('0x3'));var rs=require(_0xd8f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8f3('0x5'))['db'];var utils=require(_0xd8f3('0x6'));var logger=require(_0xd8f3('0x7'))(_0xd8f3('0x8'));var config=require(_0xd8f3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8f3('0xa')][_0xd8f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44b21a,_0x5a4afb,_0xb30bb6){return new BPromise(function(_0x127f06,_0x512b3b){return client[_0xd8f3('0xc')](_0x44b21a,_0xb30bb6)['then'](function(_0x1a3639){logger['info']('Condition,\x20%s,\x20%s',_0x5a4afb,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x5a4afb,_0xd8f3('0xd'),JSON['stringify'](_0x1a3639));if(_0x1a3639[_0xd8f3('0xe')]){if(_0x1a3639[_0xd8f3('0xe')]['code']===0x1f4){logger[_0xd8f3('0xe')](_0xd8f3('0xf'),_0x5a4afb,_0x1a3639[_0xd8f3('0xe')]['message']);return _0x512b3b(_0x1a3639[_0xd8f3('0xe')][_0xd8f3('0x10')]);}logger['error'](_0xd8f3('0xf'),_0x5a4afb,_0x1a3639[_0xd8f3('0xe')][_0xd8f3('0x10')]);return _0x127f06(_0x1a3639[_0xd8f3('0xe')]['message']);}else{logger[_0xd8f3('0x11')](_0xd8f3('0xf'),_0x5a4afb,'request\x20sent');_0x127f06(_0x1a3639[_0xd8f3('0x12')][_0xd8f3('0x10')]);}})[_0xd8f3('0x13')](function(_0x333c29){logger[_0xd8f3('0xe')]('Condition,\x20%s,\x20%s',_0x5a4afb,_0x333c29);_0x512b3b(_0x333c29);});});}