Email ID
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Sqids from "sqids";
|
||||
import { writable, Writable } from "svelte/store";
|
||||
import { ZodEffects, ZodNullable, ZodOptional, ZodType } from "zod";
|
||||
|
||||
@@ -58,3 +59,8 @@ export function getZodBaseType(schema: ZodType<any>): ZodType<any> {
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
export const sqids = new Sqids({
|
||||
alphabet: "0123456789abcdefghijklmnopqrstuvw",
|
||||
minLength: 8
|
||||
})
|
||||
@@ -6,9 +6,11 @@ import {
|
||||
Enums,
|
||||
Rechnung,
|
||||
VerbrauchsausweisWohnen,
|
||||
} from "#lib/client/prisma";
|
||||
import { prisma } from "#lib/server/prisma";
|
||||
} from "#lib/client/prisma.js";
|
||||
import { prisma } from "#lib/server/prisma.js";
|
||||
import { getAnsichtsausweis } from "../ausweis.js";
|
||||
import Mail from "nodemailer/lib/mailer/index.js";
|
||||
import { sqids } from "#client/lib/helpers.js";
|
||||
|
||||
export async function sendInvoiceMail(
|
||||
ausweis: VerbrauchsausweisWohnen,
|
||||
@@ -33,7 +35,7 @@ export async function sendInvoiceMail(
|
||||
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
|
||||
const attachments: any[] = [];
|
||||
const attachments: Mail.Attachment[] = [];
|
||||
|
||||
if (ausweisart != Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||
const ansichtsausweis = await getAnsichtsausweis(
|
||||
@@ -46,15 +48,15 @@ export async function sendInvoiceMail(
|
||||
);
|
||||
|
||||
if (ansichtsausweis) {
|
||||
attachments.push([
|
||||
attachments.push(
|
||||
{
|
||||
filename: "Ansichtsausweis.pdf",
|
||||
filename: `ID_${ausweis.id}_Ansichtsausweis.pdf`,
|
||||
encoding: "binary",
|
||||
content: Buffer.from(ansichtsausweis),
|
||||
contentType: "application/pdf",
|
||||
contentDisposition: "attachment",
|
||||
},
|
||||
]);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ export async function sendInvoiceMail(
|
||||
attachments,
|
||||
from: `"IBCornelsen" <info@online-energieausweis.org>`,
|
||||
to: user.email,
|
||||
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.uid})`,
|
||||
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.id})`,
|
||||
cc: {
|
||||
address: rechnung.email || "",
|
||||
name: rechnung.empfaenger || "",
|
||||
|
||||
@@ -8,18 +8,14 @@ import {
|
||||
} from "#lib/client/prisma.js";
|
||||
import { prisma } from "#lib/server/prisma.js";
|
||||
import { getAnsichtsausweis } from "../ausweis.js";
|
||||
import Sqids from "sqids";
|
||||
import { sqids } from "#client/lib/helpers.js";
|
||||
import Mail from "nodemailer/lib/mailer/index.js";
|
||||
|
||||
export async function sendPaymentSuccessMail(
|
||||
ausweis: VerbrauchsausweisWohnen,
|
||||
rechnung: Rechnung,
|
||||
user: Benutzer
|
||||
) {
|
||||
const sqids = new Sqids({
|
||||
alphabet: "0123456789abcdefghijklmnopqrstuvw",
|
||||
minLength: 8
|
||||
})
|
||||
|
||||
const aufnahme = await prisma.aufnahme.findUnique({
|
||||
where: {
|
||||
id: ausweis.aufnahme_id,
|
||||
@@ -36,7 +32,7 @@ export async function sendPaymentSuccessMail(
|
||||
|
||||
let info: string = "";
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
const attachments: any[] = [];
|
||||
const attachments: Mail.Attachment[] = [];
|
||||
|
||||
if (ausweisart != Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||
const ansichtsausweis = await getAnsichtsausweis(
|
||||
@@ -49,15 +45,15 @@ export async function sendPaymentSuccessMail(
|
||||
);
|
||||
|
||||
if (ansichtsausweis) {
|
||||
attachments.push([
|
||||
attachments.push(
|
||||
{
|
||||
filename: "Ansichtsausweis.pdf",
|
||||
filename: `ID_${ausweis.id}_Ansichtsausweis.pdf`,
|
||||
encoding: "binary",
|
||||
content: Buffer.from(ansichtsausweis),
|
||||
contentType: "application/pdf",
|
||||
contentDisposition: "attachment",
|
||||
},
|
||||
]);
|
||||
}
|
||||
);
|
||||
}
|
||||
info =
|
||||
"In der Regel erhalten Sie Ihren geprüften Ausweis innerhalb von 24 Stunden.";
|
||||
@@ -70,7 +66,7 @@ export async function sendPaymentSuccessMail(
|
||||
attachments,
|
||||
from: `"IBCornelsen" <info@online-energieausweis.org>`,
|
||||
to: user.email,
|
||||
subject: `Bestellbestätigung vom IBCornelsen (ID: ${sqids.encode([ausweis.id])})`,
|
||||
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.id})`,
|
||||
cc: {
|
||||
address: rechnung.email || "",
|
||||
name: rechnung.empfaenger || "",
|
||||
|
||||
Reference in New Issue
Block a user