Payments Validator
Validates that payment amounts on the cart match the order total.
Overview
The Payments Validator ensures that the cart has valid payments and that the total amount paid matches the order total exactly. It checks for missing payments, underpayment, and overpayment.
Identifier
| Property | Value |
|---|---|
| Connector ID | paymentsValidator |
| Validation Type | Payment |
Behavior
- If no payments exist on the cart, returns a "No payments selected" error
- If any payment has a
StaticPaymentTypeproperty, validation passes (static payment types are handled separately) - Filters to active payments only
- If no active payments remain, returns a "No payments selected" error
- Calculates the total paid amount:
- Uses
AuthorizedAmount - CreditedAmountfor each payment - Falls back to
InvoicedAmountif the authorized amount minus credits is zero or negative
- Uses
- Compares total paid to the order total:
- If total paid is less than the order total, returns a "Not enough payments" error
- If total paid is greater than the order total, returns a "Too much paid" error
- If they match exactly, validation passes
Error messages
| Condition | Translation Key |
|---|---|
| No payments on cart | NoPaymentsSelected |
| No active payments | NoPaymentsSelected |
| Total paid is less than order total | NotEnoughPayments |
| Total paid exceeds order total | TooMuchPaid |
Configuration
No additional properties required.
