8159c37f20bcd0ea9da8324f08443f99f26c9569
[motion2.git] / server / api / intDynamics365Configuration / intDynamics365Configuration.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 _0xdb52=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xdb52,0x115));var _0x2db5=function(_0x89973f,_0x6c55d2){_0x89973f=_0x89973f-0x0;var _0x56a8c7=_0xdb52[_0x89973f];return _0x56a8c7;};'use strict';var _=require(_0x2db5('0x0'));var util=require(_0x2db5('0x1'));var moment=require(_0x2db5('0x2'));var BPromise=require(_0x2db5('0x3'));var rs=require(_0x2db5('0x4'));var fs=require('fs');var Redis=require(_0x2db5('0x5'));var db=require(_0x2db5('0x6'))['db'];var utils=require(_0x2db5('0x7'));var logger=require('../../config/logger')(_0x2db5('0x8'));var config=require(_0x2db5('0x9'));var jayson=require(_0x2db5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x347e23,_0x5de0db,_0x5a9023){return new BPromise(function(_0x29c8a5,_0x1ee6d7){return client['request'](_0x347e23,_0x5a9023)[_0x2db5('0xb')](function(_0xe60d9c){logger['info'](_0x2db5('0xc'),_0x5de0db,'request\x20sent');logger[_0x2db5('0xd')](_0x2db5('0xe'),_0x5de0db,_0x2db5('0xf'),JSON['stringify'](_0xe60d9c));if(_0xe60d9c[_0x2db5('0x10')]){if(_0xe60d9c[_0x2db5('0x10')]['code']===0x1f4){logger[_0x2db5('0x10')](_0x2db5('0xc'),_0x5de0db,_0xe60d9c[_0x2db5('0x10')][_0x2db5('0x11')]);return _0x1ee6d7(_0xe60d9c[_0x2db5('0x10')][_0x2db5('0x11')]);}logger[_0x2db5('0x10')](_0x2db5('0xc'),_0x5de0db,_0xe60d9c[_0x2db5('0x10')][_0x2db5('0x11')]);return _0x29c8a5(_0xe60d9c[_0x2db5('0x10')][_0x2db5('0x11')]);}else{logger[_0x2db5('0x12')](_0x2db5('0xc'),_0x5de0db,_0x2db5('0xf'));_0x29c8a5(_0xe60d9c['result'][_0x2db5('0x11')]);}})[_0x2db5('0x13')](function(_0x519391){logger['error'](_0x2db5('0xc'),_0x5de0db,_0x519391);_0x1ee6d7(_0x519391);});});}