Drop stale comment about not applying credit at booking
CI / Coding Standards (pull_request) Successful in 29s
CI / Tests (PHP 8.1) (pull_request) Successful in 36s
CI / No Debug Code (pull_request) Successful in 11s
CI / Tests (PHP 8.5) (pull_request) Successful in 36s
CI / Static Analysis (pull_request) Successful in 41s
CI / Tests (PHP 8.2) (pull_request) Successful in 43s
CI / Tests (PHP 8.3) (pull_request) Successful in 43s
CI / Build Plugin Zip (pull_request) Skipped

This change applies credit at booking for scheduled rebooks, so the note
saying the pay-now flow deliberately does not was contradictory.

Co-authored-by: anthropic/claude-opus-4-8
This commit is contained in:
2026-09-17 15:42:38 -03:00
co-authored by anthropic/claude-opus-4-8
parent e7de627752
commit 67017409d7
+5 -7
View File
@@ -198,13 +198,11 @@ class LessonBooker {
// A scheduled lesson charged at booking — the extra lesson added to (or a // A scheduled lesson charged at booking — the extra lesson added to (or a
// cancelled one rebooked within) an already-billed month — skips the daily // cancelled one rebooked within) an already-billed month — skips the daily
// scan, which is the only place credit is otherwise applied. Apply the // scan, so apply the payer's account credit here too. A cancellation credit
// payer's account credit here too, so a cancellation credit settles the // then settles the rebooking instead of the family being charged twice for
// rebooking instead of the family being charged twice for the same slot. A // the same slot. A pending payment fully covered by credit is settled and
// pending payment fully covered by credit is settled and its lesson // its lesson confirmed; applyCredits is a no-op when the payer holds no
// confirmed; applyCredits is a no-op when the payer holds no balance. The // balance.
// one-time pay-now flow is left alone: its payment step already fronts the
// student, and credit there is a manual studio decision.
if ( $offering->isScheduledBilling() && null !== $payment && null !== $payment->id && Payment::STATUS_PENDING === $payment->status ) { if ( $offering->isScheduledBilling() && null !== $payment && null !== $payment->id && Payment::STATUS_PENDING === $payment->status ) {
$this->payments->applyCredits( $payerId, [ $payment ] ); $this->payments->applyCredits( $payerId, [ $payment ] );
$payment = $this->payments->findPayment( (int) $payment->id ) ?? $payment; $payment = $this->payments->findPayment( (int) $payment->id ) ?? $payment;