35f2ce119fd5511504a1b429301cc656eee96a80
[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 _0x486a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x486a,0x19c));var _0xa486=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x486a[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0xa486('0x0'));var util=require(_0xa486('0x1'));var moment=require(_0xa486('0x2'));var BPromise=require(_0xa486('0x3'));var rs=require(_0xa486('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa486('0x5'));var logger=require(_0xa486('0x6'))(_0xa486('0x7'));var config=require(_0xa486('0x8'));var jayson=require(_0xa486('0x9'));var client=jayson[_0xa486('0xa')][_0xa486('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3611e2,_0x54562a,_0x3df231){return new BPromise(function(_0x5417f4,_0x1ac785){return client[_0xa486('0xc')](_0x3611e2,_0x3df231)['then'](function(_0xc74045){logger['info']('Condition,\x20%s,\x20%s',_0x54562a,_0xa486('0xd'));logger[_0xa486('0xe')](_0xa486('0xf'),_0x54562a,_0xa486('0xd'),JSON[_0xa486('0x10')](_0xc74045));if(_0xc74045['error']){if(_0xc74045[_0xa486('0x11')]['code']===0x1f4){logger[_0xa486('0x11')](_0xa486('0x12'),_0x54562a,_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);return _0x1ac785(_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);}logger[_0xa486('0x11')](_0xa486('0x12'),_0x54562a,_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);return _0x5417f4(_0xc74045[_0xa486('0x11')][_0xa486('0x13')]);}else{logger[_0xa486('0x14')](_0xa486('0x12'),_0x54562a,_0xa486('0xd'));_0x5417f4(_0xc74045[_0xa486('0x15')][_0xa486('0x13')]);}})['catch'](function(_0x483ebb){logger['error'](_0xa486('0x12'),_0x54562a,_0x483ebb);_0x1ac785(_0x483ebb);});});}