Built motion from commit (unavailable).|2.5.4
[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 _0xf591=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf591,0x1e2));var _0x1f59=function(_0x37c279,_0x4f9587){_0x37c279=_0x37c279-0x0;var _0x1024bc=_0xf591[_0x37c279];return _0x1024bc;};'use strict';var _=require('lodash');var util=require(_0x1f59('0x0'));var moment=require('moment');var BPromise=require(_0x1f59('0x1'));var rs=require(_0x1f59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f59('0x3'))['db'];var utils=require(_0x1f59('0x4'));var logger=require(_0x1f59('0x5'))(_0x1f59('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f59('0x7'));var client=jayson[_0x1f59('0x8')][_0x1f59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f9be,_0x1c321f,_0x3b15b5){return new BPromise(function(_0xebfeb4,_0x326cf1){return client['request'](_0x6f9be,_0x3b15b5)['then'](function(_0x3e0c76){logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,_0x1f59('0xc'));logger[_0x1f59('0xd')](_0x1f59('0xe'),_0x1c321f,_0x1f59('0xc'),JSON[_0x1f59('0xf')](_0x3e0c76));if(_0x3e0c76[_0x1f59('0x10')]){if(_0x3e0c76[_0x1f59('0x10')]['code']===0x1f4){logger['error'](_0x1f59('0xb'),_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0x326cf1(_0x3e0c76[_0x1f59('0x10')]['message']);}logger[_0x1f59('0x10')]('ServicenowField,\x20%s,\x20%s',_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0xebfeb4(_0x3e0c76['error'][_0x1f59('0x11')]);}else{logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,'request\x20sent');_0xebfeb4(_0x3e0c76[_0x1f59('0x12')][_0x1f59('0x11')]);}})[_0x1f59('0x13')](function(_0x4520ff){logger[_0x1f59('0x10')](_0x1f59('0xb'),_0x1c321f,_0x4520ff);_0x326cf1(_0x4520ff);});});}