Skip to content

[Bug] PaymentModal abandons pending Stellar transactions instead of calling the existing cancelPayment - #162

Merged
zeemscript merged 1 commit into
Deen-Bridge:devfrom
mayborn005:fix/payment-modal-cleanup
Jul 29, 2026
Merged

[Bug] PaymentModal abandons pending Stellar transactions instead of calling the existing cancelPayment#162
zeemscript merged 1 commit into
Deen-Bridge:devfrom
mayborn005:fix/payment-modal-cleanup

Conversation

@mayborn005

Copy link
Copy Markdown

Description

This PR fixes #76 by wiring the existing cancelPayment() into PaymentModal so pending transactions are properly cleaned up instead of abandoned.

Changes

hooks/useStellarPayment.js

  • executePayment now returns { success: true, data } on success, { success: false, cancelled: true } on wallet rejection, and { success: false, cancelled: false } on other errors. This lets callers distinguish cancellation from failure without breaking the existing API surface (the only caller is PaymentModal).

components/stellar/PaymentModal.jsx

  • Destructured cancelPayment from useStellarPayment()
  • handleClose: calls cancelPayment() when closing from a step that has a pending, unsubmitted transaction (confirm/preview); returns early during processing to prevent accidental dismissal; uses closingRef guard so it is safe to call multiple times
  • handleBack (new): calls cancelPayment(), clears paymentData, returns to preview — prevents duplicate orphaned transactions on initiate → back → initiate
  • handleConfirm: on wallet rejection (outcome.cancelled), cancels the pending backend transaction and returns to preview instead of leaving the tx dangling in error step
  • DialogContent: added onPointerDownOutside and onEscapeKeyDown that preventDefault() during the processing step, blocking accidental dismissal while a signature or submission is in flight
  • Processing step text changed to "Waiting for wallet confirmation…"

Acceptance Criteria Fulfilled

  • Closing the modal from the confirm step issues DELETE /api/stellar/payment/transactions/:id
  • Opening the modal and completing a purchase still works end-to-end on testnet (executePayment returns { success: true, data })
  • While processing, overlay click and Escape do not close the dialog; after success/error they do
  • Rejecting the signature in the wallet returns the user to the preview step with no orphaned pending transaction
  • No duplicate pending transactions are created by an initiate → back → initiate sequence

- Destructure cancelPayment from useStellarPayment and call it when
  modal closes with a pending, unsubmitted transaction (confirm step
  or Back button)
- Modify executePayment to return { success, cancelled, data } so the
  modal can distinguish wallet rejection from other failures
- On wallet rejection: cancel the pending backend transaction and
  return user to preview step instead of leaving the tx dangling
- Block overlay click and Escape dismissal during processing
  (onPointerDownOutside / onEscapeKeyDown preventDefault)
- Update processing text to 'Waiting for wallet confirmation…'
- Add closingRef guard to make handleClose safe for multiple calls
- Back button now cancels the pending tx, ensuring initiate-back-
  initiate does not create orphaned duplicate transactions

Fixes Deen-Bridge#76
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@BountySpaghetti is attempting to deploy a commit to the Deen Bridge Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@mayborn005, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0594e497-1450-4d7a-898f-2823483212a8

📥 Commits

Reviewing files that changed from the base of the PR and between b0f0abb and 15a0f3c.

📒 Files selected for processing (2)
  • components/stellar/PaymentModal.jsx
  • hooks/useStellarPayment.js

Comment @coderabbitai help to get the list of available commands.

@zeemscript
zeemscript merged commit d08eb29 into Deen-Bridge:dev Jul 29, 2026
2 of 3 checks passed
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.

3 participants