Built motion from commit d1eab355.|2.6.28
[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 _0x553b=['code','error','message','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x553b,0x168));var _0xb553=function(_0x4e72ea,_0xf0c8c3){_0x4e72ea=_0x4e72ea-0x0;var _0x473449=_0x553b[_0x4e72ea];return _0x473449;};'use strict';var _=require('lodash');var util=require(_0xb553('0x0'));var moment=require(_0xb553('0x1'));var BPromise=require(_0xb553('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb553('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb553('0x4'));var config=require(_0xb553('0x5'));var jayson=require(_0xb553('0x6'));var client=jayson[_0xb553('0x7')][_0xb553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6cce12,_0x4496e1,_0xb71581){return new BPromise(function(_0xb913f5,_0x2ce49a){return client[_0xb553('0x9')](_0x6cce12,_0xb71581)['then'](function(_0x11acd8){logger[_0xb553('0xa')](_0xb553('0xb'),_0x4496e1,'request\x20sent');logger['debug'](_0xb553('0xc'),_0x4496e1,_0xb553('0xd'),JSON['stringify'](_0x11acd8));if(_0x11acd8['error']){if(_0x11acd8['error'][_0xb553('0xe')]===0x1f4){logger[_0xb553('0xf')](_0xb553('0xb'),_0x4496e1,_0x11acd8[_0xb553('0xf')]['message']);return _0x2ce49a(_0x11acd8[_0xb553('0xf')][_0xb553('0x10')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4496e1,_0x11acd8[_0xb553('0xf')][_0xb553('0x10')]);return _0xb913f5(_0x11acd8[_0xb553('0xf')]['message']);}else{logger[_0xb553('0xa')](_0xb553('0xb'),_0x4496e1,'request\x20sent');_0xb913f5(_0x11acd8['result'][_0xb553('0x10')]);}})['catch'](function(_0x3b13da){logger['error'](_0xb553('0xb'),_0x4496e1,_0x3b13da);_0x2ce49a(_0x3b13da);});});}