6f6bf7fa9f58917db78f3cf79618523ea4355619
[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 _0x14a7=['error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a6ff2,_0x20c681){var _0x24b3d8=function(_0x3908f8){while(--_0x3908f8){_0x3a6ff2['push'](_0x3a6ff2['shift']());}};_0x24b3d8(++_0x20c681);}(_0x14a7,0x1e8));var _0x714a=function(_0x27aa3f,_0x1b1abf){_0x27aa3f=_0x27aa3f-0x0;var _0x4e4b48=_0x14a7[_0x27aa3f];return _0x4e4b48;};'use strict';var _=require('lodash');var util=require(_0x714a('0x0'));var moment=require(_0x714a('0x1'));var BPromise=require(_0x714a('0x2'));var rs=require(_0x714a('0x3'));var fs=require('fs');var Redis=require(_0x714a('0x4'));var db=require(_0x714a('0x5'))['db'];var utils=require(_0x714a('0x6'));var logger=require(_0x714a('0x7'))('rpc');var config=require(_0x714a('0x8'));var jayson=require(_0x714a('0x9'));var client=jayson[_0x714a('0xa')][_0x714a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d6df,_0x1e9095,_0x221872){return new BPromise(function(_0xe26fbb,_0x5391ab){return client[_0x714a('0xc')](_0x29d6df,_0x221872)[_0x714a('0xd')](function(_0x83fc8d){logger['info'](_0x714a('0xe'),_0x1e9095,'request\x20sent');logger['debug'](_0x714a('0xf'),_0x1e9095,_0x714a('0x10'),JSON[_0x714a('0x11')](_0x83fc8d));if(_0x83fc8d[_0x714a('0x12')]){if(_0x83fc8d[_0x714a('0x12')]['code']===0x1f4){logger[_0x714a('0x12')](_0x714a('0xe'),_0x1e9095,_0x83fc8d[_0x714a('0x12')]['message']);return _0x5391ab(_0x83fc8d[_0x714a('0x12')][_0x714a('0x13')]);}logger[_0x714a('0x12')](_0x714a('0xe'),_0x1e9095,_0x83fc8d[_0x714a('0x12')][_0x714a('0x13')]);return _0xe26fbb(_0x83fc8d[_0x714a('0x12')][_0x714a('0x13')]);}else{logger[_0x714a('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1e9095,'request\x20sent');_0xe26fbb(_0x83fc8d[_0x714a('0x15')]['message']);}})[_0x714a('0x16')](function(_0xbb381d){logger['error'](_0x714a('0xe'),_0x1e9095,_0xbb381d);_0x5391ab(_0xbb381d);});});}