Merge pull request 'Charge weekly reservations for every claimed occurrence and confirm the whole series' (#81) from fix/recurring-payment-amount into main
CI / Tests (PHP 8.1) (push) Successful in 38s
CI / Coding Standards (push) Successful in 2m47s
CI / Tests (PHP 8.2) (push) Successful in 43s
CI / No Debug Code (push) Successful in 3s
CI / Tests (PHP 8.3) (push) Successful in 2m39s
CI / PHPStan (push) Successful in 2m51s
CI / Build Plugin Zip (push) Successful in 2m43s
CI / Tests (PHP 8.1) (push) Successful in 38s
CI / Coding Standards (push) Successful in 2m47s
CI / Tests (PHP 8.2) (push) Successful in 43s
CI / No Debug Code (push) Successful in 3s
CI / Tests (PHP 8.3) (push) Successful in 2m39s
CI / PHPStan (push) Successful in 2m51s
CI / Build Plugin Zip (push) Successful in 2m43s
Reviewed-on: #81
This commit was merged in pull request #81.
This commit is contained in:
@@ -195,10 +195,20 @@ class PaymentService {
|
||||
}
|
||||
|
||||
private function confirmRegistration( string $type, int $registrationId ): void {
|
||||
if ( Payment::REG_LESSON === $type ) {
|
||||
$this->bookings->updateStatus( $registrationId, Lesson::STATUS_CONFIRMED );
|
||||
if ( Payment::REG_LESSON !== $type ) {
|
||||
// Group enrolments are already `active`; no status change on payment.
|
||||
return;
|
||||
}
|
||||
// Group enrolments are already `active`; no status change on payment.
|
||||
|
||||
// A weekly reservation's payment is linked to its anchor lesson but pays
|
||||
// for the whole series, so settling it confirms every lesson in the series.
|
||||
$lesson = $this->bookings->findById( $registrationId );
|
||||
if ( null !== $lesson && null !== $lesson->seriesId ) {
|
||||
$this->bookings->updateStatusForSeries( $lesson->seriesId, Lesson::STATUS_CONFIRMED );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->bookings->updateStatus( $registrationId, Lesson::STATUS_CONFIRMED );
|
||||
}
|
||||
|
||||
private function linkPayment( string $type, int $registrationId, int $paymentId ): void {
|
||||
|
||||
Reference in New Issue
Block a user