mirror of
https://github.com/Cameri/nostream.git
synced 2025-03-17 13:21:45 +01:00
fix: lnbits broken after lnurl-pay support (#310)
This commit is contained in:
parent
fdf49ff59f
commit
018f9a14fb
@ -28,6 +28,10 @@ export interface Invoice {
|
||||
verifyURL?: string
|
||||
}
|
||||
|
||||
export interface LnurlInvoice extends Invoice {
|
||||
verifyURL: string
|
||||
}
|
||||
|
||||
export interface DBInvoice {
|
||||
id: string
|
||||
pubkey: Buffer
|
||||
|
@ -2,7 +2,7 @@ import { AxiosInstance } from 'axios'
|
||||
import { Factory } from '../@types/base'
|
||||
|
||||
import { CreateInvoiceRequest, GetInvoiceResponse, IPaymentsProcessor } from '../@types/clients'
|
||||
import { Invoice, InvoiceStatus, InvoiceUnit } from '../@types/invoice'
|
||||
import { InvoiceStatus, InvoiceUnit, LnurlInvoice } from '../@types/invoice'
|
||||
import { createLogger } from '../factories/logger-factory'
|
||||
import { randomUUID } from 'crypto'
|
||||
import { Settings } from '../@types/settings'
|
||||
@ -15,7 +15,7 @@ export class LnurlPaymentsProcesor implements IPaymentsProcessor {
|
||||
private settings: Factory<Settings>
|
||||
) {}
|
||||
|
||||
public async getInvoice(invoice: Invoice): Promise<GetInvoiceResponse> {
|
||||
public async getInvoice(invoice: LnurlInvoice): Promise<GetInvoiceResponse> {
|
||||
debug('get invoice: %s', invoice.id)
|
||||
|
||||
try {
|
||||
|
@ -35,11 +35,10 @@ export class PaymentsService implements IPaymentsService {
|
||||
}
|
||||
}
|
||||
|
||||
public async getInvoiceFromPaymentsProcessor(invoice: Invoice): Promise<Partial<Invoice>> {
|
||||
debug('get invoice %s from payment processor', invoice.id)
|
||||
public async getInvoiceFromPaymentsProcessor(invoice: Invoice | string): Promise<Partial<Invoice>> {
|
||||
try {
|
||||
return await this.paymentsProcessor.getInvoice(
|
||||
this.settings().payments?.processor === 'lnurl' ? invoice : invoice.id
|
||||
typeof invoice === 'string' ? invoice : invoice.id
|
||||
)
|
||||
} catch (error) {
|
||||
console.log('Unable to get invoice from payments processor. Reason:', error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user