Built motion from commit b5996064.|2.6.21
[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 _0x43d8=['http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f520b,_0x3cc71d){var _0x5289c2=function(_0x477640){while(--_0x477640){_0x3f520b['push'](_0x3f520b['shift']());}};_0x5289c2(++_0x3cc71d);}(_0x43d8,0xf4));var _0x843d=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x43d8[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var moment=require(_0x843d('0x2'));var BPromise=require(_0x843d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x843d('0x4'));var config=require(_0x843d('0x5'));var jayson=require(_0x843d('0x6'));var client=jayson[_0x843d('0x7')][_0x843d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4384c5,_0x59a1c2,_0x464052){return new BPromise(function(_0x5b6807,_0x2dfcb1){return client['request'](_0x4384c5,_0x464052)['then'](function(_0x511436){logger[_0x843d('0x9')](_0x843d('0xa'),_0x59a1c2,_0x843d('0xb'));logger['debug'](_0x843d('0xc'),_0x59a1c2,_0x843d('0xb'),JSON[_0x843d('0xd')](_0x511436));if(_0x511436['error']){if(_0x511436[_0x843d('0xe')][_0x843d('0xf')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x59a1c2,_0x511436['error'][_0x843d('0x10')]);return _0x2dfcb1(_0x511436[_0x843d('0xe')]['message']);}logger[_0x843d('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x59a1c2,_0x511436[_0x843d('0xe')][_0x843d('0x10')]);return _0x5b6807(_0x511436[_0x843d('0xe')][_0x843d('0x10')]);}else{logger[_0x843d('0x9')](_0x843d('0xa'),_0x59a1c2,_0x843d('0xb'));_0x5b6807(_0x511436['result'][_0x843d('0x10')]);}})[_0x843d('0x11')](function(_0x47537a){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x59a1c2,_0x47537a);_0x2dfcb1(_0x47537a);});});}