Built motion from commit (unavailable).|2.6.0
[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 _0x2eb2=['request','then','info','request\x20sent','error','Dynamics365Field,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x401822,_0x49b445){var _0x573996=function(_0x119519){while(--_0x119519){_0x401822['push'](_0x401822['shift']());}};_0x573996(++_0x49b445);}(_0x2eb2,0x19f));var _0x22eb=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2eb2[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});}