da43394716d6f9fc1d433a88ed576b2edd7064ff
[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 _0xfaf3=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfaf3,0x118));var _0x3faf=function(_0x2894d9,_0x5dcc92){_0x2894d9=_0x2894d9-0x0;var _0x58953c=_0xfaf3[_0x2894d9];return _0x58953c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3faf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3faf('0x1'));var db=require(_0x3faf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3faf('0x3'))(_0x3faf('0x4'));var config=require(_0x3faf('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3faf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41eb8e,_0x12cc3a,_0x1120d6){return new BPromise(function(_0xe406f3,_0x545776){return client['request'](_0x41eb8e,_0x1120d6)[_0x3faf('0x7')](function(_0xb01373){logger[_0x3faf('0x8')](_0x3faf('0x9'),_0x12cc3a,_0x3faf('0xa'));logger[_0x3faf('0xb')](_0x3faf('0xc'),_0x12cc3a,_0x3faf('0xa'),JSON[_0x3faf('0xd')](_0xb01373));if(_0xb01373['error']){if(_0xb01373[_0x3faf('0xe')]['code']===0x1f4){logger[_0x3faf('0xe')](_0x3faf('0x9'),_0x12cc3a,_0xb01373['error'][_0x3faf('0xf')]);return _0x545776(_0xb01373[_0x3faf('0xe')][_0x3faf('0xf')]);}logger[_0x3faf('0xe')](_0x3faf('0x9'),_0x12cc3a,_0xb01373['error'][_0x3faf('0xf')]);return _0xe406f3(_0xb01373[_0x3faf('0xe')][_0x3faf('0xf')]);}else{logger[_0x3faf('0x8')](_0x3faf('0x9'),_0x12cc3a,_0x3faf('0xa'));_0xe406f3(_0xb01373['result'][_0x3faf('0xf')]);}})[_0x3faf('0x10')](function(_0x5631b7){logger['error'](_0x3faf('0x9'),_0x12cc3a,_0x5631b7);_0x545776(_0x5631b7);});});}