7fedfb0e2e22b886dfb28e0ebca4f28253a04989
[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 _0x9a33=['rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x189fd9,_0x3c2480){var _0x13f098=function(_0x3d5b43){while(--_0x3d5b43){_0x189fd9['push'](_0x189fd9['shift']());}};_0x13f098(++_0x3c2480);}(_0x9a33,0x6c));var _0x39a3=function(_0x591df1,_0xd2030b){_0x591df1=_0x591df1-0x0;var _0x28f068=_0x9a33[_0x591df1];return _0x28f068;};'use strict';var _=require('lodash');var util=require(_0x39a3('0x0'));var moment=require(_0x39a3('0x1'));var BPromise=require(_0x39a3('0x2'));var rs=require(_0x39a3('0x3'));var fs=require('fs');var Redis=require(_0x39a3('0x4'));var db=require(_0x39a3('0x5'))['db'];var utils=require(_0x39a3('0x6'));var logger=require('../../config/logger')(_0x39a3('0x7'));var config=require('../../config/environment');var jayson=require(_0x39a3('0x8'));var client=jayson[_0x39a3('0x9')][_0x39a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222b4a,_0x8dce84,_0x55c4ed){return new BPromise(function(_0x20c3c8,_0x109206){return client[_0x39a3('0xb')](_0x222b4a,_0x55c4ed)[_0x39a3('0xc')](function(_0x345946){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x8dce84,'request\x20sent');logger['debug'](_0x39a3('0xd'),_0x8dce84,_0x39a3('0xe'),JSON[_0x39a3('0xf')](_0x345946));if(_0x345946[_0x39a3('0x10')]){if(_0x345946[_0x39a3('0x10')][_0x39a3('0x11')]===0x1f4){logger['error'](_0x39a3('0x12'),_0x8dce84,_0x345946[_0x39a3('0x10')][_0x39a3('0x13')]);return _0x109206(_0x345946[_0x39a3('0x10')][_0x39a3('0x13')]);}logger[_0x39a3('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x8dce84,_0x345946['error']['message']);return _0x20c3c8(_0x345946[_0x39a3('0x10')][_0x39a3('0x13')]);}else{logger[_0x39a3('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x8dce84,_0x39a3('0xe'));_0x20c3c8(_0x345946[_0x39a3('0x15')][_0x39a3('0x13')]);}})[_0x39a3('0x16')](function(_0x343be2){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x8dce84,_0x343be2);_0x109206(_0x343be2);});});}