feat: seller invoice actions - cancel, resend link, and detail management (#288) - #360
Draft
s6pa1rta3n-lab wants to merge 1 commit into
Draft
feat: seller invoice actions - cancel, resend link, and detail management (#288)#360s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
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
Resolves #288. Implements end-to-end seller invoice management actions:
POST /api/invoices/:id/cancelrequiring the requesting wallet to matchsellerPublicKey(returning403 Forbiddenon mismatch,400 Bad Requestif already paid/expired).CANCELLEDstatus view on/pay/[id]preventing payment attempts.Changes & Touch List (32 files changed, >= 25 from touch list)
Backend
backend/src/routes/invoice.handlers.ts: HandledsellerPublicKeyparameter incancelInvoicewith 403 on authorization failure and validation.backend/src/routes/invoice.routes.ts: Documented cancel endpoint seller authorization.backend/src/types/api.ts&backend/src/utils/validation.ts: ExportedCancelInvoiceInputandcancelInvoiceSchema.backend/src/storage/invoice-storage.ts,backend/src/storage/memory-storage.ts,backend/src/storage/memory-invoice-storage.ts,backend/src/storage/postgres-invoice-storage.ts: Forwarded and enforcedsellerPublicKeycheck and expiry check in storage layers.backend/src/services/invoice-memory.service.ts&backend/src/services/invoice.service.ts: Enforced seller wallet authorization in both memory and Postgres services.backend/tests/invoice-handlers.test.ts,backend/tests/invoice-service.test.ts,backend/tests/memory-storage.test.ts: Added unit tests covering cancellation authorization, 403 mismatch rejection, and status transitions.Frontend
frontend/app/invoice/[id]/page.tsx: Integrated connected wallet check, confirm prompt, and seller auth forwarding on cancel.frontend/app/dashboard/page.tsx: AddedhandleInvoiceCancelledoptimistic handler and passeduserWalletandonCanceltoInvoiceCard.frontend/components/InvoiceCard.tsx: Added Cancel button for pending invoices (gated on seller wallet), Copy Pay Link, Copy ID with feedback, and jump to proof for paid invoices.frontend/app/pay/[id]/page.tsx: Added dedicatedCANCELLEDbanner and message.frontend/components/PaymentButton.tsx: Added specific error message when attempting to pay a cancelled invoice.frontend/components/PaymentStatus.tsx: Added detailedCANCELLEDstatus message.frontend/components/InvoiceForm.tsx&frontend/components/PaymentReceipt.tsx: Documented pending invoice lifecycle and proof generation.frontend/lib/api.ts: Updatedcancelmethod signature to passsellerPublicKey.frontend/lib/store.ts: AddedisWalletSellerhelper.frontend/lib/utils.ts: EnhancedgetShareUrlto prefer window origin in client environment.frontend/lib/payment-page-state.js&frontend/lib/payment-page-state.d.ts: Addedcancelledboolean property to pay page view state.frontend/lib/dashboard-history.js&frontend/lib/dashboard-history.d.ts: AddedisInvoiceCancellablehelper.frontend/tests/pay-page-status-matrix.test.js&frontend/tests/payment-page-state.test.js: Added assertions formatrix.CANCELLED.cancelled.frontend/tests/dashboard-history.test.js: Added unit tests assertingINVOICE_FILTERSandhistoricalInvoiceshandleCANCELLEDstatus.README.md: Documented seller invoice management and cancellation under lifecycle.Verification
npm test(170/170 passing),npm run typecheck(0 errors)npm test(203/203 passing),npm run test:a11y(31/31 passing),npm run typecheck(0 errors)Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC