a6feaff2d19158beb51473dd3e54cf67aff31dcc
[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 _0x0b97=['http','request','ServicenowConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x507f9e,_0x308d20){var _0x250f7e=function(_0x144202){while(--_0x144202){_0x507f9e['push'](_0x507f9e['shift']());}};_0x250f7e(++_0x308d20);}(_0x0b97,0x12b));var _0x70b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0b97[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x70b9('0x0'));var moment=require('moment');var BPromise=require(_0x70b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70b9('0x2'));var db=require(_0x70b9('0x3'))['db'];var utils=require(_0x70b9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x70b9('0x5'));var jayson=require(_0x70b9('0x6'));var client=jayson['client'][_0x70b9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37a823,_0x2a1ef5,_0x2ec3ce){return new BPromise(function(_0x2d79e8,_0x20e7f7){return client[_0x70b9('0x8')](_0x37a823,_0x2ec3ce)['then'](function(_0x32cbc8){logger['info'](_0x70b9('0x9'),_0x2a1ef5,'request\x20sent');logger[_0x70b9('0xa')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2a1ef5,'request\x20sent',JSON[_0x70b9('0xb')](_0x32cbc8));if(_0x32cbc8[_0x70b9('0xc')]){if(_0x32cbc8['error'][_0x70b9('0xd')]===0x1f4){logger[_0x70b9('0xc')](_0x70b9('0x9'),_0x2a1ef5,_0x32cbc8[_0x70b9('0xc')][_0x70b9('0xe')]);return _0x20e7f7(_0x32cbc8[_0x70b9('0xc')][_0x70b9('0xe')]);}logger[_0x70b9('0xc')](_0x70b9('0x9'),_0x2a1ef5,_0x32cbc8[_0x70b9('0xc')]['message']);return _0x2d79e8(_0x32cbc8['error'][_0x70b9('0xe')]);}else{logger[_0x70b9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a1ef5,_0x70b9('0x10'));_0x2d79e8(_0x32cbc8[_0x70b9('0x11')][_0x70b9('0xe')]);}})['catch'](function(_0x3e6440){logger[_0x70b9('0xc')](_0x70b9('0x9'),_0x2a1ef5,_0x3e6440);_0x20e7f7(_0x3e6440);});});}