Skip to content

Add order calculations JSON fixture for WooCommerce - #1601

Open
reparateur24 wants to merge 1 commit into
Posnic:developfrom
reparateur24:feat/order-calculation-fixtures
Open

reparateur24 wants to merge 1 commit into
Posnic:developfrom
reparateur24:feat/order-calculation-fixtures

Conversation

@reparateur24

Copy link
Copy Markdown

What does this PR do?

Closes #134

Adds synthetic test fixtures under tests/fixtures/woocommerce/order-calculations.json to validate WooCommerce order total calculations:

  • Percentage discount + shipping + tax (SYNTH-WC-ORD-2001)
  • Fixed discount + rounding edge case (SYNTH-WC-ORD-2002)
  • Half-cent rounding boundary with HALF_UP and integer/cent arithmetic (SYNTH-WC-ORD-2003)
  • Rejected / invalid order where a fixed discount exceeds the subtotal (SYNTH-WC-ORD-2004-INVALID)

All data is synthetic and intended solely for test fixtures, with no claim of tax or fiscal compliance.

Acceptance criteria covered

  • Synthetic order calculation fixtures covering discounts, shipping, taxes, and rounding edge cases
  • Exact integer/cent calculation structure avoiding floating-point drift
  • Includes at least one rejected/invalid order case
  • Targeted against develop

How was it tested?

  • Verified JSON syntax and manually checked expected totals and rounding per scenario (SYNTH-WC-ORD-2001 to SYNTH-WC-ORD-2004-INVALID)
  • Automated test runner not executed (fixtures-only contribution added via GitHub web UI)

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you.
Posted by the CLA Assistant Lite bot.

@reparateur24

Copy link
Copy Markdown
Author

I have read the CLA document and i hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Nov 22, 2026

@sridharkalaibala sridharkalaibala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the synthetic fixture and clear integer-cent representation. I fetched 593aae8 and independently checked the arithmetic: all four cases are internally consistent. Before this can close #134, please add (1) distinct line-discount and order-discount coverage, (2) an explicitly tax-inclusive price case, (3) a rejected fixture whose supplied order total does not reconcile (the excessive-discount case is useful but different), and (4) committed automated tests plus a short README documenting calculation order, expected Posnic sale totals and unsupported assumptions. The current JSON alone has no executable regression checks, and all valid examples add tax on top. Please keep the update synthetic/offline and include the exact test command/results.

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.

WooCommerce connector: add tax, discount and shipping mapping fixture

2 participants