Skip to content

Configurable LUD-09 success actions (url) + LUD-11 disposable #28

Description

@Chemaclass

Context

The invoice callback response hard-codes two protocol fields:

  • src/Invoice/Application/InvoiceGenerator.phpmapResponseAsArray() always emits successAction => { tag: 'message', message: <config successMessage> } and disposable => false.

LUD-09 (successAction) supports a url action (open a URL after payment) in addition to message; LUD-11 defines disposable.

Goal

Make successAction and disposable configurable so operators can send a URL success action (e.g. an order/receipt page) and control disposability, per LUD-09 / LUD-11.

Scope / Tasks

  • Config for success action: keep the current message default, add an optional url action. Suggested API: LightningConfig::setSuccessUrl(string $description, string $url) (LUD-09 url action requires both a description and a url). Add matching InvoiceConfig getters + ConfigKey entries.
  • Config for disposability: LightningConfig::setDisposable(bool)InvoiceConfig::isDisposable(): bool, default false (unchanged).
  • InvoiceGenerator::mapResponseAsArray() emits the configured successAction (message or url) and disposable from config.
  • Update the facade/generator return-shape docblocks (the successAction shape becomes a union) and the README.

Implementation notes

  • LUD-09 url action shape: { "tag": "url", "description": <string>, "url": <string> }; message action: { "tag": "message", "message": <string ≤144 chars> }. Enforce the 144-char cap on message.
  • Default remains the message action using the existing success-message config, so current configs are unaffected.
  • Follow the established config plumbing (LightningConfig fluent setter + jsonSerialize(), InvoiceConfig::get(ConfigKey::…)).

Acceptance criteria

  • Default config → identical response to today (message action, disposable:false).
  • Configuring a URL action → callback returns the url successAction.
  • disposable reflects config.
  • Unit tests for message action (default), url action, and disposable=true.
  • composer test-all green.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions