ba599e7e3a51633ad6561f5ef484f7dd9ec1ea38
[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 _0xa186=['then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xa186,0x185));var _0x6a18=function(_0x31f5c2,_0x2a47d3){_0x31f5c2=_0x31f5c2-0x0;var _0xcb7d73=_0xa186[_0x31f5c2];return _0xcb7d73;};'use strict';var _=require('lodash');var util=require(_0x6a18('0x0'));var moment=require(_0x6a18('0x1'));var BPromise=require(_0x6a18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a18('0x3'));var logger=require(_0x6a18('0x4'))(_0x6a18('0x5'));var config=require(_0x6a18('0x6'));var jayson=require(_0x6a18('0x7'));var client=jayson[_0x6a18('0x8')][_0x6a18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ccc9f,_0x1f7673,_0x20f745){return new BPromise(function(_0x1842c7,_0x41f242){return client[_0x6a18('0xa')](_0x4ccc9f,_0x20f745)[_0x6a18('0xb')](function(_0x3e0a80){logger[_0x6a18('0xc')](_0x6a18('0xd'),_0x1f7673,_0x6a18('0xe'));logger['debug'](_0x6a18('0xf'),_0x1f7673,_0x6a18('0xe'),JSON[_0x6a18('0x10')](_0x3e0a80));if(_0x3e0a80[_0x6a18('0x11')]){if(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x12')]===0x1f4){logger[_0x6a18('0x11')](_0x6a18('0xd'),_0x1f7673,_0x3e0a80['error']['message']);return _0x41f242(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x13')]);}logger[_0x6a18('0x11')](_0x6a18('0xd'),_0x1f7673,_0x3e0a80[_0x6a18('0x11')]['message']);return _0x1842c7(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x13')]);}else{logger[_0x6a18('0xc')](_0x6a18('0xd'),_0x1f7673,'request\x20sent');_0x1842c7(_0x3e0a80['result'][_0x6a18('0x13')]);}})['catch'](function(_0x3ffbd4){logger['error'](_0x6a18('0xd'),_0x1f7673,_0x3ffbd4);_0x41f242(_0x3ffbd4);});});}