Apply account credit on same-month rebook; show total credit on student page #202

Merged
thatguygriff merged 6 commits from feature/student-credit-display-and-rebook-fix into main 2026-09-17 18:50:44 +00:00
Showing only changes of commit 67017409d7 - Show all commits
+5 -7
View File
@@ -198,13 +198,11 @@ class LessonBooker {
// A scheduled lesson charged at booking — the extra lesson added to (or a
// cancelled one rebooked within) an already-billed month — skips the daily
// scan, which is the only place credit is otherwise applied. Apply the
// payer's account credit here too, so a cancellation credit settles the
// rebooking instead of the family being charged twice for the same slot. A
// pending payment fully covered by credit is settled and its lesson
// confirmed; applyCredits is a no-op when the payer holds no balance. The
// one-time pay-now flow is left alone: its payment step already fronts the
// student, and credit there is a manual studio decision.
// scan, so apply the payer's account credit here too. A cancellation credit
// then settles the rebooking instead of the family being charged twice for
// the same slot. A pending payment fully covered by credit is settled and
// its lesson confirmed; applyCredits is a no-op when the payer holds no
// balance.
if ( $offering->isScheduledBilling() && null !== $payment && null !== $payment->id && Payment::STATUS_PENDING === $payment->status ) {
$this->payments->applyCredits( $payerId, [ $payment ] );
$payment = $this->payments->findPayment( (int) $payment->id ) ?? $payment;