Repository navigation
feat(open-credit): create credit line on offer acceptance - #1338
Open
AugistineCreates wants to merge 1 commit into
Open
AugistineCreates wants to merge 1 commit into
AugistineCreates wants to merge 1 commit into
Conversation
Contributor
|
This PR currently has no file changes compared to main (its branch may have been reset, or the commits were already merged elsewhere), so there is nothing to review or merge. Please push the commits for your issue onto this branch, rebased on the latest main, and make sure CI passes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On
/open-credit(RequestEvaluation), clicking "Accept Credit Line" previously moved the wizard to step 5 without creating a credit line in state, without binding the offer to the connected wallet, and without checking offer expiry.This PR resolves the issue by extending the credit data port with an
acceptOfferoperation, requiring a connected wallet at evaluation and acceptance time, binding the offer identity to the wallet's public key, enforcing offer time expiration, and navigating the user to/credit-lines?highlight=<id>upon successful acceptance.Resolves Creditra/Creditra-Frontend open credit acceptance issue.
Key Changes
Extend the Credit Data Port (
src/services/credit/index.ts):offerId: stringandexpiresAt: numberto theEvalResulttype interface.acceptOffer(owner: string, offerId: string): Promise<CreditLine>to the credit data port.Activeline to its in-memory store, so subsequentlistCreditLinesanduseCreditLinescalls return it.Wallet Gate & Owner Binding (
src/pages/RequestEvaluation.tsx):walletIdentityKeyfromsrc/context/WalletContext.tsx.status === 'connected'to start an evaluation and to accept.Server-Based Offer Expiry & Accessibility (
src/pages/RequestEvaluation.tsx):"Offer expires in mm:ss".expiresAttimestamp to prevent clock skew manipulation.aria-live="polite".Double-Submit Guard & Pending / Error UX:
PendingButton./credit-lines?highlight=<lineId>.role="alert"and a "Retry" button, remaining on step 4.Test Verification
All 7 scenarios pass in
src/pages/__tests__/RequestEvaluation.accept.test.tsxandsrc/services/credit/__tests__/credit.test.ts:/open-creditdisables evaluation start with connect prompt.acceptOfferonce, adds line touseCreditLines(), and links step 5 with?highlight=.acceptOfferexactly once.acceptOfferrejects, an alert is rendered, user stays on step 4, and "Retry" re-attempts.acceptOffer.npm run build).Closes #1168