568eda30796aac99ba03294cdd2db71dfcca1bb4
[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 _0x2b96=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x125f7f,_0x491196){var _0x5d42c3=function(_0x21d8e5){while(--_0x21d8e5){_0x125f7f['push'](_0x125f7f['shift']());}};_0x5d42c3(++_0x491196);}(_0x2b96,0x1db));var _0x62b9=function(_0x2b79f4,_0x50d267){_0x2b79f4=_0x2b79f4-0x0;var _0x111a9c=_0x2b96[_0x2b79f4];return _0x111a9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x62b9('0x0'));var BPromise=require(_0x62b9('0x1'));var rs=require(_0x62b9('0x2'));var fs=require('fs');var Redis=require(_0x62b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x62b9('0x4'));var logger=require(_0x62b9('0x5'))(_0x62b9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x62b9('0x7')][_0x62b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4358f5,_0x528c26,_0x42510f){return new BPromise(function(_0x221f69,_0x3be48e){return client[_0x62b9('0x9')](_0x4358f5,_0x42510f)[_0x62b9('0xa')](function(_0x11fef8){logger[_0x62b9('0xb')](_0x62b9('0xc'),_0x528c26,_0x62b9('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x528c26,'request\x20sent',JSON[_0x62b9('0xe')](_0x11fef8));if(_0x11fef8[_0x62b9('0xf')]){if(_0x11fef8[_0x62b9('0xf')][_0x62b9('0x10')]===0x1f4){logger[_0x62b9('0xf')](_0x62b9('0xc'),_0x528c26,_0x11fef8[_0x62b9('0xf')][_0x62b9('0x11')]);return _0x3be48e(_0x11fef8[_0x62b9('0xf')]['message']);}logger[_0x62b9('0xf')](_0x62b9('0xc'),_0x528c26,_0x11fef8[_0x62b9('0xf')][_0x62b9('0x11')]);return _0x221f69(_0x11fef8[_0x62b9('0xf')][_0x62b9('0x11')]);}else{logger[_0x62b9('0xb')](_0x62b9('0xc'),_0x528c26,_0x62b9('0xd'));_0x221f69(_0x11fef8[_0x62b9('0x12')][_0x62b9('0x11')]);}})['catch'](function(_0x1dff8d){logger[_0x62b9('0xf')](_0x62b9('0xc'),_0x528c26,_0x1dff8d);_0x3be48e(_0x1dff8d);});});}