c7e42d70c6f0cb0d419f338be3931b68a6bbde27
[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 _0x018a=['http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1c0cb3,_0xfc911c){var _0xc898a4=function(_0x1b8491){while(--_0x1b8491){_0x1c0cb3['push'](_0x1c0cb3['shift']());}};_0xc898a4(++_0xfc911c);}(_0x018a,0xde));var _0xa018=function(_0x1cc2a9,_0x2c5885){_0x1cc2a9=_0x1cc2a9-0x0;var _0xdcc257=_0x018a[_0x1cc2a9];return _0xdcc257;};'use strict';var _=require(_0xa018('0x0'));var util=require(_0xa018('0x1'));var moment=require(_0xa018('0x2'));var BPromise=require(_0xa018('0x3'));var rs=require(_0xa018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa018('0x5'))('rpc');var config=require(_0xa018('0x6'));var jayson=require(_0xa018('0x7'));var client=jayson[_0xa018('0x8')][_0xa018('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302e6a,_0x21aa88,_0x30e806){return new BPromise(function(_0x222914,_0x2e5570){return client[_0xa018('0xa')](_0x302e6a,_0x30e806)['then'](function(_0x249440){logger[_0xa018('0xb')](_0xa018('0xc'),_0x21aa88,_0xa018('0xd'));logger[_0xa018('0xe')](_0xa018('0xf'),_0x21aa88,'request\x20sent',JSON[_0xa018('0x10')](_0x249440));if(_0x249440['error']){if(_0x249440[_0xa018('0x11')][_0xa018('0x12')]===0x1f4){logger[_0xa018('0x11')](_0xa018('0xc'),_0x21aa88,_0x249440[_0xa018('0x11')][_0xa018('0x13')]);return _0x2e5570(_0x249440[_0xa018('0x11')][_0xa018('0x13')]);}logger[_0xa018('0x11')](_0xa018('0xc'),_0x21aa88,_0x249440[_0xa018('0x11')][_0xa018('0x13')]);return _0x222914(_0x249440['error'][_0xa018('0x13')]);}else{logger[_0xa018('0xb')](_0xa018('0xc'),_0x21aa88,_0xa018('0xd'));_0x222914(_0x249440['result']['message']);}})[_0xa018('0x14')](function(_0x125063){logger[_0xa018('0x11')](_0xa018('0xc'),_0x21aa88,_0x125063);_0x2e5570(_0x125063);});});}