1ec37873f168ae84376c2b1666208232f98865bb
[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 _0x3993=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x3993,0x17a));var _0x3399=function(_0x394091,_0x1776c8){_0x394091=_0x394091-0x0;var _0x1c1c0d=_0x3993[_0x394091];return _0x1c1c0d;};'use strict';var _=require('lodash');var util=require(_0x3399('0x0'));var moment=require(_0x3399('0x1'));var BPromise=require(_0x3399('0x2'));var rs=require(_0x3399('0x3'));var fs=require('fs');var Redis=require(_0x3399('0x4'));var db=require(_0x3399('0x5'))['db'];var utils=require(_0x3399('0x6'));var logger=require(_0x3399('0x7'))(_0x3399('0x8'));var config=require('../../config/environment');var jayson=require(_0x3399('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e075d,_0x145934,_0x196f2d){return new BPromise(function(_0x57956e,_0x2d63f7){return client[_0x3399('0xa')](_0x3e075d,_0x196f2d)[_0x3399('0xb')](function(_0x1b9de2){logger[_0x3399('0xc')](_0x3399('0xd'),_0x145934,_0x3399('0xe'));logger[_0x3399('0xf')](_0x3399('0x10'),_0x145934,'request\x20sent',JSON['stringify'](_0x1b9de2));if(_0x1b9de2[_0x3399('0x11')]){if(_0x1b9de2[_0x3399('0x11')][_0x3399('0x12')]===0x1f4){logger[_0x3399('0x11')]('Condition,\x20%s,\x20%s',_0x145934,_0x1b9de2[_0x3399('0x11')][_0x3399('0x13')]);return _0x2d63f7(_0x1b9de2[_0x3399('0x11')][_0x3399('0x13')]);}logger[_0x3399('0x11')]('Condition,\x20%s,\x20%s',_0x145934,_0x1b9de2[_0x3399('0x11')]['message']);return _0x57956e(_0x1b9de2['error'][_0x3399('0x13')]);}else{logger[_0x3399('0xc')]('Condition,\x20%s,\x20%s',_0x145934,_0x3399('0xe'));_0x57956e(_0x1b9de2[_0x3399('0x14')][_0x3399('0x13')]);}})[_0x3399('0x15')](function(_0x16fd03){logger[_0x3399('0x11')](_0x3399('0xd'),_0x145934,_0x16fd03);_0x2d63f7(_0x16fd03);});});}