Repository navigation
0.2.0
0.2.0 — Settlement policy
The decision whether a delivered amount pays for a quote now lives in the core, so every
LedgerDirect plugin calls an order paid under exactly the same conditions. Until now each
plugin decided on its own (Shopware in its payment handlers, Magento in a local AmountCheck).
Added
Core\Payment\SettlementPolicyisSettled(PaymentIntent): bool- Native asset (XRP):
amount_paid >= amount_requested × (1 − tolerance). Default tolerance
0.0015(0.15 %) — the quote is a float rounded to five places and wallets may shave
rounding on their side. Platforms may pass their own tolerance. - Issued currency (RLUSD, USDC, merchant tokens):
currencyandissuermust equal the
quoted ones andvalue >= requested value, compared as exact decimals, no tolerance.
A same-named token from another issuer never settles the order. - Overpayment settles; a
PaymentIntentwithoutamount_paidnever does.
- Native asset (XRP):
shortfall(PaymentIntent): ?string— what is still due as a plain decimal string:null
once settled, the full amount while nothing has arrived, and the full amount for a payment
in the wrong token (it does not count against the request). Meant for "X of Y received"
on a payment page.
PaymentIntent::amountRequestedValue()/amountPaidValue()— the plain decimal behind
either amount shape (float for the native asset,IssuedCurrencyAmountotherwise), without
trailing zeros or exponent notation.INVARIANTS.md, section "Settlement" — the rules above, and the line between the core
(the decision) and the platform adapter (invoice, order status, emails).
Notes
- Additive only; no existing behaviour changed.
- Decimal rendering deliberately avoids
BigDecimal::stripTrailingZeros(): brick/math renamed
it tostrippedOfTrailingZeros()within the range this package supports (^0.12 … ^0.20). - CI: PHP 8.2 / 8.3 / 8.4 and the lowest-dependencies job (brick/math 0.12) — green.
Upgrading
No changes required.