Context
The LNURL-pay params response hard-codes commentAllowed => false and the invoice callback ignores any comment query parameter.
src/Invoice/Application/CallbackUrl.php — returns 'commentAllowed' => false with a // TODO: Not implemented yet.
src/Invoice/Application/InvoiceGenerator.php — generateInvoice() builds the invoice; no comment handling.
src/Invoice/Infrastructure/Controller/InvoiceController.php — reads only amount from the request.
src/Invoice/InvoiceConfig.php / src/Config/LightningConfig.php — config reader/writer.
Goal
Implement LUD-12 comments: advertise a max comment length in the pay params, accept a comment on the callback, and attach it to the invoice.
Scope / Tasks
Implementation notes
- Per LUD-12,
commentAllowed is the number of characters accepted (0/absent = not allowed). Enforce the limit server-side.
- Follow the existing config pattern: private field + fluent setter +
jsonSerialize() entry in LightningConfig, get(ConfigKey::…) in InvoiceConfig, both keyed via ConfigKey.
- Error responses already use
{status:ERROR, reason:…} — reuse.
Acceptance criteria
References
Context
The LNURL-pay params response hard-codes
commentAllowed => falseand the invoice callback ignores anycommentquery parameter.src/Invoice/Application/CallbackUrl.php— returns'commentAllowed' => falsewith a// TODO: Not implemented yet.src/Invoice/Application/InvoiceGenerator.php—generateInvoice()builds the invoice; nocommenthandling.src/Invoice/Infrastructure/Controller/InvoiceController.php— reads onlyamountfrom the request.src/Invoice/InvoiceConfig.php/src/Config/LightningConfig.php— config reader/writer.Goal
Implement LUD-12 comments: advertise a max comment length in the pay params, accept a
commenton the callback, and attach it to the invoice.Scope / Tasks
LightningConfig::setCommentAllowed(int $chars), default0= disabled) with a matchingInvoiceConfig::getCommentAllowed(): int. Wire it throughConfigKey.CallbackUrl::getCallbackUrl()returnscommentAllowed => <int>from config instead of the hard-codedfalse.InvoiceControllerreads thecommentquery param and passes it intogenerateInvoice().InvoiceGeneratorvalidates the comment length againstcommentAllowed(reject over-length with the LNURL{status:ERROR, reason}shape) and uses the comment as/within the invoice memo.Implementation notes
commentAllowedis the number of characters accepted (0/absent = not allowed). Enforce the limit server-side.jsonSerialize()entry inLightningConfig,get(ConfigKey::…)inInvoiceConfig, both keyed viaConfigKey.{status:ERROR, reason:…}— reuse.Acceptance criteria
commentAllowedunset, behavior is unchanged (commentAllowed => 0, comment ignored).commentAllowed => N; a?comment=up to N chars is attached to the invoice; over-length is rejected with an LNURL error.composer test-allgreen.References
{ "status": "ERROR", "reason": "…" }