f8a8aff79d06fba5993bf5f276103e9886a30e6d
[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 _0x2246=['rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x2246,0x131));var _0x6224=function(_0x708913,_0x5f7b3b){_0x708913=_0x708913-0x0;var _0x2e0632=_0x2246[_0x708913];return _0x2e0632;};'use strict';var _=require(_0x6224('0x0'));var util=require('util');var moment=require(_0x6224('0x1'));var BPromise=require(_0x6224('0x2'));var rs=require(_0x6224('0x3'));var fs=require('fs');var Redis=require(_0x6224('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6224('0x5'));var logger=require(_0x6224('0x6'))(_0x6224('0x7'));var config=require(_0x6224('0x8'));var jayson=require(_0x6224('0x9'));var client=jayson[_0x6224('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48db42,_0x3faf10,_0x4c4867){return new BPromise(function(_0x58953f,_0x5634f2){return client[_0x6224('0xb')](_0x48db42,_0x4c4867)[_0x6224('0xc')](function(_0x148531){logger[_0x6224('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3faf10,'request\x20sent');logger[_0x6224('0xe')](_0x6224('0xf'),_0x3faf10,_0x6224('0x10'),JSON[_0x6224('0x11')](_0x148531));if(_0x148531[_0x6224('0x12')]){if(_0x148531[_0x6224('0x12')][_0x6224('0x13')]===0x1f4){logger[_0x6224('0x12')](_0x6224('0x14'),_0x3faf10,_0x148531['error']['message']);return _0x5634f2(_0x148531[_0x6224('0x12')][_0x6224('0x15')]);}logger[_0x6224('0x12')](_0x6224('0x14'),_0x3faf10,_0x148531[_0x6224('0x12')][_0x6224('0x15')]);return _0x58953f(_0x148531[_0x6224('0x12')][_0x6224('0x15')]);}else{logger[_0x6224('0xd')](_0x6224('0x14'),_0x3faf10,'request\x20sent');_0x58953f(_0x148531[_0x6224('0x16')][_0x6224('0x15')]);}})[_0x6224('0x17')](function(_0x14b3ea){logger[_0x6224('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x3faf10,_0x14b3ea);_0x5634f2(_0x14b3ea);});});}