Skip to content

refactor: use the SDK payment link pay flow contract - #1242

Draft
TaprootFreak wants to merge 1 commit into
developfrom
feat/use-packages-payment-link
Draft

refactor: use the SDK payment link pay flow contract#1242
TaprootFreak wants to merge 1 commit into
developfrom
feat/use-packages-payment-link

Conversation

@TaprootFreak

@TaprootFreak TaprootFreak commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Consumer side of step 3 of DFXswiss/packages#198: use the payment link pay-flow contract from
@dfx.swiss/react and drop the local copies.

Depends on DFXswiss/packages#201.

Changes

src/dto/payment-link.dto.ts keeps only what is genuinely local — WalletInfo, MetaMaskInfo, the
UI-only NoPaymentLinkPaymentStatus / ExtendedPaymentLinkStatus, and the LNURL wait shape. Everything
that describes the wire now comes from the package, under the package's names:

here, before package
TransferInfo TransferAmount
Amount PaymentAmount
RecipientInfo PaymentLinkRecipient
Quote PaymentQuote

What the corrected types surfaced

The local copy had PaymentLinkPayRequest extends PaymentLinkPayTerminal, so error fields and quote
fields lived on one type and every access typechecked. The package models them as the two shapes the
API actually returns, which made four real assumptions visible:

  • fetchPayRequest declared its response as a pay request and then read statusCode / message off
    it — the error case it was handling could not occur under its own type. It now reads
    PaymentLinkPayResponse and narrows with hasPaymentQuote.
  • The assign screen and the "not assigned" branch read statusCode without narrowing; same fix.
  • route and currency are optional on a pay request. The public-payment form passed route into
    URLSearchParams as a string and interpolated currency into a label — both assumed a value the
    API does not promise. route is now only sent when present.
  • The Tag detail row read payRequest.tag, which only exists on a quoted response.

C2BPaymentMethod.KUCOINPAY is KUCOIN_PAY in the package.

Before this can go green

The package pin in package.json still points at the published @dfx.swiss/react. CI stays red
until DFXswiss/packages#201 is merged and published and the pin is raised here.
Verified locally
against a build of that branch: tsc clean, npm run lint clean, full suite at 673 passing with no
new failures (the two suites failing on develop today still fail, unchanged).

Overlap

#1223 touches the same two contexts (wait-endpoint polling). The textual conflict is routine, but
worth a look when the second of the two lands: any code it adds that reads statusCode, message,
tag, route or currency off a pay request needs the same narrowing this PR introduces —
the compiler will say so, but only once both are in.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 PR Review Bot

❌ TypeScript: 37 errors


This is an automated review. Please address the issues above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant