Ausweistyp
This commit is contained in:
@@ -25,7 +25,6 @@ export const PUT = defineApiRoute({
|
||||
.object({
|
||||
ausweisart: z.nativeEnum(Enums.Ausweisart),
|
||||
ausweis_uid: UUidWithPrefix,
|
||||
ausweistyp: z.nativeEnum(Enums.AusweisTyp)
|
||||
})
|
||||
.merge(
|
||||
RechnungSchema.omit({
|
||||
@@ -50,13 +49,7 @@ export const PUT = defineApiRoute({
|
||||
// Wir erstellen eine Mollie Payment Referenz und eine neue Rechnung in unserer Datenbank, daraufhin geben
|
||||
// wir eine Checkout URL zurück auf die der Nutzer weitergeleitet werden kann.
|
||||
|
||||
const { ausweis_uid, ausweisart, bezahlmethode, services, ausweistyp } = input;
|
||||
let betrag = PRICES[ausweisart][ausweistyp]
|
||||
|
||||
const servicePriceList = SERVICES[ausweisart]
|
||||
for (const service of input.services) {
|
||||
betrag += servicePriceList[service]
|
||||
}
|
||||
const { ausweis_uid, ausweisart, bezahlmethode, services } = input;
|
||||
|
||||
const adapter = getPrismaAusweisAdapter(ausweis_uid);
|
||||
|
||||
@@ -87,6 +80,13 @@ export const PUT = defineApiRoute({
|
||||
});
|
||||
}
|
||||
|
||||
let betrag = PRICES[ausweisart][ausweis.ausweistyp]
|
||||
|
||||
const servicePriceList = SERVICES[ausweisart]
|
||||
for (const service of input.services) {
|
||||
betrag += servicePriceList[service]
|
||||
}
|
||||
|
||||
// Wir erstellen eine neue Rechnung in unserer Datenbank.
|
||||
let rechnung: Rechnung | null = null;
|
||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||
@@ -102,7 +102,6 @@ export const PUT = defineApiRoute({
|
||||
}
|
||||
},
|
||||
services,
|
||||
ausweistyp
|
||||
}
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||
@@ -118,7 +117,6 @@ export const PUT = defineApiRoute({
|
||||
}
|
||||
},
|
||||
services,
|
||||
ausweistyp
|
||||
}
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||
@@ -134,7 +132,6 @@ export const PUT = defineApiRoute({
|
||||
}
|
||||
},
|
||||
services,
|
||||
ausweistyp
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Enums } from "#lib/server/prisma";
|
||||
|
||||
const uid = Astro.url.searchParams.get("uid");
|
||||
const uid_aufnahme = Astro.url.searchParams.get("aufnahme")
|
||||
const ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
||||
let ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
||||
|
||||
let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient;
|
||||
let aufnahme: AufnahmeClient = {} as AufnahmeClient;
|
||||
@@ -37,6 +37,8 @@ if (uid) {
|
||||
}
|
||||
});
|
||||
|
||||
ausweistyp = ausweis.ausweistyp
|
||||
|
||||
aufnahme = await caller.aufnahme._uid.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
|
||||
@@ -16,16 +16,15 @@ if (!params.has("ausweis") || !params.has("aufnahme") || !params.has("objekt") |
|
||||
return Astro.redirect("/404")
|
||||
}
|
||||
|
||||
let ausweis, aufnahme, objekt, ausweisart, bilder, ausweistyp;
|
||||
let ausweis, aufnahme, objekt, ausweisart, bilder;
|
||||
try {
|
||||
ausweis = JSON.parse(params.get("ausweis") || "")
|
||||
aufnahme = JSON.parse(params.get("aufnahme") || "")
|
||||
objekt = JSON.parse(params.get("objekt") || "")
|
||||
ausweisart = JSON.parse(params.get("ausweisart") || "") as Enums.Ausweisart;
|
||||
bilder = JSON.parse(params.get("bilder") || "");
|
||||
ausweistyp = JSON.parse(params.get("ausweistyp") || "") as Enums.AusweisTyp;
|
||||
|
||||
if (!ausweisart || !Object.keys(Enums.Ausweisart).includes(ausweisart) || !ausweistyp || !Object.keys(Enums.AusweisTyp).includes(ausweistyp)) {
|
||||
if (!ausweisart || !Object.keys(Enums.Ausweisart).includes(ausweisart)) {
|
||||
throw new Error()
|
||||
}
|
||||
} catch(e){
|
||||
@@ -35,6 +34,6 @@ try {
|
||||
---
|
||||
|
||||
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {bilder} {ausweisart} {ausweistyp} unterlagen={[]} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only="svelte" ></KundendatenModule>
|
||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {bilder} {ausweisart} unterlagen={[]} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only="svelte" ></KundendatenModule>
|
||||
</AusweisLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user