b2d5e89a708f2f687cabab76b5fe5d4ac58cdef4
[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 _0x2dc5=['http','request','then','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xce0ab3,_0xdb4a98){var _0x1beee2=function(_0x10702f){while(--_0x10702f){_0xce0ab3['push'](_0xce0ab3['shift']());}};_0x1beee2(++_0xdb4a98);}(_0x2dc5,0x1af));var _0x52dc=function(_0x18861e,_0x12a89a){_0x18861e=_0x18861e-0x0;var _0x1b70bb=_0x2dc5[_0x18861e];return _0x1b70bb;};'use strict';var _=require(_0x52dc('0x0'));var util=require(_0x52dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52dc('0x2'));var fs=require('fs');var Redis=require(_0x52dc('0x3'));var db=require(_0x52dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52dc('0x5'))('rpc');var config=require(_0x52dc('0x6'));var jayson=require(_0x52dc('0x7'));var client=jayson[_0x52dc('0x8')][_0x52dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40603d,_0x4f30b2,_0x73e4bd){return new BPromise(function(_0x70f738,_0xbb765){return client[_0x52dc('0xa')](_0x40603d,_0x73e4bd)[_0x52dc('0xb')](function(_0x3f8315){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4f30b2,_0x52dc('0xc'));logger['debug'](_0x52dc('0xd'),_0x4f30b2,_0x52dc('0xc'),JSON[_0x52dc('0xe')](_0x3f8315));if(_0x3f8315[_0x52dc('0xf')]){if(_0x3f8315[_0x52dc('0xf')][_0x52dc('0x10')]===0x1f4){logger['error'](_0x52dc('0x11'),_0x4f30b2,_0x3f8315[_0x52dc('0xf')][_0x52dc('0x12')]);return _0xbb765(_0x3f8315[_0x52dc('0xf')]['message']);}logger[_0x52dc('0xf')](_0x52dc('0x11'),_0x4f30b2,_0x3f8315['error']['message']);return _0x70f738(_0x3f8315[_0x52dc('0xf')][_0x52dc('0x12')]);}else{logger[_0x52dc('0x13')](_0x52dc('0x11'),_0x4f30b2,'request\x20sent');_0x70f738(_0x3f8315[_0x52dc('0x14')][_0x52dc('0x12')]);}})[_0x52dc('0x15')](function(_0x545e1c){logger[_0x52dc('0xf')](_0x52dc('0x11'),_0x4f30b2,_0x545e1c);_0xbb765(_0x545e1c);});});}