Skip to content

fix(pay-request): lock amount/destination in SendForm and re-validate on submit (#26) - #92

Open
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/payrequest-locked-fields-validation
Open

fix(pay-request): lock amount/destination in SendForm and re-validate on submit (#26)#92
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/payrequest-locked-fields-validation

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 2, 2026

Copy link
Copy Markdown

Closes #26

Problem

PayRequest.tsx previously passed requested amount and destination to SendForm via defaultValues, leaving the inputs editable by the payer before quote/payment submission. Additionally, if the payment request status changed (e.g., cancelled or expired) or if fields were modified, the submission could proceed without re-validating the fresh state against Horizon/backend.

Solution

  1. Added lockedFields support to SendForm, marking destinationAddress, amount, destinationAssetCode, and amountType as read-only / disabled in PayRequest.
  2. Updated PayRequests onSubmit handler to re-fetch latest request state (refetch()) and ensure the request is still open and matching requesterPublicKey, amount, and assetCode before requesting a quote.
  3. Added comprehensive unit tests in src/pages/PayRequest.test.tsx verifying field locking and stale/cancelled request blocking.

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.

PayRequest page lets the payer silently edit the requested amount and destination before paying

1 participant