Compare commits
5 Commits
54e92d4965
...
9f25f29b7f
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f25f29b7f | |||
| f4756998d9 | |||
| ad75738c07 | |||
| 9bec8ab336 | |||
| aef3a7822a |
@@ -64,6 +64,7 @@ STORE_CORS=https://place4bees.com
|
|||||||
ADMIN_CORS=https://place4bees.com
|
ADMIN_CORS=https://place4bees.com
|
||||||
AUTH_CORS=https://place4bees.com
|
AUTH_CORS=https://place4bees.com
|
||||||
GA_ID=<Messkennung, erst nach Einwilligungsbanner-Prüfung>
|
GA_ID=<Messkennung, erst nach Einwilligungsbanner-Prüfung>
|
||||||
|
MAIL_TEST_EMPFAENGER=<LEER — sonst bekommen Kunden keine einzige Mail>
|
||||||
```
|
```
|
||||||
|
|
||||||
**DHL umstellen** — beide Schalter, in dieser Reihenfolge:
|
**DHL umstellen** — beide Schalter, in dieser Reihenfolge:
|
||||||
|
|||||||
@@ -61,12 +61,10 @@ PayPal und PayPal-Card.
|
|||||||
|
|
||||||
## 2. Rechtlich offen
|
## 2. Rechtlich offen
|
||||||
|
|
||||||
- [ ] **§ 312k Abs. 2 BGB — Bestätigung in Textform.** Pflicht, aktuell nicht
|
- [x] ~~**§ 312k BGB — Bestätigung in Textform.**~~ Seit 26.10.2026: Beide
|
||||||
erfüllt. In `medusa-config.ts` ist **kein** Notification-Modul registriert,
|
Kündigungswege (`/kuendigung` und Kundenkonto) schicken eine
|
||||||
es geht also keine Kündigungsbestätigung raus. Die Druckansicht auf
|
Kündigungsbestätigung per Mail. Geht erst wirklich raus, wenn SMTP im
|
||||||
`/kuendigung` ist ein Behelf, kein Ersatz.
|
Stack gesetzt ist — bis dahin steht sie nur im Log.
|
||||||
Lösung: `@medusajs/notification` + SendGrid-Provider einhängen → braucht
|
|
||||||
einen SendGrid-API-Key. Betrifft auch Bestell- und Versandbestätigungen.
|
|
||||||
- [ ] Kontaktformulare haben **kein `action`**. Sie sehen richtig aus, senden
|
- [ ] Kontaktformulare haben **kein `action`**. Sie sehen richtig aus, senden
|
||||||
aber nirgendwohin: `/kontakt`, `/business/kontakt`, `/business/anfrage`.
|
aber nirgendwohin: `/kontakt`, `/business/kontakt`, `/business/anfrage`.
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ module.exports = defineConfig({
|
|||||||
user: process.env.SMTP_USER,
|
user: process.env.SMTP_USER,
|
||||||
pass: process.env.SMTP_PASSWORD,
|
pass: process.env.SMTP_PASSWORD,
|
||||||
from: process.env.MAIL_FROM,
|
from: process.env.MAIL_FROM,
|
||||||
|
testRecipient: process.env.MAIL_TEST_EMPFAENGER || undefined,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|||||||
import {
|
import {
|
||||||
completeCartWorkflow,
|
completeCartWorkflow,
|
||||||
createPaymentCollectionForCartWorkflow,
|
createPaymentCollectionForCartWorkflow,
|
||||||
|
createPaymentSessionsWorkflow,
|
||||||
capturePaymentWorkflow,
|
capturePaymentWorkflow,
|
||||||
} from "@medusajs/core-flows";
|
} from "@medusajs/core-flows";
|
||||||
import { getPayment, findValidMandate } from "../../../lib/mollie";
|
import { getPayment, findValidMandate } from "../../../lib/mollie";
|
||||||
@@ -61,7 +62,12 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
|
|
||||||
const { data: carts } = await query.graph({
|
const { data: carts } = await query.graph({
|
||||||
entity: "cart",
|
entity: "cart",
|
||||||
fields: [...SUBSCRIPTION_CART_FIELDS, "completed_at"],
|
fields: [
|
||||||
|
...SUBSCRIPTION_CART_FIELDS,
|
||||||
|
"completed_at",
|
||||||
|
"payment_collection.id",
|
||||||
|
"payment_collection.payment_sessions.id",
|
||||||
|
],
|
||||||
filters: { id: cartId },
|
filters: { id: cartId },
|
||||||
});
|
});
|
||||||
const cart: any = carts?.[0];
|
const cart: any = carts?.[0];
|
||||||
@@ -83,9 +89,22 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
return res.status(200).send("ok");
|
return res.status(200).send("ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
await createPaymentCollectionForCartWorkflow(req.scope).run({
|
// Ein früherer Aufruf kann Sammlung und Sitzung schon angelegt haben und
|
||||||
input: { cart_id: cartId },
|
// erst danach gescheitert sein — dann weiterverwenden statt neu anlegen.
|
||||||
});
|
let collectionId = cart.payment_collection?.id;
|
||||||
|
if (!collectionId) {
|
||||||
|
const { result: sammlung } = await createPaymentCollectionForCartWorkflow(req.scope).run({
|
||||||
|
input: { cart_id: cartId },
|
||||||
|
});
|
||||||
|
collectionId = (sammlung as any).id;
|
||||||
|
}
|
||||||
|
// Ohne Zahlungssitzung lässt sich der Warenkorb nicht abschließen. Wie im
|
||||||
|
// Abo-Job über den manuellen Anbieter: Das Geld hat Mollie schon.
|
||||||
|
if (!cart.payment_collection?.payment_sessions?.length) {
|
||||||
|
await createPaymentSessionsWorkflow(req.scope).run({
|
||||||
|
input: { payment_collection_id: collectionId, provider_id: "pp_system_default" },
|
||||||
|
});
|
||||||
|
}
|
||||||
const { result: completed } = await completeCartWorkflow(req.scope).run({
|
const { result: completed } = await completeCartWorkflow(req.scope).run({
|
||||||
input: { id: cartId },
|
input: { id: cartId },
|
||||||
});
|
});
|
||||||
@@ -132,8 +151,10 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
res.status(200).send("ok");
|
res.status(200).send("ok");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
|
// Workflows werfen teils schlichte Objekte statt Error — String() ergäbe
|
||||||
|
// dann nur "[object Object]".
|
||||||
`[mollie] Webhook ${paymentId} fehlgeschlagen: ${
|
`[mollie] Webhook ${paymentId} fehlgeschlagen: ${
|
||||||
error instanceof Error ? error.message : String(error)
|
error instanceof Error ? error.message : (error as any)?.message ?? JSON.stringify(error)
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
// Bewusst 200: sonst wiederholt Mollie endlos, obwohl der Fehler bei uns
|
// Bewusst 200: sonst wiederholt Mollie endlos, obwohl der Fehler bei uns
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
||||||
import { SUBSCRIPTION_MODULE } from "../../../../../../modules/subscription";
|
import { SUBSCRIPTION_MODULE } from "../../../../../../modules/subscription";
|
||||||
import { HONEY_SIZES } from "../../../../../../lib/honey-picker";
|
import { HONEY_SIZES } from "../../../../../../lib/honey-picker";
|
||||||
|
import { sendeKuendigungsbestaetigung } from "../../../../../../lib/kuendigung-mail";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ändert ein Abo: Menge, Größe, Sortenwahl, Zustand.
|
* Ändert ein Abo: Menge, Größe, Sortenwahl, Zustand.
|
||||||
@@ -108,6 +109,15 @@ export async function POST(req: AuthenticatedMedusaRequest, res: MedusaResponse)
|
|||||||
const updated = await service.updateSubscriptions(update);
|
const updated = await service.updateSubscriptions(update);
|
||||||
const result = Array.isArray(updated) ? updated[0] : updated;
|
const result = Array.isArray(updated) ? updated[0] : updated;
|
||||||
|
|
||||||
|
// § 312k Abs. 4: auch die Kündigung im Kundenkonto wird in Textform bestätigt.
|
||||||
|
if (body.action === "cancel") {
|
||||||
|
await sendeKuendigungsbestaetigung(req.scope, result, {
|
||||||
|
art: "Ordentliche Kündigung im Kundenkonto",
|
||||||
|
eingegangen: update.canceled_at as Date,
|
||||||
|
grund: (update.cancel_reason as string | undefined) ?? null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
subscription: {
|
subscription: {
|
||||||
id: result.id,
|
id: result.id,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
||||||
import { SUBSCRIPTION_MODULE } from "../../../../modules/subscription";
|
import { SUBSCRIPTION_MODULE } from "../../../../modules/subscription";
|
||||||
|
import { sendeKuendigungsbestaetigung } from "../../../../lib/kuendigung-mail";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kündigung ohne Anmeldung — § 312k BGB.
|
* Kündigung ohne Anmeldung — § 312k BGB.
|
||||||
@@ -73,9 +74,14 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
|
|
||||||
logger.info(`[kuendigung] Abo ${subscription.id} gekündigt (${canceledAt.toISOString()}).`);
|
logger.info(`[kuendigung] Abo ${subscription.id} gekündigt (${canceledAt.toISOString()}).`);
|
||||||
|
|
||||||
// § 312k Abs. 2 verlangt zusätzlich eine sofortige Bestätigung in Textform.
|
// § 312k Abs. 4 verlangt zusätzlich eine sofortige Bestätigung in Textform.
|
||||||
// Solange kein Versandweg eingerichtet ist, bleibt das der offene Punkt —
|
await sendeKuendigungsbestaetigung(req.scope, subscription, {
|
||||||
// siehe Hinweis in der Antwort.
|
art: `${kind}e Kündigung`,
|
||||||
|
eingegangen: canceledAt,
|
||||||
|
name: body.name ? String(body.name).slice(0, 120) : null,
|
||||||
|
grund: body.reason ? String(body.reason).slice(0, 500) : null,
|
||||||
|
});
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
subscription_id: subscription.id,
|
subscription_id: subscription.id,
|
||||||
canceled_at: canceledAt.toISOString(),
|
canceled_at: canceledAt.toISOString(),
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
|
|
||||||
const { data: carts } = await query.graph({
|
const { data: carts } = await query.graph({
|
||||||
entity: "cart",
|
entity: "cart",
|
||||||
fields: [...SUBSCRIPTION_CART_FIELDS, "total"],
|
// Ohne Preise der Posten und Versandarten rechnet Medusa total = 0, und
|
||||||
|
// Mollie zieht 0,00 € statt der ersten Lieferung.
|
||||||
|
fields: [...SUBSCRIPTION_CART_FIELDS, "total", "items.*", "shipping_methods.*"],
|
||||||
filters: { id: body.cart_id },
|
filters: { id: body.cart_id },
|
||||||
});
|
});
|
||||||
const cart: any = carts?.[0];
|
const cart: any = carts?.[0];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { MedusaContainer } from "@medusajs/framework/types";
|
import type { MedusaContainer } from "@medusajs/framework/types";
|
||||||
|
import { Modules } from "@medusajs/framework/utils";
|
||||||
import {
|
import {
|
||||||
createCartWorkflow,
|
createCartWorkflow,
|
||||||
addShippingMethodToCartWorkflow,
|
addShippingMethodToCartWorkflow,
|
||||||
@@ -55,6 +56,17 @@ function adresseFuerWarenkorb(adresse: any): Record<string, any> | undefined {
|
|||||||
return Object.keys(sauber).length ? sauber : undefined;
|
return Object.keys(sauber).length ? sauber : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Glaspreis aus dem Bestellposten, mit dem das Abo abgeschlossen wurde. */
|
||||||
|
async function vereinbarterGlaspreis(
|
||||||
|
container: MedusaContainer,
|
||||||
|
lineItemId: string | null | undefined
|
||||||
|
): Promise<number | null> {
|
||||||
|
if (!lineItemId) return null;
|
||||||
|
const orders: any = container.resolve(Modules.ORDER);
|
||||||
|
const [item] = await orders.listOrderLineItems({ id: lineItemId }, { select: ["unit_price"] });
|
||||||
|
return item ? Number(item.unit_price) : null;
|
||||||
|
}
|
||||||
|
|
||||||
function fehlertext(fehler: unknown): string {
|
function fehlertext(fehler: unknown): string {
|
||||||
if (fehler instanceof Error) return fehler.message;
|
if (fehler instanceof Error) return fehler.message;
|
||||||
if (Array.isArray(fehler)) return fehler.map(fehlertext).join(" | ");
|
if (Array.isArray(fehler)) return fehler.map(fehlertext).join(" | ");
|
||||||
@@ -122,7 +134,7 @@ export default async function processSubscriptions(container: MedusaContainer) {
|
|||||||
// Sorten werden zu einem Posten zusammengefasst. Geprüft wird jede
|
// Sorten werden zu einem Posten zusammengefasst. Geprüft wird jede
|
||||||
// Sorte einmal, nicht je Glas — sonst liefe dieselbe Abfrage mehrfach.
|
// Sorte einmal, nicht je Glas — sonst liefe dieselbe Abfrage mehrfach.
|
||||||
const perGlass = varietyPerGlass(sub);
|
const perGlass = varietyPerGlass(sub);
|
||||||
let items: { variant_id: string; quantity: number }[];
|
let items: { variant_id: string; quantity: number; unit_price?: number }[];
|
||||||
let lastVariantId: string;
|
let lastVariantId: string;
|
||||||
let delivered: string;
|
let delivered: string;
|
||||||
|
|
||||||
@@ -148,6 +160,20 @@ export default async function processSubscriptions(container: MedusaContainer) {
|
|||||||
lastVariantId = picked.variantId;
|
lastVariantId = picked.variantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abgerechnet wird der Glaspreis aus dem Abschluss, nicht der Ladenpreis
|
||||||
|
// der gezogenen Sorte — sonst schwankt der Betrag je nach Sorte und
|
||||||
|
// weicht vom Preis ab, dem der Kunde zugestimmt hat.
|
||||||
|
if (!sub.prepaid) {
|
||||||
|
const agreed = await vereinbarterGlaspreis(container, sub.source_line_item_id);
|
||||||
|
if (agreed === null) {
|
||||||
|
logger.warn(
|
||||||
|
`[abo] ${sub.id}: kein vereinbarter Glaspreis hinterlegt — es gilt der Preis der Sorte.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
items = items.map((item) => ({ ...item, unit_price: agreed }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const { result: cart } = await createCartWorkflow(container).run({
|
const { result: cart } = await createCartWorkflow(container).run({
|
||||||
input: {
|
input: {
|
||||||
region_id: sub.region_id,
|
region_id: sub.region_id,
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import { Modules } from "@medusajs/framework/utils";
|
||||||
|
import { kuendigungsbestaetigung } from "./order-emails";
|
||||||
|
|
||||||
|
const RHYTHMUS: Record<string, string> = {
|
||||||
|
monthly: "monatlich",
|
||||||
|
quarterly: "vierteljährlich",
|
||||||
|
biannual: "halbjährlich",
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schickt die Kündigungsbestätigung (§ 312k Abs. 4 BGB) an die Adresse des
|
||||||
|
* Abos. Wirft nie: die Kündigung gilt auch, wenn die Mail scheitert — der
|
||||||
|
* Fehler steht dann im Log und muss von Hand nachgeholt werden.
|
||||||
|
*/
|
||||||
|
export async function sendeKuendigungsbestaetigung(
|
||||||
|
container: any,
|
||||||
|
abo: any,
|
||||||
|
angaben: { art: string; eingegangen: Date; name?: string | null; grund?: string | null }
|
||||||
|
) {
|
||||||
|
const logger = container.resolve("logger");
|
||||||
|
try {
|
||||||
|
const inhalt = kuendigungsbestaetigung({
|
||||||
|
aboId: abo.id,
|
||||||
|
art: angaben.art,
|
||||||
|
eingegangen: angaben.eingegangen,
|
||||||
|
rhythmus: RHYTHMUS[abo.interval] ?? abo.interval,
|
||||||
|
groesse: abo.size,
|
||||||
|
name: angaben.name,
|
||||||
|
grund: angaben.grund,
|
||||||
|
});
|
||||||
|
const notification: any = container.resolve(Modules.NOTIFICATION);
|
||||||
|
await notification.createNotifications({
|
||||||
|
to: abo.email,
|
||||||
|
channel: "email",
|
||||||
|
template: "subscription-canceled",
|
||||||
|
content: inhalt,
|
||||||
|
data: { subscription_id: abo.id },
|
||||||
|
});
|
||||||
|
logger.info(`[mail] Kündigungsbestätigung für ${abo.id} an ${abo.email}.`);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(
|
||||||
|
`[mail] Kündigungsbestätigung für ${abo.id} fehlgeschlagen — bitte von Hand schicken: ${
|
||||||
|
error instanceof Error ? error.message : String(error)
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -359,6 +359,78 @@ export function geschenkAnkuendigung(abo: GeschenkAbo) {
|
|||||||
return { subject: "Für Sie: ein Honig-Abo von place4bees", html, text };
|
return { subject: "Für Sie: ein Honig-Abo von place4bees", html, text };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Kuendigung = {
|
||||||
|
aboId: string;
|
||||||
|
/** "Ordentliche" oder "Außerordentliche" — wie angegeben. */
|
||||||
|
art: string;
|
||||||
|
eingegangen: Date;
|
||||||
|
rhythmus: string;
|
||||||
|
groesse?: string | null;
|
||||||
|
name?: string | null;
|
||||||
|
grund?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kündigungsbestätigung nach § 312k Abs. 4 BGB: Inhalt der Kündigung,
|
||||||
|
* Datum und Uhrzeit des Eingangs und wann der Vertrag endet.
|
||||||
|
*/
|
||||||
|
export function kuendigungsbestaetigung(k: Kuendigung) {
|
||||||
|
const zeitpunkt = new Intl.DateTimeFormat("de-DE", {
|
||||||
|
dateStyle: "long",
|
||||||
|
timeStyle: "short",
|
||||||
|
timeZone: "Europe/Berlin",
|
||||||
|
}).format(k.eingegangen);
|
||||||
|
const vertrag = `Honig-Abo ${k.rhythmus}${k.groesse ? `, ${k.groesse}` : ""} (Abo-Nummer ${k.aboId})`;
|
||||||
|
|
||||||
|
const zeilen: [string, string][] = [
|
||||||
|
["Vertrag", vertrag],
|
||||||
|
["Art der Kündigung", k.art],
|
||||||
|
["Eingegangen am", `${zeitpunkt} Uhr`],
|
||||||
|
["Vertragsende", "mit sofortiger Wirkung"],
|
||||||
|
];
|
||||||
|
if (k.name) zeilen.push(["Name", k.name]);
|
||||||
|
if (k.grund) zeilen.push(["Grund", k.grund]);
|
||||||
|
|
||||||
|
const htmlInhalt = RAHMEN(`
|
||||||
|
<h1 style="margin:0 0 4px;font-size:22px">Ihre Kündigung ist eingegangen</h1>
|
||||||
|
<p style="margin:24px 0 0">Hallo,</p>
|
||||||
|
<p style="margin:12px 0 0">
|
||||||
|
hiermit bestätigen wir den Eingang Ihrer Kündigung. Ihr Abo endet
|
||||||
|
sofort: Es folgen keine weiteren Lieferungen und keine Abbuchungen.
|
||||||
|
</p>
|
||||||
|
<table style="margin:20px 0 0;border-collapse:collapse;width:100%">
|
||||||
|
${zeilen
|
||||||
|
.map(
|
||||||
|
([feld, wert]) => `<tr>
|
||||||
|
<td style="padding:6px 12px 6px 0;color:#6b6b66;vertical-align:top;white-space:nowrap">${feld}</td>
|
||||||
|
<td style="padding:6px 0">${html(wert)}</td>
|
||||||
|
</tr>`
|
||||||
|
)
|
||||||
|
.join("")}
|
||||||
|
</table>
|
||||||
|
<p style="margin:24px 0 0;color:#6b6b66;font-size:13px">
|
||||||
|
Bewahren Sie diese E-Mail als Nachweis auf. War die Kündigung ein
|
||||||
|
Versehen? Schreiben Sie uns einfach.
|
||||||
|
</p>`);
|
||||||
|
|
||||||
|
const text = [
|
||||||
|
"Ihre Kündigung ist eingegangen",
|
||||||
|
"",
|
||||||
|
"Hallo,",
|
||||||
|
"",
|
||||||
|
"hiermit bestätigen wir den Eingang Ihrer Kündigung. Ihr Abo endet",
|
||||||
|
"sofort: Es folgen keine weiteren Lieferungen und keine Abbuchungen.",
|
||||||
|
"",
|
||||||
|
...zeilen.map(([feld, wert]) => `${feld}: ${wert}`),
|
||||||
|
"",
|
||||||
|
"Bewahren Sie diese E-Mail als Nachweis auf.",
|
||||||
|
"",
|
||||||
|
`${SHOP.name} · ${SHOP.web} · ${SHOP.email}`,
|
||||||
|
].join("\n");
|
||||||
|
|
||||||
|
return { subject: "Bestätigung Ihrer Kündigung – place4bees Honig-Abo", html: htmlInhalt, text };
|
||||||
|
}
|
||||||
|
|
||||||
/** Versandnachricht an den Beschenkten — dieselbe Sendung, ohne Beträge. */
|
/** Versandnachricht an den Beschenkten — dieselbe Sendung, ohne Beträge. */
|
||||||
export function geschenkVersandnachricht(
|
export function geschenkVersandnachricht(
|
||||||
empfaengerName: string,
|
empfaengerName: string,
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ export async function createSubscriptionsFromOrder(params: {
|
|||||||
const subscription = await service.createSubscriptions({
|
const subscription = await service.createSubscriptions({
|
||||||
customer_id: order.customer_id ?? null,
|
customer_id: order.customer_id ?? null,
|
||||||
email: order.email,
|
email: order.email,
|
||||||
|
// Hält den vereinbarten Glaspreis fest — der Abo-Job rechnet jede
|
||||||
|
// Folgelieferung zu diesem Preis ab, nicht zu dem der gezogenen Sorte.
|
||||||
|
source_line_item_id: line.lineItemId,
|
||||||
selection: line.selection,
|
selection: line.selection,
|
||||||
variant_id: line.fixedVariantId,
|
variant_id: line.fixedVariantId,
|
||||||
variant_ids: line.fixedVariantIds.length ? line.fixedVariantIds : null,
|
variant_ids: line.fixedVariantIds.length ? line.fixedVariantIds : null,
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ type Options = {
|
|||||||
user?: string;
|
user?: string;
|
||||||
pass?: string;
|
pass?: string;
|
||||||
from: string;
|
from: string;
|
||||||
|
/**
|
||||||
|
* Zum Testen: alle Mails gehen an diese Adresse statt an den Empfänger.
|
||||||
|
* So kommt beim Testen nichts bei echten Kunden an.
|
||||||
|
*/
|
||||||
|
testRecipient?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,11 +69,14 @@ class EmailNotificationService extends AbstractNotificationProviderService {
|
|||||||
// können, ohne die Adresse aus dem Text zu kopieren.
|
// können, ohne die Adresse aus dem Text zu kopieren.
|
||||||
const antwortAn = (notification.data as any)?.reply_to;
|
const antwortAn = (notification.data as any)?.reply_to;
|
||||||
|
|
||||||
|
const umgeleitet = this.options_.testRecipient;
|
||||||
|
const an = umgeleitet || notification.to;
|
||||||
|
|
||||||
const info = await this.transporter_.sendMail({
|
const info = await this.transporter_.sendMail({
|
||||||
from: notification.from || this.options_.from,
|
from: notification.from || this.options_.from,
|
||||||
...(typeof antwortAn === "string" && antwortAn ? { replyTo: antwortAn } : {}),
|
...(typeof antwortAn === "string" && antwortAn ? { replyTo: antwortAn } : {}),
|
||||||
to: notification.to,
|
to: an,
|
||||||
subject: content.subject,
|
subject: umgeleitet ? `[TEST an ${notification.to}] ${content.subject}` : content.subject,
|
||||||
text: content.text,
|
text: content.text,
|
||||||
html: content.html,
|
html: content.html,
|
||||||
attachments: (notification.attachments ?? []).map((anhang: any) => ({
|
attachments: (notification.attachments ?? []).map((anhang: any) => ({
|
||||||
@@ -78,7 +86,11 @@ class EmailNotificationService extends AbstractNotificationProviderService {
|
|||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
this.logger_.info(`[mail] "${notification.template}" an ${notification.to} verschickt (${info.messageId}).`);
|
this.logger_.info(
|
||||||
|
`[mail] "${notification.template}" an ${notification.to}` +
|
||||||
|
(umgeleitet ? ` umgeleitet nach ${umgeleitet}` : "") +
|
||||||
|
` verschickt (${info.messageId}).`
|
||||||
|
);
|
||||||
return { id: info.messageId };
|
return { id: info.messageId };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,11 +103,18 @@ services:
|
|||||||
DHL_SHIPPER_CITY: ${DHL_SHIPPER_CITY:-}
|
DHL_SHIPPER_CITY: ${DHL_SHIPPER_CITY:-}
|
||||||
DHL_SHIPPER_COUNTRY: ${DHL_SHIPPER_COUNTRY:-}
|
DHL_SHIPPER_COUNTRY: ${DHL_SHIPPER_COUNTRY:-}
|
||||||
MOLLIE_API_KEY: ${MOLLIE_API_KEY:-}
|
MOLLIE_API_KEY: ${MOLLIE_API_KEY:-}
|
||||||
|
# Frontend und Backend teilen sich die Domain. Ohne diese beiden schickt
|
||||||
|
# Mollie den Kunden nach localhost zurück und meldet die Zahlung nie.
|
||||||
|
MOLLIE_WEBHOOK_URL: ${MEDUSA_BACKEND_URL}/hooks/mollie
|
||||||
|
STOREFRONT_URL: ${MEDUSA_BACKEND_URL}
|
||||||
SMTP_HOST: ${SMTP_HOST:-}
|
SMTP_HOST: ${SMTP_HOST:-}
|
||||||
SMTP_PORT: ${SMTP_PORT:-}
|
SMTP_PORT: ${SMTP_PORT:-}
|
||||||
SMTP_USER: ${SMTP_USER:-}
|
SMTP_USER: ${SMTP_USER:-}
|
||||||
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
||||||
MAIL_FROM: ${MAIL_FROM:-}
|
MAIL_FROM: ${MAIL_FROM:-}
|
||||||
|
# Auf dem Testsystem setzen: alle Mails gehen dann dorthin statt an
|
||||||
|
# Kunden. In der Produktion leer lassen.
|
||||||
|
MAIL_TEST_EMPFAENGER: ${MAIL_TEST_EMPFAENGER:-}
|
||||||
volumes:
|
volumes:
|
||||||
- ${DATA_DIR:-/srv/place4bees}/uploads:/app/static
|
- ${DATA_DIR:-/srv/place4bees}/uploads:/app/static
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const cartId = Astro.url.searchParams.get("cart") ?? "";
|
|||||||
</section>
|
</section>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script data-astro-rerun>
|
<script>
|
||||||
import { getCart } from "../../lib/cart";
|
import { getCart } from "../../lib/cart";
|
||||||
import { clearCartIdClient } from "../../lib/cartCookie";
|
import { clearCartIdClient } from "../../lib/cartCookie";
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ const formatDate = (value: string | null) => (value ? dateFmt.format(new Date(va
|
|||||||
</template>
|
</template>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script data-astro-rerun>
|
<script>
|
||||||
import { updateSubscription } from "../../lib/subscriptions";
|
import { updateSubscription } from "../../lib/subscriptions";
|
||||||
import { getCustomerTokenClient } from "../../lib/customerCookie";
|
import { getCustomerTokenClient } from "../../lib/customerCookie";
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ import Layout from "../layouts/Layout.astro";
|
|||||||
</h2>
|
</h2>
|
||||||
<p class="mt-4 leading-relaxed text-brand-text">
|
<p class="mt-4 leading-relaxed text-brand-text">
|
||||||
Ihr Abo ist gekündigt. Es wird nichts mehr abgebucht und nichts mehr
|
Ihr Abo ist gekündigt. Es wird nichts mehr abgebucht und nichts mehr
|
||||||
versandt. Bitte bewahren Sie diese Bestätigung auf:
|
versandt. Dieselbe Bestätigung schicken wir Ihnen per E-Mail. Bitte
|
||||||
|
bewahren Sie sie auf:
|
||||||
</p>
|
</p>
|
||||||
<dl class="mt-6 grid gap-3 border-t border-brand-border pt-5 text-sm">
|
<dl class="mt-6 grid gap-3 border-t border-brand-border pt-5 text-sm">
|
||||||
<div class="flex justify-between gap-4">
|
<div class="flex justify-between gap-4">
|
||||||
@@ -134,7 +135,7 @@ import Layout from "../layouts/Layout.astro";
|
|||||||
</section>
|
</section>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script data-astro-rerun>
|
<script>
|
||||||
import { cancelWithoutLogin } from "../lib/subscriptions";
|
import { cancelWithoutLogin } from "../lib/subscriptions";
|
||||||
|
|
||||||
document.addEventListener("astro:page-load", () => {
|
document.addEventListener("astro:page-load", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user