From 4a58d4c80fc9f12cafed286fe23219d1ce4cd501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Thu, 25 May 2023 09:25:52 -0400 Subject: [PATCH] fix: confirm invoice confirmedAt is undefined --- src/@types/services.ts | 2 +- src/controllers/callbacks/opennode-callback-controller.ts | 2 ++ src/controllers/callbacks/zebedee-callback-controller.ts | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/@types/services.ts b/src/@types/services.ts index ccc23542..c1427cfb 100644 --- a/src/@types/services.ts +++ b/src/@types/services.ts @@ -11,7 +11,7 @@ export interface IPaymentsService { updateInvoice(invoice: Partial): Promise updateInvoiceStatus(invoice: Pick): Promise confirmInvoice( - invoice: Pick, + invoice: Pick, ): Promise sendInvoiceUpdateNotification(invoice: Invoice): Promise getPendingInvoices(): Promise diff --git a/src/controllers/callbacks/opennode-callback-controller.ts b/src/controllers/callbacks/opennode-callback-controller.ts index 7456ed45..f3755df0 100644 --- a/src/controllers/callbacks/opennode-callback-controller.ts +++ b/src/controllers/callbacks/opennode-callback-controller.ts @@ -51,6 +51,8 @@ export class OpenNodeCallbackController implements IController { try { await this.paymentsService.confirmInvoice({ id: invoice.id, + pubkey: invoice.pubkey, + status: updatedInvoice.status, amountPaid: updatedInvoice.amountRequested, confirmedAt: updatedInvoice.confirmedAt, }) diff --git a/src/controllers/callbacks/zebedee-callback-controller.ts b/src/controllers/callbacks/zebedee-callback-controller.ts index 7a4c24a8..869861d7 100644 --- a/src/controllers/callbacks/zebedee-callback-controller.ts +++ b/src/controllers/callbacks/zebedee-callback-controller.ts @@ -70,11 +70,14 @@ export class ZebedeeCallbackController implements IController { } invoice.amountPaid = invoice.amountRequested + invoice.status = updatedInvoice.status updatedInvoice.amountPaid = invoice.amountRequested try { await this.paymentsService.confirmInvoice({ id: invoice.id, + pubkey: invoice.pubkey, + status: invoice.status, confirmedAt: invoice.confirmedAt, amountPaid: invoice.amountRequested, })