Kaufabschluss funktioniert.

Kaufabschluss funktioniert einzeln, gesamter Durchgang geht auch. Input Validation ist der nächste große Schritt. Im Formular kommen immer noch viele Werte raus die wir nicht in der Datenbank haban wollen...
This commit is contained in:
Moritz Utcke
2024-01-11 13:41:40 +07:00
parent b20b857a7d
commit d9ac5cf69c
23 changed files with 489 additions and 90 deletions

View File

@@ -6,6 +6,7 @@
import PriceContainer from "#components/Kaufabschluss/PriceContainer.svelte";
import { Benutzer, Bezahlmethoden, Enums, Rechnungen, VerbrauchsausweisWohnen } from "@ibcornelsen/database";
import PaymentOption from "#components/PaymentOption.svelte";
import { client } from "src/trpc";
export let user: Benutzer;
export let ausweis: VerbrauchsausweisWohnen
@@ -15,6 +16,17 @@
let agbAkzeptiert: boolean;
let datenschutzAkzeptiert: boolean;
async function createPayment() {
const response = await client.v1.payments.create.mutate({
ausweisart: "VerbrauchsausweisWohnen",
uid: ausweis.uid,
payment_method: selectedPaymentType,
services: []
})
window.location.href = response.checkout_url
}
</script>
<div class="w-full px-8">
@@ -303,6 +315,7 @@
</div>
</div>
<button class="pay-button" disabled={!agbAkzeptiert || !datenschutzAkzeptiert}
on:click={createPayment}
>Kostenpflichtig Bestellen</button
>
</div>