75d0dc39fb7efe3725bb0fbcac3df768670abdea
[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 _0x9199=['message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x4562b6,_0x2fd3bf){var _0x751dfa=function(_0x35a4d0){while(--_0x35a4d0){_0x4562b6['push'](_0x4562b6['shift']());}};_0x751dfa(++_0x2fd3bf);}(_0x9199,0x1e9));var _0x9919=function(_0x5b5c45,_0x199467){_0x5b5c45=_0x5b5c45-0x0;var _0x2cd0dd=_0x9199[_0x5b5c45];return _0x2cd0dd;};'use strict';var _=require(_0x9919('0x0'));var util=require(_0x9919('0x1'));var moment=require('moment');var BPromise=require(_0x9919('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9919('0x3'));var db=require(_0x9919('0x4'))['db'];var utils=require(_0x9919('0x5'));var logger=require('../../config/logger')(_0x9919('0x6'));var config=require(_0x9919('0x7'));var jayson=require(_0x9919('0x8'));var client=jayson['client'][_0x9919('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40520a,_0x2ed62b,_0x4ef41b){return new BPromise(function(_0x208e9d,_0x4a76e8){return client[_0x9919('0xa')](_0x40520a,_0x4ef41b)['then'](function(_0x2f6736){logger['info'](_0x9919('0xb'),_0x2ed62b,_0x9919('0xc'));logger['debug'](_0x9919('0xd'),_0x2ed62b,_0x9919('0xc'),JSON['stringify'](_0x2f6736));if(_0x2f6736[_0x9919('0xe')]){if(_0x2f6736[_0x9919('0xe')]['code']===0x1f4){logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x2f6736['error'][_0x9919('0xf')]);return _0x4a76e8(_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);}logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);return _0x208e9d(_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);}else{logger[_0x9919('0x10')](_0x9919('0xb'),_0x2ed62b,_0x9919('0xc'));_0x208e9d(_0x2f6736[_0x9919('0x11')][_0x9919('0xf')]);}})['catch'](function(_0x382e8a){logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x382e8a);_0x4a76e8(_0x382e8a);});});}