925c35dc089126478e507acff842e1d63ed55c17
[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 _0xb442=['request\x20sent','debug','error','code','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x2da31b,_0x57f767){var _0x52e56c=function(_0x58d75f){while(--_0x58d75f){_0x2da31b['push'](_0x2da31b['shift']());}};_0x52e56c(++_0x57f767);}(_0xb442,0x7d));var _0x2b44=function(_0x3a5da5,_0x58eaa0){_0x3a5da5=_0x3a5da5-0x0;var _0x2de0e5=_0xb442[_0x3a5da5];return _0x2de0e5;};'use strict';var _=require('lodash');var util=require(_0x2b44('0x0'));var moment=require(_0x2b44('0x1'));var BPromise=require(_0x2b44('0x2'));var rs=require(_0x2b44('0x3'));var fs=require('fs');var Redis=require(_0x2b44('0x4'));var db=require(_0x2b44('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2b44('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2b44('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5761b4,_0x535e52,_0xbf0362){return new BPromise(function(_0x58fdc7,_0x58053e){return client[_0x2b44('0x8')](_0x5761b4,_0xbf0362)[_0x2b44('0x9')](function(_0x5c428){logger['info'](_0x2b44('0xa'),_0x535e52,_0x2b44('0xb'));logger[_0x2b44('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x535e52,'request\x20sent',JSON['stringify'](_0x5c428));if(_0x5c428[_0x2b44('0xd')]){if(_0x5c428[_0x2b44('0xd')][_0x2b44('0xe')]===0x1f4){logger[_0x2b44('0xd')](_0x2b44('0xa'),_0x535e52,_0x5c428[_0x2b44('0xd')][_0x2b44('0xf')]);return _0x58053e(_0x5c428[_0x2b44('0xd')]['message']);}logger[_0x2b44('0xd')](_0x2b44('0xa'),_0x535e52,_0x5c428['error']['message']);return _0x58fdc7(_0x5c428[_0x2b44('0xd')]['message']);}else{logger[_0x2b44('0x10')](_0x2b44('0xa'),_0x535e52,_0x2b44('0xb'));_0x58fdc7(_0x5c428['result']['message']);}})['catch'](function(_0x20b0a9){logger[_0x2b44('0xd')](_0x2b44('0xa'),_0x535e52,_0x20b0a9);_0x58053e(_0x20b0a9);});});}