Built motion from commit 10af8726.|2.6.34
[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 _0x4cd3=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4cd3,0x68));var _0x34cd=function(_0x2c944e,_0x26f659){_0x2c944e=_0x2c944e-0x0;var _0x2cc529=_0x4cd3[_0x2c944e];return _0x2cc529;};'use strict';var _=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var moment=require(_0x34cd('0x2'));var BPromise=require(_0x34cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34cd('0x5'));var logger=require('../../config/logger')(_0x34cd('0x6'));var config=require(_0x34cd('0x7'));var jayson=require(_0x34cd('0x8'));var client=jayson[_0x34cd('0x9')][_0x34cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf8d837,_0x32ff10,_0x283e71){return new BPromise(function(_0x5a6356,_0x57df3a){return client['request'](_0xf8d837,_0x283e71)['then'](function(_0x2fd29f){logger['info'](_0x34cd('0xb'),_0x32ff10,_0x34cd('0xc'));logger[_0x34cd('0xd')](_0x34cd('0xe'),_0x32ff10,_0x34cd('0xc'),JSON[_0x34cd('0xf')](_0x2fd29f));if(_0x2fd29f[_0x34cd('0x10')]){if(_0x2fd29f[_0x34cd('0x10')]['code']===0x1f4){logger[_0x34cd('0x10')]('Condition,\x20%s,\x20%s',_0x32ff10,_0x2fd29f[_0x34cd('0x10')][_0x34cd('0x11')]);return _0x57df3a(_0x2fd29f[_0x34cd('0x10')][_0x34cd('0x11')]);}logger[_0x34cd('0x10')](_0x34cd('0xb'),_0x32ff10,_0x2fd29f[_0x34cd('0x10')][_0x34cd('0x11')]);return _0x5a6356(_0x2fd29f['error']['message']);}else{logger[_0x34cd('0x12')](_0x34cd('0xb'),_0x32ff10,_0x34cd('0xc'));_0x5a6356(_0x2fd29f[_0x34cd('0x13')][_0x34cd('0x11')]);}})[_0x34cd('0x14')](function(_0x1c21d0){logger[_0x34cd('0x10')](_0x34cd('0xb'),_0x32ff10,_0x1c21d0);_0x57df3a(_0x1c21d0);});});}