3dd0119286fc605a40d08a4e0d9c629da09cd4eb
[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 _0xaf94=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x35d8aa,_0x17d13a){var _0x292e20=function(_0x3512e9){while(--_0x3512e9){_0x35d8aa['push'](_0x35d8aa['shift']());}};_0x292e20(++_0x17d13a);}(_0xaf94,0x78));var _0x4af9=function(_0x57417e,_0x3b4733){_0x57417e=_0x57417e-0x0;var _0x2b2c09=_0xaf94[_0x57417e];return _0x2b2c09;};'use strict';var _=require(_0x4af9('0x0'));var util=require(_0x4af9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4af9('0x2'));var fs=require('fs');var Redis=require(_0x4af9('0x3'));var db=require(_0x4af9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4af9('0x5'))('rpc');var config=require(_0x4af9('0x6'));var jayson=require(_0x4af9('0x7'));var client=jayson['client'][_0x4af9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x417b92,_0x507a98,_0x47cd13){return new BPromise(function(_0x529bfc,_0x520f01){return client['request'](_0x417b92,_0x47cd13)[_0x4af9('0x9')](function(_0x226e60){logger[_0x4af9('0xa')](_0x4af9('0xb'),_0x507a98,'request\x20sent');logger[_0x4af9('0xc')](_0x4af9('0xd'),_0x507a98,'request\x20sent',JSON[_0x4af9('0xe')](_0x226e60));if(_0x226e60[_0x4af9('0xf')]){if(_0x226e60[_0x4af9('0xf')][_0x4af9('0x10')]===0x1f4){logger[_0x4af9('0xf')](_0x4af9('0xb'),_0x507a98,_0x226e60[_0x4af9('0xf')]['message']);return _0x520f01(_0x226e60[_0x4af9('0xf')][_0x4af9('0x11')]);}logger[_0x4af9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x507a98,_0x226e60[_0x4af9('0xf')][_0x4af9('0x11')]);return _0x529bfc(_0x226e60[_0x4af9('0xf')]['message']);}else{logger[_0x4af9('0xa')](_0x4af9('0xb'),_0x507a98,_0x4af9('0x12'));_0x529bfc(_0x226e60['result'][_0x4af9('0x11')]);}})[_0x4af9('0x13')](function(_0xfc579d){logger[_0x4af9('0xf')](_0x4af9('0xb'),_0x507a98,_0xfc579d);_0x520f01(_0xfc579d);});});}