4a8fe0d93bbd72c372cd3b2798fff7dfb8651b16
[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 _0xb72a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x195f71,_0x40c2bd){var _0x3bb3bc=function(_0x4827fb){while(--_0x4827fb){_0x195f71['push'](_0x195f71['shift']());}};_0x3bb3bc(++_0x40c2bd);}(_0xb72a,0xcb));var _0xab72=function(_0x2a283f,_0x5a0b5b){_0x2a283f=_0x2a283f-0x0;var _0x5d5634=_0xb72a[_0x2a283f];return _0x5d5634;};'use strict';var _=require(_0xab72('0x0'));var util=require(_0xab72('0x1'));var moment=require(_0xab72('0x2'));var BPromise=require(_0xab72('0x3'));var rs=require(_0xab72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab72('0x5'))['db'];var utils=require(_0xab72('0x6'));var logger=require(_0xab72('0x7'))(_0xab72('0x8'));var config=require(_0xab72('0x9'));var jayson=require(_0xab72('0xa'));var client=jayson[_0xab72('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186d65,_0x213ecd,_0x45239d){return new BPromise(function(_0x69c3ff,_0x4a27bb){return client[_0xab72('0xc')](_0x186d65,_0x45239d)[_0xab72('0xd')](function(_0x12fec3){logger[_0xab72('0xe')]('Condition,\x20%s,\x20%s',_0x213ecd,_0xab72('0xf'));logger[_0xab72('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x213ecd,_0xab72('0xf'),JSON[_0xab72('0x11')](_0x12fec3));if(_0x12fec3[_0xab72('0x12')]){if(_0x12fec3[_0xab72('0x12')]['code']===0x1f4){logger[_0xab72('0x12')](_0xab72('0x13'),_0x213ecd,_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);return _0x4a27bb(_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);}logger['error']('Condition,\x20%s,\x20%s',_0x213ecd,_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);return _0x69c3ff(_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);}else{logger[_0xab72('0xe')](_0xab72('0x13'),_0x213ecd,_0xab72('0xf'));_0x69c3ff(_0x12fec3['result']['message']);}})['catch'](function(_0xea2fd7){logger[_0xab72('0x12')](_0xab72('0x13'),_0x213ecd,_0xea2fd7);_0x4a27bb(_0xea2fd7);});});}