woocommerce-paypal-payments/tests/PHPUnit/ApiClient
Moritz Meißelbach 872a9451c0
Fix PayPal amount mismatch from inclusive-tax rounding
Use WooCommerce's get_total() as the authoritative order amount
instead of deriving it from breakdown components. When the two
values differ by a rounding delta (typically ±1 cent from
inclusive-tax calculations), absorb the difference into the tax
breakdown component so PayPal's invariant — amount.value ===
sum(breakdown) — continues to hold.

Without this fix, PayPal would capture a component-derived total
that could differ from the WooCommerce order total by one cent,
causing full refunds to be rejected with REFUND_AMOUNT_EXCEEDED.

Add regression tests covering:
- Zero delta (components already match get_total)
- ±1 cent delta (the inclusive-tax rounding case)
- Parametrised invariant suite across discounts and fees
2026-06-04 13:07:12 +02:00
..
Authentication Retry token request on network error 2026-06-01 14:35:03 +03:00
Endpoint Skip redundant capture call for auto-captured vaulted ACDC orders 2026-05-18 14:53:12 +02:00
Entity Add tests 2026-06-01 14:35:03 +03:00
Exception Add test for PayPal api exception friendly message 2024-04-18 11:42:40 +02:00
Factory Fix PayPal amount mismatch from inclusive-tax rounding 2026-06-04 13:07:12 +02:00
Helper ♻️ Remove redundant ReferenceTransactionStatus cache and rely on cached seller status 2026-04-28 13:56:00 +02:00
Repository Merge pull request #3431 from woocommerce/PCP-4655-experience-context 2025-06-02 11:46:43 +02:00