2d8595e02daef7d23cd071a6b88fea6ae125b90c
[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 _0xfa10=['moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x44d43d,_0x1e966){var _0x271474=function(_0x31321e){while(--_0x31321e){_0x44d43d['push'](_0x44d43d['shift']());}};_0x271474(++_0x1e966);}(_0xfa10,0x1c7));var _0x0fa1=function(_0x4f24b4,_0xa286a2){_0x4f24b4=_0x4f24b4-0x0;var _0x29c26f=_0xfa10[_0x4f24b4];return _0x29c26f;};'use strict';var _=require('lodash');var util=require(_0x0fa1('0x0'));var moment=require(_0x0fa1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fa1('0x2'));var db=require(_0x0fa1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fa1('0x4'));var config=require(_0x0fa1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0fa1('0x6')][_0x0fa1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x118c6d,_0x226a00,_0x59039a){return new BPromise(function(_0x225f5b,_0x13ab07){return client[_0x0fa1('0x8')](_0x118c6d,_0x59039a)[_0x0fa1('0x9')](function(_0x16825a){logger[_0x0fa1('0xa')](_0x0fa1('0xb'),_0x226a00,_0x0fa1('0xc'));logger[_0x0fa1('0xd')](_0x0fa1('0xe'),_0x226a00,_0x0fa1('0xc'),JSON[_0x0fa1('0xf')](_0x16825a));if(_0x16825a[_0x0fa1('0x10')]){if(_0x16825a['error']['code']===0x1f4){logger['error'](_0x0fa1('0xb'),_0x226a00,_0x16825a['error'][_0x0fa1('0x11')]);return _0x13ab07(_0x16825a['error'][_0x0fa1('0x11')]);}logger[_0x0fa1('0x10')](_0x0fa1('0xb'),_0x226a00,_0x16825a[_0x0fa1('0x10')][_0x0fa1('0x11')]);return _0x225f5b(_0x16825a[_0x0fa1('0x10')]['message']);}else{logger[_0x0fa1('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x226a00,'request\x20sent');_0x225f5b(_0x16825a['result'][_0x0fa1('0x11')]);}})[_0x0fa1('0x12')](function(_0x54790c){logger[_0x0fa1('0x10')](_0x0fa1('0xb'),_0x226a00,_0x54790c);_0x13ab07(_0x54790c);});});}