c620522de6e3abf800bc2191c4db07c826510dda
[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 _0xa0e2=['http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa0e2,0x165));var _0x2a0e=function(_0x3cda26,_0x31a42a){_0x3cda26=_0x3cda26-0x0;var _0x45469f=_0xa0e2[_0x3cda26];return _0x45469f;};'use strict';var _=require(_0x2a0e('0x0'));var util=require(_0x2a0e('0x1'));var moment=require('moment');var BPromise=require(_0x2a0e('0x2'));var rs=require(_0x2a0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a0e('0x4'))['db'];var utils=require(_0x2a0e('0x5'));var logger=require(_0x2a0e('0x6'))(_0x2a0e('0x7'));var config=require(_0x2a0e('0x8'));var jayson=require(_0x2a0e('0x9'));var client=jayson[_0x2a0e('0xa')][_0x2a0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27c22c,_0x4e5db9,_0x281074){return new BPromise(function(_0x1d1be3,_0x3c7b6c){return client[_0x2a0e('0xc')](_0x27c22c,_0x281074)['then'](function(_0x144b61){logger['info'](_0x2a0e('0xd'),_0x4e5db9,_0x2a0e('0xe'));logger[_0x2a0e('0xf')](_0x2a0e('0x10'),_0x4e5db9,_0x2a0e('0xe'),JSON[_0x2a0e('0x11')](_0x144b61));if(_0x144b61[_0x2a0e('0x12')]){if(_0x144b61['error'][_0x2a0e('0x13')]===0x1f4){logger['error'](_0x2a0e('0xd'),_0x4e5db9,_0x144b61[_0x2a0e('0x12')][_0x2a0e('0x14')]);return _0x3c7b6c(_0x144b61[_0x2a0e('0x12')][_0x2a0e('0x14')]);}logger['error']('Condition,\x20%s,\x20%s',_0x4e5db9,_0x144b61[_0x2a0e('0x12')]['message']);return _0x1d1be3(_0x144b61['error']['message']);}else{logger['info'](_0x2a0e('0xd'),_0x4e5db9,_0x2a0e('0xe'));_0x1d1be3(_0x144b61[_0x2a0e('0x15')]['message']);}})[_0x2a0e('0x16')](function(_0x4d922f){logger['error'](_0x2a0e('0xd'),_0x4e5db9,_0x4d922f);_0x3c7b6c(_0x4d922f);});});}