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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user