Skip to content

Contracts: refund and restore transitions for PayPal refund auto-detect - #109

Merged
BitcoinErrorLog merged 4 commits into
release/shop-v0.6.8from
cursor/shop-refund-edges-95c1
Sep 24, 2026
Merged

BitcoinErrorLog merged 4 commits into
release/shop-v0.6.8from
cursor/shop-refund-edges-95c1

Conversation

@BitcoinErrorLog

Copy link
Copy Markdown
Owner

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-service cursor/paypal-refund-ipn-95c1. This branch keeps the Shop's contract tables in step with it.

  • src/libs/commerce/contracts/state-machines.json gains only the paypal_refund and paypal_reversal_cancelled transitions, copied verbatim from the service artifact at 4ba877cd:
    • order: paid | ready_for_pickup | shipped | delivered | completed | return_received | cancel_requested | cancelled | return_requested | return_approved → refunded_external, and back from refunded_external to each of those states;
    • return: requested | approved | received → refunded, and back.
  • The orderTransitions and returnTransitions client tables mirror those edges. They have no runtime importers besides the contract tests, so no UI action changes.
  • The hash pin in contracts.contract.test.ts moves to the patched file, with a comment that says what it contains.

The vendored file was already behind service main in ways unrelated to refunds: the offer converted state, accepted → converted/expired, offer.checkout, and the payment late_completion edges. A full re-vendor changes how offers parse, so it is left for a separate change.

Proof

PREPUSH OK 520ba15c6212afd2ef9ac1c4d69e89fe6b99f2d8 38

Before the client tables changed, state-machines.contract.test.ts failed on exactly the missing refund edges. Afterwards src/libs/commerce passes: 31 files, 575 tests. No .tsx changed, so there is no VRT scene.

Not in this branch

  • Copy for the payment_reversal_cancelled notification. The Shop quarantines unknown notification types per row until it has copy.
  • Display of paymentReversedAt, paymentReversalCancelledAt, gatewayRefundReviewAt, and gatewayRefundUnmatched. The order schema is .passthrough(), so these keys are harmless today.

Head: 520ba15c6212afd2ef9ac1c4d69e89fe6b99f2d8 on cursor/shop-refund-edges-95c1. Base: release/shop-v0.6.8.

…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.
@BitcoinErrorLog
BitcoinErrorLog merged commit 193e476 into release/shop-v0.6.8 Sep 24, 2026
13 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.

1 participant