Built motion from commit e1760111.|2.6.18
[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 _0x883e=['request\x20sent','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Field,\x20%s,\x20%s'];(function(_0x147d18,_0x546152){var _0x1d69c1=function(_0xba9192){while(--_0xba9192){_0x147d18['push'](_0x147d18['shift']());}};_0x1d69c1(++_0x546152);}(_0x883e,0x84));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe883('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe883('0x1'));var rs=require(_0xe883('0x2'));var fs=require('fs');var Redis=require(_0xe883('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe883('0x4'))(_0xe883('0x5'));var config=require(_0xe883('0x6'));var jayson=require(_0xe883('0x7'));var client=jayson[_0xe883('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54affa,_0x36d22b,_0x4fa481){return new BPromise(function(_0x4e2d79,_0x22e1d9){return client[_0xe883('0x9')](_0x54affa,_0x4fa481)[_0xe883('0xa')](function(_0x10d377){logger['info'](_0xe883('0xb'),_0x36d22b,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x36d22b,_0xe883('0xc'),JSON[_0xe883('0xd')](_0x10d377));if(_0x10d377[_0xe883('0xe')]){if(_0x10d377[_0xe883('0xe')][_0xe883('0xf')]===0x1f4){logger[_0xe883('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x36d22b,_0x10d377[_0xe883('0xe')][_0xe883('0x10')]);return _0x22e1d9(_0x10d377[_0xe883('0xe')]['message']);}logger['error'](_0xe883('0xb'),_0x36d22b,_0x10d377[_0xe883('0xe')][_0xe883('0x10')]);return _0x4e2d79(_0x10d377[_0xe883('0xe')][_0xe883('0x10')]);}else{logger['info'](_0xe883('0xb'),_0x36d22b,_0xe883('0xc'));_0x4e2d79(_0x10d377['result']['message']);}})[_0xe883('0x11')](function(_0x665c15){logger[_0xe883('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x36d22b,_0x665c15);_0x22e1d9(_0x665c15);});});}