4e8f2a623749b261a0dcb5a3e70ad76465e023d6
[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 _0x8cad=['rpc','../../config/environment','client','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','Condition,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13b91f,_0x378a37){var _0x35a1df=function(_0x30d2c1){while(--_0x30d2c1){_0x13b91f['push'](_0x13b91f['shift']());}};_0x35a1df(++_0x378a37);}(_0x8cad,0xa4));var _0xd8ca=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x8cad[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var moment=require('moment');var BPromise=require(_0xd8ca('0x2'));var rs=require(_0xd8ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8ca('0x4'))['db'];var utils=require(_0xd8ca('0x5'));var logger=require(_0xd8ca('0x6'))(_0xd8ca('0x7'));var config=require(_0xd8ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24aa5b,_0x1ec251,_0x78e8d3){return new BPromise(function(_0x55edf6,_0x14cc94){return client['request'](_0x24aa5b,_0x78e8d3)[_0xd8ca('0xa')](function(_0x47ba33){logger[_0xd8ca('0xb')]('Condition,\x20%s,\x20%s',_0x1ec251,_0xd8ca('0xc'));logger[_0xd8ca('0xd')](_0xd8ca('0xe'),_0x1ec251,_0xd8ca('0xc'),JSON['stringify'](_0x47ba33));if(_0x47ba33[_0xd8ca('0xf')]){if(_0x47ba33['error']['code']===0x1f4){logger[_0xd8ca('0xf')](_0xd8ca('0x10'),_0x1ec251,_0x47ba33[_0xd8ca('0xf')][_0xd8ca('0x11')]);return _0x14cc94(_0x47ba33['error'][_0xd8ca('0x11')]);}logger[_0xd8ca('0xf')](_0xd8ca('0x10'),_0x1ec251,_0x47ba33[_0xd8ca('0xf')]['message']);return _0x55edf6(_0x47ba33[_0xd8ca('0xf')][_0xd8ca('0x11')]);}else{logger[_0xd8ca('0xb')](_0xd8ca('0x10'),_0x1ec251,_0xd8ca('0xc'));_0x55edf6(_0x47ba33['result'][_0xd8ca('0x11')]);}})[_0xd8ca('0x12')](function(_0x5649de){logger['error']('Condition,\x20%s,\x20%s',_0x1ec251,_0x5649de);_0x14cc94(_0x5649de);});});}