8cd28155e74e902f42491255e098a0e405577f80
[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 _0x5a7e=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x318f1f,_0x4a62d9){var _0x99ce5f=function(_0x3ed48e){while(--_0x3ed48e){_0x318f1f['push'](_0x318f1f['shift']());}};_0x99ce5f(++_0x4a62d9);}(_0x5a7e,0xbb));var _0xe5a7=function(_0x459001,_0x59c922){_0x459001=_0x459001-0x0;var _0x48dec9=_0x5a7e[_0x459001];return _0x48dec9;};'use strict';var _=require('lodash');var util=require(_0xe5a7('0x0'));var moment=require(_0xe5a7('0x1'));var BPromise=require(_0xe5a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5a7('0x4'));var logger=require(_0xe5a7('0x5'))(_0xe5a7('0x6'));var config=require(_0xe5a7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe5a7('0x8')][_0xe5a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ef503,_0x3fa91e,_0x27b67a){return new BPromise(function(_0xc92c7e,_0x4fa1c8){return client['request'](_0x1ef503,_0x27b67a)[_0xe5a7('0xa')](function(_0x22af4a){logger['info'](_0xe5a7('0xb'),_0x3fa91e,_0xe5a7('0xc'));logger['debug'](_0xe5a7('0xd'),_0x3fa91e,'request\x20sent',JSON[_0xe5a7('0xe')](_0x22af4a));if(_0x22af4a[_0xe5a7('0xf')]){if(_0x22af4a['error'][_0xe5a7('0x10')]===0x1f4){logger['error'](_0xe5a7('0xb'),_0x3fa91e,_0x22af4a[_0xe5a7('0xf')]['message']);return _0x4fa1c8(_0x22af4a[_0xe5a7('0xf')][_0xe5a7('0x11')]);}logger[_0xe5a7('0xf')]('Condition,\x20%s,\x20%s',_0x3fa91e,_0x22af4a[_0xe5a7('0xf')][_0xe5a7('0x11')]);return _0xc92c7e(_0x22af4a[_0xe5a7('0xf')][_0xe5a7('0x11')]);}else{logger[_0xe5a7('0x12')](_0xe5a7('0xb'),_0x3fa91e,'request\x20sent');_0xc92c7e(_0x22af4a['result'][_0xe5a7('0x11')]);}})[_0xe5a7('0x13')](function(_0x4998c6){logger['error'](_0xe5a7('0xb'),_0x3fa91e,_0x4998c6);_0x4fa1c8(_0x4998c6);});});}