7d12297959e930dc30a26e7f1a803c2195aaefa6
[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 _0xf362=['error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x417de2,_0x2898e0){var _0x4ff3cb=function(_0x37744a){while(--_0x37744a){_0x417de2['push'](_0x417de2['shift']());}};_0x4ff3cb(++_0x2898e0);}(_0xf362,0x1d2));var _0x2f36=function(_0x53bee0,_0x4561b5){_0x53bee0=_0x53bee0-0x0;var _0x1c94bd=_0xf362[_0x53bee0];return _0x1c94bd;};'use strict';var _=require('lodash');var util=require(_0x2f36('0x0'));var moment=require(_0x2f36('0x1'));var BPromise=require(_0x2f36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f36('0x3'));var db=require(_0x2f36('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f36('0x5'))(_0x2f36('0x6'));var config=require(_0x2f36('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb12e,_0x48a0b5,_0x8018a2){return new BPromise(function(_0x3a983a,_0x4cd0fa){return client[_0x2f36('0x9')](_0x5eb12e,_0x8018a2)[_0x2f36('0xa')](function(_0x2cb84b){logger['info'](_0x2f36('0xb'),_0x48a0b5,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x48a0b5,_0x2f36('0xc'),JSON[_0x2f36('0xd')](_0x2cb84b));if(_0x2cb84b['error']){if(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0xf')]===0x1f4){logger[_0x2f36('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x48a0b5,_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);return _0x4cd0fa(_0x2cb84b['error']['message']);}logger[_0x2f36('0xe')](_0x2f36('0xb'),_0x48a0b5,_0x2cb84b['error'][_0x2f36('0x10')]);return _0x3a983a(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);}else{logger[_0x2f36('0x11')](_0x2f36('0xb'),_0x48a0b5,_0x2f36('0xc'));_0x3a983a(_0x2cb84b[_0x2f36('0x12')][_0x2f36('0x10')]);}})[_0x2f36('0x13')](function(_0x18bc7b){logger['error'](_0x2f36('0xb'),_0x48a0b5,_0x18bc7b);_0x4cd0fa(_0x18bc7b);});});}