4a1915c27f1814e7874880238989b55e12f3ef3a
[motion2.git] / server / api / intServicenowConfiguration / intServicenowConfiguration.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 _0xe4a6=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x422672,_0x4af79c){var _0x1ae61d=function(_0x40a2ce){while(--_0x40a2ce){_0x422672['push'](_0x422672['shift']());}};_0x1ae61d(++_0x4af79c);}(_0xe4a6,0x17c));var _0x6e4a=function(_0x1ba88a,_0x30b1d8){_0x1ba88a=_0x1ba88a-0x0;var _0x5d0fe7=_0xe4a6[_0x1ba88a];return _0x5d0fe7;};'use strict';var _=require(_0x6e4a('0x0'));var util=require(_0x6e4a('0x1'));var moment=require('moment');var BPromise=require(_0x6e4a('0x2'));var rs=require(_0x6e4a('0x3'));var fs=require('fs');var Redis=require(_0x6e4a('0x4'));var db=require(_0x6e4a('0x5'))['db'];var utils=require(_0x6e4a('0x6'));var logger=require(_0x6e4a('0x7'))(_0x6e4a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39610a,_0x2b9c78,_0x7096f5){return new BPromise(function(_0xdb4e6,_0x10c454){return client['request'](_0x39610a,_0x7096f5)['then'](function(_0x2f7dff){logger[_0x6e4a('0xa')](_0x6e4a('0xb'),_0x2b9c78,_0x6e4a('0xc'));logger['debug'](_0x6e4a('0xd'),_0x2b9c78,_0x6e4a('0xc'),JSON['stringify'](_0x2f7dff));if(_0x2f7dff[_0x6e4a('0xe')]){if(_0x2f7dff[_0x6e4a('0xe')][_0x6e4a('0xf')]===0x1f4){logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x2f7dff[_0x6e4a('0xe')][_0x6e4a('0x10')]);return _0x10c454(_0x2f7dff[_0x6e4a('0xe')]['message']);}logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x2f7dff['error'][_0x6e4a('0x10')]);return _0xdb4e6(_0x2f7dff[_0x6e4a('0xe')]['message']);}else{logger[_0x6e4a('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b9c78,_0x6e4a('0xc'));_0xdb4e6(_0x2f7dff[_0x6e4a('0x11')]['message']);}})[_0x6e4a('0x12')](function(_0x4dc72b){logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x4dc72b);_0x10c454(_0x4dc72b);});});}