Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / intDynamics365Field / intDynamics365Field.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 _0x13a4=['then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','../../config/utils','rpc','client','http','request'];(function(_0x5ee211,_0x3f31a3){var _0x46fc90=function(_0x44f6d8){while(--_0x44f6d8){_0x5ee211['push'](_0x5ee211['shift']());}};_0x46fc90(++_0x3f31a3);}(_0x13a4,0x102));var _0x413a=function(_0x1f8ec6,_0x23b37e){_0x1f8ec6=_0x1f8ec6-0x0;var _0x1c70b8=_0x13a4[_0x1f8ec6];return _0x1c70b8;};'use strict';var _=require(_0x413a('0x0'));var util=require(_0x413a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x413a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x413a('0x3'));var logger=require('../../config/logger')(_0x413a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x413a('0x5')][_0x413a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34668b,_0x20fe1d,_0xb33398){return new BPromise(function(_0x30b942,_0x3c359f){return client[_0x413a('0x7')](_0x34668b,_0xb33398)[_0x413a('0x8')](function(_0x75f25c){logger['info'](_0x413a('0x9'),_0x20fe1d,'request\x20sent');logger[_0x413a('0xa')](_0x413a('0xb'),_0x20fe1d,_0x413a('0xc'),JSON[_0x413a('0xd')](_0x75f25c));if(_0x75f25c[_0x413a('0xe')]){if(_0x75f25c[_0x413a('0xe')]['code']===0x1f4){logger[_0x413a('0xe')](_0x413a('0x9'),_0x20fe1d,_0x75f25c['error'][_0x413a('0xf')]);return _0x3c359f(_0x75f25c[_0x413a('0xe')][_0x413a('0xf')]);}logger[_0x413a('0xe')](_0x413a('0x9'),_0x20fe1d,_0x75f25c[_0x413a('0xe')][_0x413a('0xf')]);return _0x30b942(_0x75f25c[_0x413a('0xe')][_0x413a('0xf')]);}else{logger[_0x413a('0x10')](_0x413a('0x9'),_0x20fe1d,_0x413a('0xc'));_0x30b942(_0x75f25c[_0x413a('0x11')]['message']);}})[_0x413a('0x12')](function(_0x113713){logger[_0x413a('0xe')](_0x413a('0x9'),_0x20fe1d,_0x113713);_0x3c359f(_0x113713);});});}