Built motion from commit 9d0783e6.|2.6.13
[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 _0x2aec=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x2aec,0x141));var _0xc2ae=function(_0x23f785,_0xb2072){_0x23f785=_0x23f785-0x0;var _0x4fa572=_0x2aec[_0x23f785];return _0x4fa572;};'use strict';var _=require('lodash');var util=require(_0xc2ae('0x0'));var moment=require(_0xc2ae('0x1'));var BPromise=require(_0xc2ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2ae('0x4'));var logger=require('../../config/logger')(_0xc2ae('0x5'));var config=require(_0xc2ae('0x6'));var jayson=require(_0xc2ae('0x7'));var client=jayson[_0xc2ae('0x8')][_0xc2ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1630d5,_0xce7c66,_0x3fa9be){return new BPromise(function(_0x109c51,_0x32c1dd){return client['request'](_0x1630d5,_0x3fa9be)[_0xc2ae('0xa')](function(_0x2a4a33){logger[_0xc2ae('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0xce7c66,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xce7c66,_0xc2ae('0xc'),JSON['stringify'](_0x2a4a33));if(_0x2a4a33[_0xc2ae('0xd')]){if(_0x2a4a33[_0xc2ae('0xd')][_0xc2ae('0xe')]===0x1f4){logger[_0xc2ae('0xd')](_0xc2ae('0xf'),_0xce7c66,_0x2a4a33[_0xc2ae('0xd')][_0xc2ae('0x10')]);return _0x32c1dd(_0x2a4a33['error'][_0xc2ae('0x10')]);}logger[_0xc2ae('0xd')](_0xc2ae('0xf'),_0xce7c66,_0x2a4a33[_0xc2ae('0xd')]['message']);return _0x109c51(_0x2a4a33[_0xc2ae('0xd')]['message']);}else{logger['info'](_0xc2ae('0xf'),_0xce7c66,_0xc2ae('0xc'));_0x109c51(_0x2a4a33['result'][_0xc2ae('0x10')]);}})[_0xc2ae('0x11')](function(_0x53855){logger['error'](_0xc2ae('0xf'),_0xce7c66,_0x53855);_0x32c1dd(_0x53855);});});}