Skip to content

refactor: make retryPayment client-side [AMB-3091] - #51

Draft
bufo24 wants to merge 3 commits into
mainfrom
jesseva/amb-3091-sdk-expose-retrypaymentpaymentid-method
Draft

refactor: make retryPayment client-side [AMB-3091]#51
bufo24 wants to merge 3 commits into
mainfrom
jesseva/amb-3091-sdk-expose-retrypaymentpaymentid-method

Conversation

@bufo24

@bufo24 bufo24 commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Transactions.retryPayment(paymentId: string): Promise<SendResult> retries a FAILED send client-side: looks up the transaction, validates it's retryable (status FAILED, invoice not expired, has a payment_request), then resends that payment_request through the existing send()/create_send path with a fresh idempotency key. No dedicated server-side retry_send mutation involved.
  • Reuses send()'s actual node-payment logic (macaroon resolution via #sendContext, sendLndPayment/sendAssetPayment) rather than duplicating it.
  • Takes no password: relies on prepareSend's cached macaroon, same as a password-less send(); fails the same way (PaymentSendError) when nothing is cached.
  • Throws PaymentSendError if the transaction isn't retryable (wrong status, expired invoice, or missing payment_request) instead of silently proceeding.

Scope change

Originally implemented against a retry_send mutation planned in amboss-rails-api#577. That mutation is being removed from #577 by a parallel effort (AMB-3092) — retry is now client-side instead, so this SDK has no dependency on #577 or any other unreleased backend change. Deleted the hand-authored retrySend.ts/retrySend.types.ts files, since the whole point of client-side retry is that no new mutation is needed.

Test plan

  • pnpm run build
  • pnpm run typecheck
  • pnpm run test (62/62 passing, including 6 tests in transactions.retryPayment.test.ts: resends via a prepared macaroon, throws PaymentSendError with nothing prepared, returns payment: null for sandbox, and throws for non-FAILED status / expired invoice / missing payment_request)

🤖 Generated with Claude Code

bufo24 added 2 commits August 28, 2026 13:36
Retries a FAILED send transaction, reusing its stored payment_request
(no new invoice minted), and pays it against the node the same way
send() does.

Calls the retry_send mutation, hand-authored against
amboss-rails-api#577 (unmerged, not yet deployed) the same way
mintStreamToken was hand-authored for AMB-3016 — codegen only
generates against the live schema. TODO(AMB-3091) left in
resources/retrySend.ts and retrySend.types.ts: once #577 merges and
deploys, refresh the schema, run codegen, and delete both files in
favor of the generated operation.
@bufo24 bufo24 changed the title feat: add retryPayment method [AMB-3091] refactor: make retryPayment client-side [AMB-3091] Aug 28, 2026
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