28ab6fdb2257db1feb1cf1293eb9e010306e38a0
[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 _0x99e8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','ioredis','../../config/utils'];(function(_0x2c4658,_0x43d26a){var _0xfd3e5b=function(_0x5c8dc5){while(--_0x5c8dc5){_0x2c4658['push'](_0x2c4658['shift']());}};_0xfd3e5b(++_0x43d26a);}(_0x99e8,0xf3));var _0x899e=function(_0x320b0f,_0xed2d47){_0x320b0f=_0x320b0f-0x0;var _0x1915cc=_0x99e8[_0x320b0f];return _0x1915cc;};'use strict';var _=require(_0x899e('0x0'));var util=require(_0x899e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x899e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x899e('0x3'));var logger=require(_0x899e('0x4'))('rpc');var config=require(_0x899e('0x5'));var jayson=require(_0x899e('0x6'));var client=jayson[_0x899e('0x7')][_0x899e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7b9dd4,_0x2aa58c,_0x505a63){return new BPromise(function(_0x3dbef9,_0x3dfba7){return client[_0x899e('0x9')](_0x7b9dd4,_0x505a63)[_0x899e('0xa')](function(_0x299bbc){logger['info'](_0x899e('0xb'),_0x2aa58c,_0x899e('0xc'));logger[_0x899e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2aa58c,_0x899e('0xc'),JSON[_0x899e('0xe')](_0x299bbc));if(_0x299bbc[_0x899e('0xf')]){if(_0x299bbc['error'][_0x899e('0x10')]===0x1f4){logger[_0x899e('0xf')](_0x899e('0xb'),_0x2aa58c,_0x299bbc['error'][_0x899e('0x11')]);return _0x3dfba7(_0x299bbc[_0x899e('0xf')][_0x899e('0x11')]);}logger['error'](_0x899e('0xb'),_0x2aa58c,_0x299bbc[_0x899e('0xf')]['message']);return _0x3dbef9(_0x299bbc[_0x899e('0xf')]['message']);}else{logger['info'](_0x899e('0xb'),_0x2aa58c,_0x899e('0xc'));_0x3dbef9(_0x299bbc[_0x899e('0x12')][_0x899e('0x11')]);}})['catch'](function(_0x26194c){logger['error'](_0x899e('0xb'),_0x2aa58c,_0x26194c);_0x3dfba7(_0x26194c);});});}