Contracts: refund and restore transitions for PayPal refund auto-detect - #109
Merged
BitcoinErrorLog merged 4 commits intoSep 24, 2026
Merged
Conversation
…edges The service records verified PayPal refunds from every state holding a confirmed payment (paypal_refund -> refunded_external) and returns the order to the replaced state when PayPal cancels a reversal (paypal_reversal_cancelled). Vendor only those transitions and mirror them in the client order and return tables.
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.
Commerce: vendor the PayPal refund and reversal-cancelled order edges
Summary
The marketplace service records verified PayPal refunds on the order by itself:
BitcoinErrorLog/pubky-marketplace-servicecursor/paypal-refund-ipn-95c1. This branch keeps the Shop's contract tables in step with it.src/libs/commerce/contracts/state-machines.jsongains only thepaypal_refundandpaypal_reversal_cancelledtransitions, copied verbatim from the service artifact at4ba877cd:paid | ready_for_pickup | shipped | delivered | completed | return_received | cancel_requested | cancelled | return_requested | return_approved → refunded_external, and back fromrefunded_externalto each of those states;requested | approved | received → refunded, and back.orderTransitionsandreturnTransitionsclient tables mirror those edges. They have no runtime importers besides the contract tests, so no UI action changes.contracts.contract.test.tsmoves to the patched file, with a comment that says what it contains.The vendored file was already behind service
mainin ways unrelated to refunds: the offerconvertedstate,accepted → converted/expired,offer.checkout, and the paymentlate_completionedges. A full re-vendor changes how offers parse, so it is left for a separate change.Proof
PREPUSH OK 520ba15c6212afd2ef9ac1c4d69e89fe6b99f2d8 38Before the client tables changed,
state-machines.contract.test.tsfailed on exactly the missing refund edges. Afterwardssrc/libs/commercepasses: 31 files, 575 tests. No.tsxchanged, so there is no VRT scene.Not in this branch
payment_reversal_cancellednotification. The Shop quarantines unknown notification types per row until it has copy.paymentReversedAt,paymentReversalCancelledAt,gatewayRefundReviewAt, andgatewayRefundUnmatched. The order schema is.passthrough(), so these keys are harmless today.Head:
520ba15c6212afd2ef9ac1c4d69e89fe6b99f2d8oncursor/shop-refund-edges-95c1. Base:release/shop-v0.6.8.