Corrigé Invoicing

Fixed skipped invoice numbers and card payments of an old balance

An invoice that could not be saved no longer uses up a number, so your invoice numbers have no gaps. When you record a payment or refund, a Stripe payment page your customer still has open for the old balance stops working, so they cannot pay it twice.

InvoiceService::save() takes the number from InvoiceNumberingService inside the transaction that saves the invoice, so a refused save rolls the counter back. After every committed payment or refund, InvoiceOnlinePaymentService::invoicePaymentsChanged() (an InvoicePaymentListener) expires the invoice's open Checkout Session when its amount is no longer the balance due; a completed Session is left for its payment to be recorded and shown as overpaid. checkoutUrl() reads and replaces the invoice's Session under the invoice's row lock, so two presses of Pay at once never leave two payable Sessions.