1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x3343=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x246fb1,_0x3a35d3){var _0x3a9e9f=function(_0x39e3eb){while(--_0x39e3eb){_0x246fb1['push'](_0x246fb1['shift']());}};_0x3a9e9f(++_0x3a35d3);}(_0x3343,0x1aa));var _0x3334=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3343[_0x1ae491];return _0x4958a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3334('0x0'));var BPromise=require(_0x3334('0x1'));var rs=require(_0x3334('0x2'));var fs=require('fs');var Redis=require(_0x3334('0x3'));var db=require(_0x3334('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3334('0x5'))(_0x3334('0x6'));var config=require('../../config/environment');var jayson=require(_0x3334('0x7'));var client=jayson[_0x3334('0x8')][_0x3334('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bdf7d,_0x3d4d12,_0x3e5d52){return new BPromise(function(_0x47c143,_0x2b4ea9){return client[_0x3334('0xa')](_0x2bdf7d,_0x3e5d52)[_0x3334('0xb')](function(_0x211018){logger[_0x3334('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3d4d12,_0x3334('0xd'));logger['debug'](_0x3334('0xe'),_0x3d4d12,_0x3334('0xd'),JSON[_0x3334('0xf')](_0x211018));if(_0x211018['error']){if(_0x211018['error'][_0x3334('0x10')]===0x1f4){logger[_0x3334('0x11')](_0x3334('0x12'),_0x3d4d12,_0x211018[_0x3334('0x11')][_0x3334('0x13')]);return _0x2b4ea9(_0x211018['error']['message']);}logger[_0x3334('0x11')](_0x3334('0x12'),_0x3d4d12,_0x211018['error'][_0x3334('0x13')]);return _0x47c143(_0x211018['error']['message']);}else{logger[_0x3334('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3d4d12,_0x3334('0xd'));_0x47c143(_0x211018[_0x3334('0x14')]['message']);}})[_0x3334('0x15')](function(_0x5b2188){logger[_0x3334('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3d4d12,_0x5b2188);_0x2b4ea9(_0x5b2188);});});}