diff --git a/src/common/api/worker/facades/lazy/CustomerFacade.ts b/src/common/api/worker/facades/lazy/CustomerFacade.ts index e874c41611c..338c7129670 100644 --- a/src/common/api/worker/facades/lazy/CustomerFacade.ts +++ b/src/common/api/worker/facades/lazy/CustomerFacade.ts @@ -23,7 +23,6 @@ import { createMembershipRemoveData, createPaymentDataServicePutData, CustomDomainReturn, - Customer, CustomerInfoTypeRef, CustomerServerProperties, CustomerServerPropertiesTypeRef, @@ -468,9 +467,11 @@ export class CustomerFacade { } } - async generateXRechnungInvoice(invoiceNumber: string, customer: Customer, accountingInfo: AccountingInfo): Promise { + async generateXRechnungInvoice(invoiceNumber: string): Promise { + const customer = await this.entityClient.load(CustomerTypeRef, assertNotNull(this.userFacade.getUser()?.customer)) const customerInfo = await this.entityClient.load(CustomerInfoTypeRef, customer.customerInfo) const invoiceData = await this.serviceExecutor.get(InvoiceDataService, createInvoiceDataGetIn({ invoiceNumber })) + const { XRechnungInvoiceGenerator } = await import("../../invoicegen/XRechnungInvoiceGenerator.js") const xRechnungGenerator = new XRechnungInvoiceGenerator(invoiceData, invoiceNumber, this.getCustomerId(), customerInfo.registrationMailAddress) const xRechnungFile = xRechnungGenerator.generate() return { diff --git a/src/common/subscription/PaymentViewer.ts b/src/common/subscription/PaymentViewer.ts index 8b414a858fa..0482000936b 100644 --- a/src/common/subscription/PaymentViewer.ts +++ b/src/common/subscription/PaymentViewer.ts @@ -359,9 +359,7 @@ export class PaymentViewer implements UpdatableSettingsViewer { private async doXrechnungInvoiceDownload(posting: CustomerAccountPosting) { return showProgressDialog( "pleaseWait_msg", - locator.customerFacade - .generateXRechnungInvoice(neverNull(posting.invoiceNumber), neverNull(this.customer), neverNull(this.accountingInfo)) - .then((xInvoice) => locator.fileController.saveDataFile(xInvoice)), + locator.customerFacade.generateXRechnungInvoice(neverNull(posting.invoiceNumber)).then((xInvoice) => locator.fileController.saveDataFile(xInvoice)), ) }