Skip to content

feat(core): make split refunds explicit - #112

Closed
alexasomba wants to merge 8 commits into
emdashCommerce:mainfrom
alexasomba:feat/provider-split-refunds
Closed

alexasomba wants to merge 8 commits into
emdashCommerce:mainfrom
alexasomba:feat/provider-split-refunds

Conversation

@alexasomba

Copy link
Copy Markdown

Part of the Flutterwave follow-up in #97. Stacked on #105 (split settlement); merge after it.

Why

A split payment cannot always be refunded through the provider from DashCommerce. Flutterwave answers a split refund with 400 "Refund request successfully logged" and no refund id, so the order cannot be marked refunded. Stripe Connect refunds do work, but the money comes from the platform balance and vendor shares are not clawed back.

Today the admin refund panel does not say either of those things. This makes the limit explicit and stops the provider call when it cannot work.

What

  • PaymentProviderCapabilities.splitRefunds: optional. Missing means yes (existing Stripe behaviour). false means the provider cannot refund a split charge.
  • refundOrder checks it when order.providerSplits is present and refuses before loading credentials or calling the provider:
    "<Provider> cannot refund split payments from DashCommerce. Refund this order in the <Provider> dashboard."
  • Order detail → Split settlement gains a warning: the refund comes from the platform balance, vendor shares are not recovered automatically, and a provider that cannot refund splits must be handled in its dashboard.
  • The Flutterwave package will declare splitRefunds: false in feat(flutterwave): Flutterwave payment provider package #107.

Tests

  • 2 new tests: a provider declaring splitRefunds: false is refused before the call and writes no refund row; a provider that does not declare it keeps the existing behaviour and refunds.
  • 349 core tests pass on the feat(core): split settlement and refunds #105 branch, 0 failures.
  • Typecheck clean.
  • Changeset: minor.

Notes

  • This is intentionally a refusal, not a warning-and-continue. A failed provider call leaves no refund row but does confuse the operator; the message tells them where to go.
  • Stripe Connect stays allowed because its refunds succeed, even though the vendor-share caveat remains.

createVendor stored stripeAccountId: "" and the field has a unique
index, so the second vendor failed. The field is now optional and
omitted when there is no Stripe account; a missing field is NULL.

Also documents the coupon rule for split allocations (the platform
absorbs a cart-wide discount; a larger one is a 409) and makes the
allocation comments generic for Paystack.
@alexasomba

Copy link
Copy Markdown
Author

Folded into #105. No review had started, so the split-refund guard now ships with split settlement.

@alexasomba alexasomba closed this Nov 25, 2026
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