Skip to content

fix(core): reconcile order line refunded quantity - #2710

Open
tazzytazzy wants to merge 1 commit into
lunarphp:2.xfrom
tazzytazzy:fix/order-line-refunded-quantity
Open

fix(core): reconcile order line refunded quantity#2710
tazzytazzy wants to merge 1 commit into
lunarphp:2.xfrom
tazzytazzy:fix/order-line-refunded-quantity

Conversation

@tazzytazzy

Copy link
Copy Markdown
Contributor

Summary

Fixes #2709.

Adds a guarded core migration to reconcile
order_lines.refunded_quantity on existing Lunar 2.x databases.

The line-item refund work added this column to the order-lines create-table
baseline. Databases that had already recorded that migration did not rerun it,
so they could receive refund_lines while still lacking the rollup column.

When those databases processed a line-item refund, Lunar could complete the
payment driver's refund call and then fail while persisting the line allocation
because RefundOrder increments the missing column.

Changes

  • adds a prefix-aware reconciliation migration after refund_lines;
  • safely no-ops when the table is absent or the column already exists;
  • adds an unsigned refunded_quantity column with a default of 0;
  • preserves existing order-line records;
  • uses a non-destructive rollback because the flat baseline owns the column.

Tests

  • verifies the column is added and existing rows default to zero;
  • verifies repeated execution is safe;
  • verifies already-current and missing-table schemas are no-ops;
  • verifies core migrations still roll back and re-apply;
  • verifies existing line-item refund behavior remains green.

Scope

This PR is limited to Lunar's provider-independent schema reconciliation. It
does not change provider behavior, refund transaction boundaries, ledger
attribution, replay semantics, RefundRequest, or historical allocation data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant