51f86de535d03ca24101a11641011532757b6ba8
[motion2.git] / server / api / intServicenowField / intServicenowField.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 _0xa648=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xbffc8c,_0x44e49e){var _0x13d9de=function(_0x584f5d){while(--_0x584f5d){_0xbffc8c['push'](_0xbffc8c['shift']());}};_0x13d9de(++_0x44e49e);}(_0xa648,0x185));var _0x8a64=function(_0x240b5c,_0x2230eb){_0x240b5c=_0x240b5c-0x0;var _0x26299d=_0xa648[_0x240b5c];return _0x26299d;};'use strict';var _=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a64('0x2'));var fs=require('fs');var Redis=require(_0x8a64('0x3'));var db=require(_0x8a64('0x4'))['db'];var utils=require(_0x8a64('0x5'));var logger=require(_0x8a64('0x6'))(_0x8a64('0x7'));var config=require(_0x8a64('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8a64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fc4ef,_0x1b1ed0,_0x155bfe){return new BPromise(function(_0x460cb7,_0x3afb30){return client[_0x8a64('0xa')](_0x4fc4ef,_0x155bfe)[_0x8a64('0xb')](function(_0x5feb8){logger[_0x8a64('0xc')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x8a64('0xd'));logger[_0x8a64('0xe')](_0x8a64('0xf'),_0x1b1ed0,_0x8a64('0xd'),JSON[_0x8a64('0x10')](_0x5feb8));if(_0x5feb8['error']){if(_0x5feb8[_0x8a64('0x11')][_0x8a64('0x12')]===0x1f4){logger[_0x8a64('0x11')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);return _0x3afb30(_0x5feb8['error'][_0x8a64('0x13')]);}logger[_0x8a64('0x11')](_0x8a64('0x14'),_0x1b1ed0,_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);return _0x460cb7(_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);}else{logger[_0x8a64('0xc')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x8a64('0xd'));_0x460cb7(_0x5feb8['result']['message']);}})[_0x8a64('0x15')](function(_0x1fda22){logger[_0x8a64('0x11')](_0x8a64('0x14'),_0x1b1ed0,_0x1fda22);_0x3afb30(_0x1fda22);});});}