more logs

This commit is contained in:
boufni95 2024-02-23 16:42:55 +01:00
parent 442c89271c
commit 6c72588e53
2 changed files with 6 additions and 1 deletions

View file

@ -224,8 +224,11 @@ export default class {
} }
async NewInvoice(value: number, memo: string, expiry: number): Promise<Invoice> { async NewInvoice(value: number, memo: string, expiry: number): Promise<Invoice> {
getLogger({})("adding invoice...")
await this.Health() await this.Health()
getLogger({})("lnd healthy")
const res = await this.lightning.addInvoice(AddInvoiceReq(value, expiry, false, memo), DeadLineMetadata()) const res = await this.lightning.addInvoice(AddInvoiceReq(value, expiry, false, memo), DeadLineMetadata())
getLogger({})("got the invoice")
return { payRequest: res.response.paymentRequest } return { payRequest: res.response.paymentRequest }
} }

View file

@ -120,11 +120,13 @@ export default class {
async AddAppUserInvoice(appId: string, req: Types.AddAppUserInvoiceRequest): Promise<Types.NewInvoiceResponse> { async AddAppUserInvoice(appId: string, req: Types.AddAppUserInvoiceRequest): Promise<Types.NewInvoiceResponse> {
const app = await this.storage.applicationStorage.GetApplication(appId) const app = await this.storage.applicationStorage.GetApplication(appId)
const log = getLogger({ appName: app.name })
const receiver = await this.storage.applicationStorage.GetApplicationUser(app, req.receiver_identifier) const receiver = await this.storage.applicationStorage.GetApplicationUser(app, req.receiver_identifier)
const { user: payer } = await this.storage.applicationStorage.GetOrCreateApplicationUser(app, req.payer_identifier, 0) const { user: payer } = await this.storage.applicationStorage.GetOrCreateApplicationUser(app, req.payer_identifier, 0)
const opts: InboundOptionals = { callbackUrl: req.http_callback_url, expiry: defaultInvoiceExpiry, expectedPayer: payer.user, linkedApplication: app } const opts: InboundOptionals = { callbackUrl: req.http_callback_url, expiry: defaultInvoiceExpiry, expectedPayer: payer.user, linkedApplication: app }
log("generating invoice...")
const appUserInvoice = await this.paymentManager.NewInvoice(receiver.user.user_id, req.invoice_req, opts) const appUserInvoice = await this.paymentManager.NewInvoice(receiver.user.user_id, req.invoice_req, opts)
getLogger({ appName: app.name })(receiver.identifier, "invoice created to be paid by", payer.identifier) log(receiver.identifier, "invoice created to be paid by", payer.identifier)
return { return {
invoice: appUserInvoice.invoice invoice: appUserInvoice.invoice
} }