diff --git a/server.ts b/server.ts
index f586d20b..98f9fcb8 100644
--- a/server.ts
+++ b/server.ts
@@ -1,4 +1,5 @@
import express from 'express';
+// @ts-ignore
import { handler as ssrHandler } from './dist/server/entry.mjs';
diff --git a/src/modules/KundendatenModule.svelte b/src/modules/KundendatenModule.svelte
index 740b90fc..540fb476 100644
--- a/src/modules/KundendatenModule.svelte
+++ b/src/modules/KundendatenModule.svelte
@@ -285,6 +285,11 @@
}
}
+ if (rechnung && rechnung.status === "paid") {
+ window.location.href = "/dashboard"
+ return;
+ }
+
try {
let uid: string, checkout_url: string | undefined;
@@ -309,10 +314,7 @@
headers: {
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
},
- })
-
- console.log(result);
-
+ })
uid = result.uid
checkout_url = result.checkout_url
@@ -897,20 +899,30 @@ sm:grid-cols-[min-content_min-content_min-content] sm:justify-self-end sm:mt-8"
- {#if gegAnfrage}
+ {#if rechnung && rechnung.status === "paid"}
+
Absenden
{:else}
-
+ {#if gegAnfrage}
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/src/pages/api/rechnung/index.ts b/src/pages/api/rechnung/index.ts
index 00c9e8cc..156a2606 100644
--- a/src/pages/api/rechnung/index.ts
+++ b/src/pages/api/rechnung/index.ts
@@ -7,7 +7,7 @@ import {
authorizationHeaders,
authorizationMiddleware,
} from "#lib/middleware/authorization.js";
-import { getAusweisartFromUUID, UUidWithPrefix } from "#components/Ausweis/types.js";
+import { UUidWithPrefix } from "#components/Ausweis/types.js";
import { getPrismaAusweisAdapter } from "#lib/server/ausweis.js";
import { PRICES, SERVICES } from "#lib/constants.js";
import { Rechnung } from "#lib/client/prisma.js";
diff --git a/src/pages/api/ticket/index.ts b/src/pages/api/ticket/index.ts
index 8f70e5b0..d2b46e8b 100644
--- a/src/pages/api/ticket/index.ts
+++ b/src/pages/api/ticket/index.ts
@@ -1,7 +1,8 @@
import { z } from "zod";
-import { TicketsSchema, prisma } from "#lib/server/prisma.js";
+import { prisma } from "#lib/server/prisma.js";
import { defineApiRoute } from "astro-typesafe-api/server";
import { UUidWithPrefix } from "#components/Ausweis/types.js";
+import { TicketsSchema } from "src/generated/zod/tickets.js";
export const PUT = defineApiRoute({
meta: {
@@ -38,6 +39,37 @@ export const PUT = defineApiRoute({
},
});
+ // Das sind die Label IDs von Trello
+ const labels = {
+ "Technischer Fehler": "67d75d797c0884eeb3873623",
+ "Fehlende Funktionalität": "67d75d60b1c1b1037e7444c4",
+ };
+
+ const category = (input.metadata as Record).category
+
+ const url = new URL("https://api.trello.com/1/cards")
+ url.searchParams.append("name", input.titel)
+ url.searchParams.append("desc", `User: ${input.email}\n\nDescription: ${input.beschreibung}\n\nCategory: ${category}`)
+ url.searchParams.append("pos", "top")
+ url.searchParams.append("idLabels",
+ (category &&
+ labels[category as keyof typeof labels]) ||
+ "650e909fdc09629a4d6d495d")
+ url.searchParams.append("key", "e057eb39018368ea96e456c753ac41b4")
+ url.searchParams.append("idList", "67d75ca7403fd22c49bc7447")
+ url.searchParams.append("token", "ATTA8b65b3587ab627167038cc32a3460650973eb181cde01dabb208ca1e90ed5467AC06A4F2")
+
+ // Wir laden das Ticket zu Trello hoch.
+ const result = await fetch(url, {
+ headers: {
+ Accept: "application/json"
+ },
+ method: "POST"
+ });
+
+ console.log(await result.text());
+
+
return {
uid: ticket.uid,
};
diff --git a/src/pages/api/webhooks/mollie.ts b/src/pages/api/webhooks/mollie.ts
index 0e58d5f3..1c3611bf 100644
--- a/src/pages/api/webhooks/mollie.ts
+++ b/src/pages/api/webhooks/mollie.ts
@@ -5,7 +5,7 @@
*/
import { z } from "zod";
-import { Enums, prisma } from "#lib/server/prisma";
+import { Enums, prisma } from "#lib/server/prisma.js";
import { mollieClient } from "#lib/mollie.js";
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
diff --git a/src/pages/payment/success.astro b/src/pages/payment/success.astro
index a4cb72e4..327f4ac9 100644
--- a/src/pages/payment/success.astro
+++ b/src/pages/payment/success.astro
@@ -41,10 +41,10 @@ if (!rechnung || !ausweis) {
return Astro.redirect("/")
}
-if (rechnung.status === "paid") {
- sendPaymentSuccessMail(ausweis, rechnung, user)
-} else if (rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
+if (rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
sendInvoiceMail(ausweis, rechnung, user)
+} else {
+ sendPaymentSuccessMail(ausweis, rechnung, user)
}
---