Commit 3cb7ca54 authored by Micha Lutz's avatar Micha Lutz

ready to deploy

parent 4ac6a056
......@@ -15,5 +15,17 @@
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
......@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
<title>React App</title>
<title>Subscriber App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
......
This diff is collapsed.
import axios from "axios";
import config from "./config";
//import { getApplicationsResponseSample, getApplicationDataSample } from "./samples";
// function to initially request an access token from SubscriberAPI and save it in state variable
export const getAccessToken = async () => {
try {
const response = await axios.get(
"https://oauth.fiep-poc.de/invoke/pub.apigateway.oauth2/getAccessToken?grant_type=client_credentials&client_id=" +
config.clientId +
"&client_secret=" +
config.clientSecret +
"&scope=" +
config.scope
);
return response.data.access_token;
} catch (error) {
console.log(error);
return "error";
}
};
// function to initially request destinations from SubscriberAPI and save the first one in state variable
export const getDestinations = async (accessToken) => {
try {
const response = await axios.get("https://subscriber.fiep-poc.de/beta5/" + config.subscriberId + "/destinations", {
headers: { Authorization: "Bearer " + accessToken },
});
if (response.data.length > 0) {
return {
organizationName: response.data[0].publicOrganization.organizationName,
destinationId: response.data[0].destinationId,
};
} else {
return null;
}
} catch (error) {
console.log(error);
return "error";
}
};
// function to initially create a new destination at SubscriberAPI and save it in state variable
export const createNewDestination = async (accessToken) => {
try {
const requestBody = {
publicOrganization: {
organizationName: "Beispielbehörde",
},
};
const response = await axios.post(
"https://subscriber.fiep-poc.de/beta5/" + config.subscriberId + "/destinations",
requestBody,
{
headers: { Authorization: "Bearer " + accessToken },
}
);
return [requestBody.publicOrganization.organizationName, response.data.destinationId];
} catch (error) {
console.log(error);
return "error";
}
};
// handle function to request all applications from SubscriberAPI and save them in state variable
export const getApplications = async (destinationId, accessToken) => {
try {
//return getApplicationsResponseSample;
const response = await axios.get(
"https://subscriber.fiep-poc.de/beta5/" +
config.subscriberId +
"/destinations/" +
destinationId +
"/applications",
{
headers: { Authorization: "Bearer " + accessToken },
}
);
return response.data;
} catch (error) {
console.log(error);
return "error";
}
};
// handle function to request data of an application and display it in a modal
export const getApplicationData = async (applicationId, destinationId, accessToken) => {
try {
//return getApplicationDataSample;
const response = await axios.get(
"https://subscriber.fiep-poc.de/beta5/" +
config.subscriberId +
"/destinations/" +
destinationId +
"/applications/" +
applicationId +
"/data",
{
headers: { Authorization: "Bearer " + accessToken },
}
);
return response.data;
} catch (error) {
console.log(error);
return "error";
}
};
// handle function to acknowledge an application
export const acknowledgeApplication = async (applicationId, destinationId, accessToken) => {
try {
const requestBody = {
finalDelivery: true,
};
await axios.post(
"https://subscriber.fiep-poc.de/beta5/" +
config.subscriberId +
"/destinations/" +
destinationId +
"/applications/" +
applicationId,
requestBody,
{
headers: { Authorization: "Bearer " + accessToken },
}
);
return "ok";
} catch (error) {
console.log(error);
return "error";
}
};
export const getApplicationsResponseSample = [
{
additionalReferenceInfo: {
subject: "Anmeldung eines Gewerbes in Musterstadt",
caseId: "DF/8923",
},
contentStructure: {
data: {
schema: {
mimeType: "json",
schemaSource: "none",
},
},
docs: [
{
docId: "1",
purpose: "form",
size: 13046,
mimeType: "application/pdf",
filename: "test.pdf",
description: "Das Antragsformular",
lang: {
lang: "de",
region: "DE",
},
hash: {
algorithm: "SHA-256",
digest: "bf37d894fdf9aeade63975ed648d49c3e8a7a773923597d2418915f54cd7c3b9",
},
},
],
},
publicServiceType: {
name: "Gewerbeanmeldung",
description: "Eine Gewerbeanmeldung ist immer dann notwendig, wenn Sie einen stehenden Gewerbebetrieb beginnen.",
leikaId: "99050012104000",
otherIdentifiers: [
{
id: "8664844",
schemeId: "service.niedersachsen.de",
schemeName: "Serviceportal Niedersachsen",
},
{
id: "354824",
schemeId: "buerger.thueringen.de",
schemeName: "Zuständigkeitsfinder Thüringen",
},
],
},
applicants: [
{
type: "person",
authentificationInfo: {
assuranceLevel: "high",
authentificationMethod: "eID",
timestamp: "2020-03-03T12:38:23Z",
},
identityInfo: {
dateOfBirth: "1970-09-13",
gender: "m",
givenName: "WERNER",
familyName: "MUSTERMANN",
placeOfResidence: {
type: "national",
street: "KURZER WEG 7",
postalCode: "12345",
city: "ANKH-MORPORK",
},
},
contactInfo: {
electronicAddresses: [
{
channelType: "Service-Account-Mailbox",
address: "3b0c9c8c-0801-45f0-a331-2abfc9db78d0",
},
],
physicalAddress: {
type: "national",
street: "Kurzer Weg",
houseNumber: "7",
postalCode: "12345",
city: "Ankh-Morpork",
},
telephone: [
{
number: "+49 89 32168-42",
mobile: true,
description: "work",
},
],
},
},
],
paymentInfo: {
reference: "TP/93/GDP",
usage: "Gewerbeanmeldung",
amount: 17.3,
timestamp: "2020-03-03T12:38:23Z",
status: "success",
transaction: "1f77c5f9b759db9cdce59988b24974d465c7be5e462a6185485559ff6e2dea82",
},
applicationId: "0c508e3f-2353-4206-9a1e-34b2e864d5a8",
},
];
export const getApplicationDataSample = {
F99000001: "string",
G99000001: {
F99000002: "string",
F99000003: 42,
},
G99000002: [
{
F99000004: true,
G99000001: {
F99000002: "string",
F99000003: 17,
},
},
{
F99000004: true,
G99000001: {
F99000002: "string",
F99000003: 24,
},
},
],
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment