Built motion from commit 85328c08.|2.5.50
[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 _0x7034=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','lodash','bluebird','ioredis','../../config/utils'];(function(_0x1a3de9,_0x25aff8){var _0x56e0fc=function(_0x5380c5){while(--_0x5380c5){_0x1a3de9['push'](_0x1a3de9['shift']());}};_0x56e0fc(++_0x25aff8);}(_0x7034,0x164));var _0x4703=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7034[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x4703('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4703('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4703('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4703('0x3'));var logger=require(_0x4703('0x4'))(_0x4703('0x5'));var config=require(_0x4703('0x6'));var jayson=require(_0x4703('0x7'));var client=jayson['client'][_0x4703('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d5e91,_0x44b49b,_0x44639a){return new BPromise(function(_0x31cd4d,_0x3b2a44){return client[_0x4703('0x9')](_0x3d5e91,_0x44639a)[_0x4703('0xa')](function(_0x2864ba){logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));logger[_0x4703('0xe')](_0x4703('0xf'),_0x44b49b,_0x4703('0xd'),JSON['stringify'](_0x2864ba));if(_0x2864ba[_0x4703('0x10')]){if(_0x2864ba[_0x4703('0x10')]['code']===0x1f4){logger['error'](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x3b2a44(_0x2864ba[_0x4703('0x10')]['message']);}logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x31cd4d(_0x2864ba['error'][_0x4703('0x11')]);}else{logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));_0x31cd4d(_0x2864ba['result'][_0x4703('0x11')]);}})['catch'](function(_0x4983d1){logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x4983d1);_0x3b2a44(_0x4983d1);});});}