• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 24342667594

13 Apr 2026 12:12PM UTC coverage: 42.555% (-13.0%) from 55.529%
24342667594

Pull #468

github

web-flow
Merge 4fd541f37 into 1410824d2
Pull Request #468: Phase3: UI Implementation for Dashboard

424 of 1204 branches covered (35.22%)

Branch coverage included in aggregate %.

164 of 540 new or added lines in 14 files covered. (30.37%)

373 existing lines in 23 files now uncovered.

1385 of 3047 relevant lines covered (45.45%)

7.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.24
/src/controllers/callbacks/opennode-callback-controller.ts
1
import { Request, Response } from 'express'
2

3
import { Invoice, InvoiceStatus } from '../../@types/invoice'
2✔
4
import { createLogger } from '../../factories/logger-factory'
2✔
5
import { fromOpenNodeInvoice } from '../../utils/transform'
2✔
6
import { IController } from '../../@types/controllers'
7
import { IPaymentsService } from '../../@types/services'
8

9
const debug = createLogger('opennode-callback-controller')
2✔
10

11
export class OpenNodeCallbackController implements IController {
2✔
12
  public constructor(
UNCOV
13
    private readonly paymentsService: IPaymentsService,
×
14
  ) {}
15

16
  // TODO: Validate
17
  public async handleRequest(
18
    request: Request,
19
    response: Response,
20
  ) {
UNCOV
21
    debug('request headers: %o', request.headers)
×
22
    debug('request body: %O', request.body)
×
23

UNCOV
24
    const invoice = fromOpenNodeInvoice(request.body)
×
25

26
    debug('invoice', invoice)
×
27

28
    let updatedInvoice: Invoice
UNCOV
29
    try {
×
UNCOV
30
      updatedInvoice = await this.paymentsService.updateInvoiceStatus(invoice)
×
31
    } catch (error) {
32
      console.error(`Unable to persist invoice ${invoice.id}`, error)
×
33

UNCOV
34
      throw error
×
35
    }
36

37
    if (
×
38
      updatedInvoice.status !== InvoiceStatus.COMPLETED
×
39
      && !updatedInvoice.confirmedAt
40
    ) {
41
      response
×
42
        .status(200)
43
        .send()
44

45
      return
×
46
    }
47

48
    invoice.amountPaid = invoice.amountRequested
×
UNCOV
49
    updatedInvoice.amountPaid = invoice.amountRequested
×
50

UNCOV
51
    try {
×
52
      await this.paymentsService.confirmInvoice({
×
53
        id: invoice.id,
54
        pubkey: invoice.pubkey,
55
        status: updatedInvoice.status,
56
        amountPaid: updatedInvoice.amountRequested,
57
        confirmedAt: updatedInvoice.confirmedAt,
58
      })
59
      await this.paymentsService.sendInvoiceUpdateNotification(updatedInvoice)
×
60
    } catch (error) {
UNCOV
61
      console.error(`Unable to confirm invoice ${invoice.id}`, error)
×
62

63
      throw error
×
64
    }
65

UNCOV
66
    response
×
67
      .status(200)
68
      .setHeader('content-type', 'text/plain; charset=utf8')
69
      .send('OK')
70
  }
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc