fix(pos): clamp payment amount to total + allow 1c tolerance for rounding
This commit is contained in:
@@ -1906,15 +1906,17 @@ export default function RegisterPage() {
|
||||
key={method.id}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
// POS-SELFPAY-FLOW: no partial payments — directly add full payment and confirm
|
||||
// POS-SELFPAY-FLOW: no partial payments — directly add full payment and confirm.
|
||||
// Clamp to totals.total to avoid 1-cent rounding mismatches with the backend.
|
||||
setShowSelfpayPaymentMethods(false);
|
||||
const amountCents = Math.min(remainingCents, totals.total);
|
||||
const allocation: PaymentAllocation = {
|
||||
id: generateIdempotencyKey(),
|
||||
methodCode: method.code,
|
||||
methodLabel: method.label,
|
||||
kind: method.kind,
|
||||
amountCents: remainingCents,
|
||||
...(method.kind === 'cash' ? { tenderedCents: remainingCents } : {}),
|
||||
amountCents,
|
||||
...(method.kind === 'cash' ? { tenderedCents: amountCents } : {}),
|
||||
changeCents: 0,
|
||||
};
|
||||
void confirmSaleWith([allocation]);
|
||||
|
||||
Reference in New Issue
Block a user