Skip to content

Commit

Permalink
fix: confirm invoice confirmedAt is undefined (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameri authored May 25, 2023
1 parent 7969701 commit e0e3a11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/@types/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IPaymentsService {
updateInvoice(invoice: Partial<Invoice>): Promise<void>
updateInvoiceStatus(invoice: Pick<Invoice, 'id' | 'status'>): Promise<Invoice>
confirmInvoice(
invoice: Pick<Invoice, 'id' | 'amountPaid' | 'confirmedAt'>,
invoice: Pick<Invoice, 'id' | 'amountPaid' | 'confirmedAt' | 'status' | 'pubkey'>,
): Promise<void>
sendInvoiceUpdateNotification(invoice: Invoice): Promise<void>
getPendingInvoices(): Promise<Invoice[]>
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/callbacks/opennode-callback-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/callbacks/zebedee-callback-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down

0 comments on commit e0e3a11

Please sign in to comment.