f442254c0ead5203f02ad2f07b2d64075066b5db
[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 _0x789f=['client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30007d,_0x343e2a){var _0x47d7eb=function(_0x2b4f4b){while(--_0x2b4f4b){_0x30007d['push'](_0x30007d['shift']());}};_0x47d7eb(++_0x343e2a);}(_0x789f,0x10c));var _0xf789=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0x789f[_0x1fb4e1];return _0x22d1b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf789('0x0'));var BPromise=require(_0xf789('0x1'));var rs=require(_0xf789('0x2'));var fs=require('fs');var Redis=require(_0xf789('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf789('0x4'));var logger=require(_0xf789('0x5'))(_0xf789('0x6'));var config=require(_0xf789('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf789('0x8')][_0xf789('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55303d,_0x5414da,_0x1a1a38){return new BPromise(function(_0x3e9372,_0x1cb6de){return client[_0xf789('0xa')](_0x55303d,_0x1a1a38)[_0xf789('0xb')](function(_0x9aecfa){logger[_0xf789('0xc')](_0xf789('0xd'),_0x5414da,_0xf789('0xe'));logger[_0xf789('0xf')](_0xf789('0x10'),_0x5414da,'request\x20sent',JSON[_0xf789('0x11')](_0x9aecfa));if(_0x9aecfa[_0xf789('0x12')]){if(_0x9aecfa[_0xf789('0x12')][_0xf789('0x13')]===0x1f4){logger[_0xf789('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5414da,_0x9aecfa['error']['message']);return _0x1cb6de(_0x9aecfa['error']['message']);}logger[_0xf789('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5414da,_0x9aecfa[_0xf789('0x12')][_0xf789('0x14')]);return _0x3e9372(_0x9aecfa[_0xf789('0x12')][_0xf789('0x14')]);}else{logger[_0xf789('0xc')](_0xf789('0xd'),_0x5414da,_0xf789('0xe'));_0x3e9372(_0x9aecfa[_0xf789('0x15')][_0xf789('0x14')]);}})[_0xf789('0x16')](function(_0x31a79e){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5414da,_0x31a79e);_0x1cb6de(_0x31a79e);});});}