d550568f30ae826dc74b8dcc76ba3e818c3d86c5
[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 _0x8c5a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util'];(function(_0x5c7668,_0x3dc6e1){var _0x33ae77=function(_0x6cccfc){while(--_0x6cccfc){_0x5c7668['push'](_0x5c7668['shift']());}};_0x33ae77(++_0x3dc6e1);}(_0x8c5a,0x1b6));var _0xa8c5=function(_0xef57e2,_0x4f9cf3){_0xef57e2=_0xef57e2-0x0;var _0x4352d1=_0x8c5a[_0xef57e2];return _0x4352d1;};'use strict';var _=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var moment=require(_0xa8c5('0x2'));var BPromise=require(_0xa8c5('0x3'));var rs=require(_0xa8c5('0x4'));var fs=require('fs');var Redis=require(_0xa8c5('0x5'));var db=require(_0xa8c5('0x6'))['db'];var utils=require(_0xa8c5('0x7'));var logger=require('../../config/logger')(_0xa8c5('0x8'));var config=require(_0xa8c5('0x9'));var jayson=require(_0xa8c5('0xa'));var client=jayson[_0xa8c5('0xb')][_0xa8c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52840e,_0x4adddb,_0x369858){return new BPromise(function(_0x15531e,_0x9ab944){return client['request'](_0x52840e,_0x369858)[_0xa8c5('0xd')](function(_0x14014e){logger['info'](_0xa8c5('0xe'),_0x4adddb,_0xa8c5('0xf'));logger['debug'](_0xa8c5('0x10'),_0x4adddb,_0xa8c5('0xf'),JSON[_0xa8c5('0x11')](_0x14014e));if(_0x14014e[_0xa8c5('0x12')]){if(_0x14014e[_0xa8c5('0x12')]['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4adddb,_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);return _0x9ab944(_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);}logger[_0xa8c5('0x12')](_0xa8c5('0xe'),_0x4adddb,_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);return _0x15531e(_0x14014e['error'][_0xa8c5('0x13')]);}else{logger[_0xa8c5('0x14')](_0xa8c5('0xe'),_0x4adddb,_0xa8c5('0xf'));_0x15531e(_0x14014e[_0xa8c5('0x15')][_0xa8c5('0x13')]);}})['catch'](function(_0xafd0a){logger[_0xa8c5('0x12')](_0xa8c5('0xe'),_0x4adddb,_0xafd0a);_0x9ab944(_0xafd0a);});});}