Correction. The first version of this issue claimed a charge-mode security deposit is captured as its own payment and never returned when the order is refunded. That is wrong. There is no separate payment for it: PaymentPolicy::amountDueNow() adds the caution to the amount collected at checkout when the mode is charge, so the money sits inside the checkout payment, which refundablePayments() does select. Refunding an order does return it. AuthorizeDepositAction is the only thing that creates a deposit payment, and it authorizes the authorize-mode total alone.
What is actually missing is the other direction: there is no way to return a charge-mode caution without refunding the booking. That is the ordinary end of a rental - give back the 150,00 guarantee, keep the 20,00 rent - and nothing expresses it. Authorize mode has "Release deposit", which voids a hold and leaves the price alone. Charge mode has no counterpart, because the money is inside the checkout payment and PaymentManager::refund() takes no amount: refunds are all-or-nothing.
So today a site that charges its deposits can only return one by refunding the whole booking, price included, and then collecting the price again by hand.
Proposal: collect the caution as its own payment at checkout instead of folding it into the checkout amount. Returning it is then a full refund of that one payment, the price is untouched, and the deposit is visible as a deposit in reporting rather than hidden inside a larger figure. It also makes the charge and authorize modes symmetric: both end with something that can be released or returned on its own.
The alternative, partial refunds in kessai, is a bigger cross-project change and still leaves the caution invisible as a distinct amount.
Once the caution is its own payment, refundablePayments() has to decide whether a refund of the booking also returns it. It should: the guarantee ends when the booking does. Related vocabulary work in #3614440: Rename the deposit vocabulary to guarantee, and let one guarantee cover the deposit and the no-show fee.
Issue fork yoyaku-3614435
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedComment #4
mably commentedComment #6
mably commented