Bugfixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
// @ts-ignore
|
||||||
import { handler as ssrHandler } from './dist/server/entry.mjs';
|
import { handler as ssrHandler } from './dist/server/entry.mjs';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -285,6 +285,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rechnung && rechnung.status === "paid") {
|
||||||
|
window.location.href = "/dashboard"
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let uid: string, checkout_url: string | undefined;
|
let uid: string, checkout_url: string | undefined;
|
||||||
|
|
||||||
@@ -309,10 +314,7 @@
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
|
|
||||||
uid = result.uid
|
uid = result.uid
|
||||||
checkout_url = result.checkout_url
|
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"
|
|||||||
|
|
||||||
<button class="order-2 button" type="button" on:click={speichern}>Speichern</button>
|
<button class="order-2 button" type="button" on:click={speichern}>Speichern</button>
|
||||||
|
|
||||||
{#if gegAnfrage}
|
{#if rechnung && rechnung.status === "paid"}
|
||||||
|
<!-- Von einer GEG Anfrage sollte man sowieso nicht noch mal auf die Kundendaten Seite gelangen, also brauchen wir das hier nicht. -->
|
||||||
<button
|
<button
|
||||||
class="order-1 sm:order-2 button cursor-pointer"
|
class="order-1 sm:order-2 button cursor-pointer"
|
||||||
type="button"
|
|
||||||
data-cy="bestellen"
|
data-cy="bestellen"
|
||||||
on:click={anfordern}>Angebot anfordern</button
|
type="button"
|
||||||
|
on:click={bestellen}>Absenden</button
|
||||||
>
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<button
|
{#if gegAnfrage}
|
||||||
class="order-1 sm:order-2 button cursor-pointer"
|
<button
|
||||||
data-cy="bestellen"
|
class="order-1 sm:order-2 button cursor-pointer"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={bestellen}>Kostenpflichtig bestellen</button
|
data-cy="bestellen"
|
||||||
>
|
on:click={anfordern}>Angebot anfordern</button
|
||||||
|
>
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
class="order-1 sm:order-2 button cursor-pointer"
|
||||||
|
data-cy="bestellen"
|
||||||
|
type="button"
|
||||||
|
on:click={bestellen}>Kostenpflichtig bestellen</button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
authorizationHeaders,
|
authorizationHeaders,
|
||||||
authorizationMiddleware,
|
authorizationMiddleware,
|
||||||
} from "#lib/middleware/authorization.js";
|
} 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 { getPrismaAusweisAdapter } from "#lib/server/ausweis.js";
|
||||||
import { PRICES, SERVICES } from "#lib/constants.js";
|
import { PRICES, SERVICES } from "#lib/constants.js";
|
||||||
import { Rechnung } from "#lib/client/prisma.js";
|
import { Rechnung } from "#lib/client/prisma.js";
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { z } from "zod";
|
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 { defineApiRoute } from "astro-typesafe-api/server";
|
||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { TicketsSchema } from "src/generated/zod/tickets.js";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
meta: {
|
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<string, string>).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 {
|
return {
|
||||||
uid: ticket.uid,
|
uid: ticket.uid,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from "zod";
|
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 { mollieClient } from "#lib/mollie.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ if (!rechnung || !ausweis) {
|
|||||||
return Astro.redirect("/")
|
return Astro.redirect("/")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rechnung.status === "paid") {
|
if (rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||||
sendPaymentSuccessMail(ausweis, rechnung, user)
|
|
||||||
} else if (rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
|
||||||
sendInvoiceMail(ausweis, rechnung, user)
|
sendInvoiceMail(ausweis, rechnung, user)
|
||||||
|
} else {
|
||||||
|
sendPaymentSuccessMail(ausweis, rechnung, user)
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user