aa107a30c664b149607f9aa49784deb171d69ece
[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 _0x62b5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x5cadad,_0x24b23b){var _0x2374c3=function(_0x26867b){while(--_0x26867b){_0x5cadad['push'](_0x5cadad['shift']());}};_0x2374c3(++_0x24b23b);}(_0x62b5,0x11d));var _0x562b=function(_0x491747,_0x43ec48){_0x491747=_0x491747-0x0;var _0x3050f6=_0x62b5[_0x491747];return _0x3050f6;};'use strict';var _=require(_0x562b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x562b('0x1'));var rs=require(_0x562b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x562b('0x3'))['db'];var utils=require(_0x562b('0x4'));var logger=require(_0x562b('0x5'))(_0x562b('0x6'));var config=require(_0x562b('0x7'));var jayson=require(_0x562b('0x8'));var client=jayson[_0x562b('0x9')][_0x562b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277f68,_0x580c68,_0x41133f){return new BPromise(function(_0x53958e,_0x525871){return client['request'](_0x277f68,_0x41133f)[_0x562b('0xb')](function(_0x2b0eda){logger[_0x562b('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x580c68,'request\x20sent');logger[_0x562b('0xd')](_0x562b('0xe'),_0x580c68,_0x562b('0xf'),JSON[_0x562b('0x10')](_0x2b0eda));if(_0x2b0eda[_0x562b('0x11')]){if(_0x2b0eda[_0x562b('0x11')]['code']===0x1f4){logger[_0x562b('0x11')](_0x562b('0x12'),_0x580c68,_0x2b0eda[_0x562b('0x11')][_0x562b('0x13')]);return _0x525871(_0x2b0eda['error'][_0x562b('0x13')]);}logger[_0x562b('0x11')](_0x562b('0x12'),_0x580c68,_0x2b0eda['error'][_0x562b('0x13')]);return _0x53958e(_0x2b0eda[_0x562b('0x11')][_0x562b('0x13')]);}else{logger[_0x562b('0xc')](_0x562b('0x12'),_0x580c68,_0x562b('0xf'));_0x53958e(_0x2b0eda[_0x562b('0x14')][_0x562b('0x13')]);}})[_0x562b('0x15')](function(_0x2005b3){logger[_0x562b('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x580c68,_0x2005b3);_0x525871(_0x2005b3);});});}