127de05cf638b5ac41dd351b00f12622e1cdcaf4
[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 _0x765f=['message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2e2992,_0x44c1a9){var _0x53cdf4=function(_0x3099b8){while(--_0x3099b8){_0x2e2992['push'](_0x2e2992['shift']());}};_0x53cdf4(++_0x44c1a9);}(_0x765f,0x1a5));var _0xf765=function(_0x5eec9b,_0x48c63b){_0x5eec9b=_0x5eec9b-0x0;var _0x2ddac2=_0x765f[_0x5eec9b];return _0x2ddac2;};'use strict';var _=require(_0xf765('0x0'));var util=require(_0xf765('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf765('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf765('0x3'))['db'];var utils=require(_0xf765('0x4'));var logger=require(_0xf765('0x5'))('rpc');var config=require(_0xf765('0x6'));var jayson=require(_0xf765('0x7'));var client=jayson[_0xf765('0x8')][_0xf765('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e71c3,_0x2d8d74,_0x334f5b){return new BPromise(function(_0x4d0bf8,_0x4934a1){return client[_0xf765('0xa')](_0x2e71c3,_0x334f5b)[_0xf765('0xb')](function(_0x1f13b2){logger[_0xf765('0xc')](_0xf765('0xd'),_0x2d8d74,'request\x20sent');logger[_0xf765('0xe')](_0xf765('0xf'),_0x2d8d74,_0xf765('0x10'),JSON['stringify'](_0x1f13b2));if(_0x1f13b2[_0xf765('0x11')]){if(_0x1f13b2['error'][_0xf765('0x12')]===0x1f4){logger[_0xf765('0x11')](_0xf765('0xd'),_0x2d8d74,_0x1f13b2[_0xf765('0x11')]['message']);return _0x4934a1(_0x1f13b2['error'][_0xf765('0x13')]);}logger[_0xf765('0x11')]('Condition,\x20%s,\x20%s',_0x2d8d74,_0x1f13b2[_0xf765('0x11')]['message']);return _0x4d0bf8(_0x1f13b2['error']['message']);}else{logger['info'](_0xf765('0xd'),_0x2d8d74,_0xf765('0x10'));_0x4d0bf8(_0x1f13b2[_0xf765('0x14')][_0xf765('0x13')]);}})[_0xf765('0x15')](function(_0x332109){logger['error'](_0xf765('0xd'),_0x2d8d74,_0x332109);_0x4934a1(_0x332109);});});}