Built motion from commit 4d4d9a88.|2.6.26
[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 _0x2263=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x2263,0xa7));var _0x3226=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x2263[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x3226('0x0'));var util=require(_0x3226('0x1'));var moment=require('moment');var BPromise=require(_0x3226('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3226('0x3'));var db=require(_0x3226('0x4'))['db'];var utils=require(_0x3226('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3226('0x6'));var client=jayson['client'][_0x3226('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x430663,_0x5dd0cd,_0x443b09){return new BPromise(function(_0x4636cc,_0x2d491d){return client[_0x3226('0x8')](_0x430663,_0x443b09)[_0x3226('0x9')](function(_0x5d290b){logger[_0x3226('0xa')](_0x3226('0xb'),_0x5dd0cd,_0x3226('0xc'));logger[_0x3226('0xd')](_0x3226('0xe'),_0x5dd0cd,_0x3226('0xc'),JSON[_0x3226('0xf')](_0x5d290b));if(_0x5d290b[_0x3226('0x10')]){if(_0x5d290b['error']['code']===0x1f4){logger[_0x3226('0x10')](_0x3226('0xb'),_0x5dd0cd,_0x5d290b[_0x3226('0x10')][_0x3226('0x11')]);return _0x2d491d(_0x5d290b[_0x3226('0x10')][_0x3226('0x11')]);}logger[_0x3226('0x10')](_0x3226('0xb'),_0x5dd0cd,_0x5d290b[_0x3226('0x10')][_0x3226('0x11')]);return _0x4636cc(_0x5d290b[_0x3226('0x10')]['message']);}else{logger[_0x3226('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5dd0cd,_0x3226('0xc'));_0x4636cc(_0x5d290b['result']['message']);}})['catch'](function(_0x3c64db){logger['error'](_0x3226('0xb'),_0x5dd0cd,_0x3c64db);_0x2d491d(_0x3c64db);});});}