Built motion from commit 3c2ce842.|2.6.31
[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 _0xf8e3=['Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x4f11a3,_0x2a20d5){var _0x256d6f=function(_0x6d4eb7){while(--_0x6d4eb7){_0x4f11a3['push'](_0x4f11a3['shift']());}};_0x256d6f(++_0x2a20d5);}(_0xf8e3,0x134));var _0x3f8e=function(_0x243a39,_0x4c9b51){_0x243a39=_0x243a39-0x0;var _0x5620a2=_0xf8e3[_0x243a39];return _0x5620a2;};'use strict';var _=require(_0x3f8e('0x0'));var util=require(_0x3f8e('0x1'));var moment=require('moment');var BPromise=require(_0x3f8e('0x2'));var rs=require(_0x3f8e('0x3'));var fs=require('fs');var Redis=require(_0x3f8e('0x4'));var db=require(_0x3f8e('0x5'))['db'];var utils=require(_0x3f8e('0x6'));var logger=require(_0x3f8e('0x7'))(_0x3f8e('0x8'));var config=require(_0x3f8e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f8e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x627d45,_0x37632c,_0x1feeaf){return new BPromise(function(_0x2e733a,_0x50e008){return client[_0x3f8e('0xb')](_0x627d45,_0x1feeaf)[_0x3f8e('0xc')](function(_0x367795){logger[_0x3f8e('0xd')](_0x3f8e('0xe'),_0x37632c,'request\x20sent');logger[_0x3f8e('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x37632c,_0x3f8e('0x10'),JSON[_0x3f8e('0x11')](_0x367795));if(_0x367795[_0x3f8e('0x12')]){if(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x13')]===0x1f4){logger[_0x3f8e('0x12')](_0x3f8e('0xe'),_0x37632c,_0x367795['error']['message']);return _0x50e008(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);}logger['error'](_0x3f8e('0xe'),_0x37632c,_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);return _0x2e733a(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);}else{logger[_0x3f8e('0xd')]('Condition,\x20%s,\x20%s',_0x37632c,_0x3f8e('0x10'));_0x2e733a(_0x367795[_0x3f8e('0x15')][_0x3f8e('0x14')]);}})[_0x3f8e('0x16')](function(_0x13723a){logger[_0x3f8e('0x12')]('Condition,\x20%s,\x20%s',_0x37632c,_0x13723a);_0x50e008(_0x13723a);});});}