43704bc14361b543c5ba4d66533c22881e85c4ac
[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 _0x56bb=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1d1eb8,_0x25fa73){var _0x31a959=function(_0x421ebf){while(--_0x421ebf){_0x1d1eb8['push'](_0x1d1eb8['shift']());}};_0x31a959(++_0x25fa73);}(_0x56bb,0x1e6));var _0xb56b=function(_0x564d3e,_0x4dcbf6){_0x564d3e=_0x564d3e-0x0;var _0x1bf076=_0x56bb[_0x564d3e];return _0x1bf076;};'use strict';var _=require(_0xb56b('0x0'));var util=require(_0xb56b('0x1'));var moment=require('moment');var BPromise=require(_0xb56b('0x2'));var rs=require(_0xb56b('0x3'));var fs=require('fs');var Redis=require(_0xb56b('0x4'));var db=require(_0xb56b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb56b('0x6'))(_0xb56b('0x7'));var config=require(_0xb56b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb56b('0x9')][_0xb56b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f05e7,_0x4af4bb,_0x2cdb16){return new BPromise(function(_0x2ece37,_0xad8e03){return client[_0xb56b('0xb')](_0x6f05e7,_0x2cdb16)['then'](function(_0x545666){logger[_0xb56b('0xc')](_0xb56b('0xd'),_0x4af4bb,_0xb56b('0xe'));logger[_0xb56b('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4af4bb,'request\x20sent',JSON[_0xb56b('0x10')](_0x545666));if(_0x545666['error']){if(_0x545666[_0xb56b('0x11')][_0xb56b('0x12')]===0x1f4){logger[_0xb56b('0x11')](_0xb56b('0xd'),_0x4af4bb,_0x545666['error'][_0xb56b('0x13')]);return _0xad8e03(_0x545666['error'][_0xb56b('0x13')]);}logger[_0xb56b('0x11')](_0xb56b('0xd'),_0x4af4bb,_0x545666[_0xb56b('0x11')]['message']);return _0x2ece37(_0x545666['error']['message']);}else{logger[_0xb56b('0xc')](_0xb56b('0xd'),_0x4af4bb,'request\x20sent');_0x2ece37(_0x545666[_0xb56b('0x14')][_0xb56b('0x13')]);}})['catch'](function(_0x212e6f){logger[_0xb56b('0x11')](_0xb56b('0xd'),_0x4af4bb,_0x212e6f);_0xad8e03(_0x212e6f);});});}