9e8a4565ac956fd72d86ac68ef21e244b7940a58
[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 _0x8c53=['../../config/environment','jayson/promise','http','request\x20sent','debug','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1a1d2b,_0x296e0b){var _0x1b2212=function(_0x492a85){while(--_0x492a85){_0x1a1d2b['push'](_0x1a1d2b['shift']());}};_0x1b2212(++_0x296e0b);}(_0x8c53,0x174));var _0x38c5=function(_0xce694,_0x41edf3){_0xce694=_0xce694-0x0;var _0x6207ae=_0x8c53[_0xce694];return _0x6207ae;};'use strict';var _=require(_0x38c5('0x0'));var util=require(_0x38c5('0x1'));var moment=require(_0x38c5('0x2'));var BPromise=require(_0x38c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38c5('0x4'));var db=require(_0x38c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38c5('0x6'))(_0x38c5('0x7'));var config=require(_0x38c5('0x8'));var jayson=require(_0x38c5('0x9'));var client=jayson['client'][_0x38c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4599ab,_0x1f645c,_0x1f9865){return new BPromise(function(_0x21e452,_0x3128e6){return client['request'](_0x4599ab,_0x1f9865)['then'](function(_0x5c7aaa){logger['info']('ServicenowField,\x20%s,\x20%s',_0x1f645c,_0x38c5('0xb'));logger[_0x38c5('0xc')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x1f645c,'request\x20sent',JSON[_0x38c5('0xd')](_0x5c7aaa));if(_0x5c7aaa[_0x38c5('0xe')]){if(_0x5c7aaa[_0x38c5('0xe')][_0x38c5('0xf')]===0x1f4){logger['error']('ServicenowField,\x20%s,\x20%s',_0x1f645c,_0x5c7aaa[_0x38c5('0xe')]['message']);return _0x3128e6(_0x5c7aaa[_0x38c5('0xe')][_0x38c5('0x10')]);}logger[_0x38c5('0xe')](_0x38c5('0x11'),_0x1f645c,_0x5c7aaa[_0x38c5('0xe')][_0x38c5('0x10')]);return _0x21e452(_0x5c7aaa[_0x38c5('0xe')][_0x38c5('0x10')]);}else{logger[_0x38c5('0x12')](_0x38c5('0x11'),_0x1f645c,_0x38c5('0xb'));_0x21e452(_0x5c7aaa['result'][_0x38c5('0x10')]);}})[_0x38c5('0x13')](function(_0x184d85){logger[_0x38c5('0xe')]('ServicenowField,\x20%s,\x20%s',_0x1f645c,_0x184d85);_0x3128e6(_0x184d85);});});}