Built motion from commit 9d0783e6.|2.6.13
[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 _0x4116=['jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','ioredis','../../config/logger','rpc'];(function(_0x1649ea,_0x422343){var _0x42787d=function(_0x22f3fb){while(--_0x22f3fb){_0x1649ea['push'](_0x1649ea['shift']());}};_0x42787d(++_0x422343);}(_0x4116,0x175));var _0x6411=function(_0x4152fa,_0x6dc7a3){_0x4152fa=_0x4152fa-0x0;var _0x3c3779=_0x4116[_0x4152fa];return _0x3c3779;};'use strict';var _=require('lodash');var util=require(_0x6411('0x0'));var moment=require(_0x6411('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6411('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6411('0x3'))(_0x6411('0x4'));var config=require('../../config/environment');var jayson=require(_0x6411('0x5'));var client=jayson[_0x6411('0x6')][_0x6411('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x418817,_0x41f39d,_0x540a56){return new BPromise(function(_0x568ba0,_0xdda973){return client[_0x6411('0x8')](_0x418817,_0x540a56)[_0x6411('0x9')](function(_0x23fac3){logger[_0x6411('0xa')](_0x6411('0xb'),_0x41f39d,_0x6411('0xc'));logger[_0x6411('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x41f39d,'request\x20sent',JSON[_0x6411('0xe')](_0x23fac3));if(_0x23fac3[_0x6411('0xf')]){if(_0x23fac3[_0x6411('0xf')][_0x6411('0x10')]===0x1f4){logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);return _0xdda973(_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);}logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);return _0x568ba0(_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);}else{logger['info'](_0x6411('0xb'),_0x41f39d,_0x6411('0xc'));_0x568ba0(_0x23fac3['result']['message']);}})['catch'](function(_0x495db7){logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x495db7);_0xdda973(_0x495db7);});});}