9d0cb4f075311ac0a6fef77a0db48ed7f59aa17d
[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 _0x175b=['request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s'];(function(_0x534b1,_0x53162d){var _0x3ac587=function(_0x1320a0){while(--_0x1320a0){_0x534b1['push'](_0x534b1['shift']());}};_0x3ac587(++_0x53162d);}(_0x175b,0xbf));var _0xb175=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x175b[_0x463376];return _0x336ccd;};'use strict';var _=require(_0xb175('0x0'));var util=require(_0xb175('0x1'));var moment=require(_0xb175('0x2'));var BPromise=require(_0xb175('0x3'));var rs=require(_0xb175('0x4'));var fs=require('fs');var Redis=require(_0xb175('0x5'));var db=require(_0xb175('0x6'))['db'];var utils=require(_0xb175('0x7'));var logger=require('../../config/logger')(_0xb175('0x8'));var config=require(_0xb175('0x9'));var jayson=require(_0xb175('0xa'));var client=jayson[_0xb175('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2411fa,_0x185d97,_0x43278e){return new BPromise(function(_0x1e8602,_0x4e7004){return client[_0xb175('0xc')](_0x2411fa,_0x43278e)[_0xb175('0xd')](function(_0x551485){logger[_0xb175('0xe')](_0xb175('0xf'),_0x185d97,_0xb175('0x10'));logger['debug'](_0xb175('0x11'),_0x185d97,_0xb175('0x10'),JSON[_0xb175('0x12')](_0x551485));if(_0x551485['error']){if(_0x551485[_0xb175('0x13')][_0xb175('0x14')]===0x1f4){logger[_0xb175('0x13')](_0xb175('0xf'),_0x185d97,_0x551485[_0xb175('0x13')][_0xb175('0x15')]);return _0x4e7004(_0x551485['error'][_0xb175('0x15')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x185d97,_0x551485['error'][_0xb175('0x15')]);return _0x1e8602(_0x551485[_0xb175('0x13')][_0xb175('0x15')]);}else{logger[_0xb175('0xe')](_0xb175('0xf'),_0x185d97,_0xb175('0x10'));_0x1e8602(_0x551485[_0xb175('0x16')][_0xb175('0x15')]);}})['catch'](function(_0x15dc13){logger[_0xb175('0x13')](_0xb175('0xf'),_0x185d97,_0x15dc13);_0x4e7004(_0x15dc13);});});}