Skip to content

BTI-971: match refund by amount for partial REST API line items#473

Merged
vildanbina merged 2 commits into
developfrom
fix/BTI-971-riverty-partial-refund-rest-api
May 20, 2026
Merged

BTI-971: match refund by amount for partial REST API line items#473
vildanbina merged 2 commits into
developfrom
fix/BTI-971-riverty-partial-refund-rest-api

Conversation

@vildanbina
Copy link
Copy Markdown
Collaborator

@vildanbina vildanbina commented May 20, 2026

  • REST API refunds don't populate $_POST; admin UI does. Read line items from the order's refund instead.
  • Match the refund just created by wc_create_refund by amount (1¢ tolerance).
  • HPOS doesn't guarantee get_refunds() order — pick max ID when amounts tie.
  • Skip refund rows with no _refunded_item_id or zero qty.
  • Normalize WC's negative qty/total to positive for the gateway payload.
  • Tests: 15 cases in Test_AbstractPaymentGateway_RefundLineItems.

@vildanbina vildanbina merged commit f8a09e6 into develop May 20, 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.

2 participants