Skip to content

Commit

Permalink
DON-998 - make batch limit a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorota Hawro committed Jan 3, 2025
1 parent 913327a commit 06be75c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Application/Commands/TakeRegularGivingDonations.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
)]
class TakeRegularGivingDonations extends LockingCommand
{
private const int MAXBATCHSIZE = 20;
private ?RegularGivingService $mandateService = null;
private int $limit = 20;


/** @psalm-suppress PossiblyUnusedMethod - called by PHP-DI */
public function __construct(
Expand Down Expand Up @@ -91,7 +92,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in

private function createNewDonationsAccordingToRegularGivingMandates(\DateTimeImmutable $now, SymfonyStyle $io): void
{
$mandates = $this->mandateRepository->findMandatesWithDonationsToCreateOn($now, $this->limit);
$mandates = $this->mandateRepository->findMandatesWithDonationsToCreateOn($now, self::MAXBATCHSIZE);

$io->block(count($mandates) . " mandates may have donations to create at this time");

Expand All @@ -108,7 +109,7 @@ private function setPaymentIntentWhenReachedPaymentDate(
\DateTimeImmutable $now,
SymfonyStyle $io
): void {
$donations = $this->donationRepository->findDonationsToSetPaymentIntent($now, $this->limit);
$donations = $this->donationRepository->findDonationsToSetPaymentIntent($now, self::MAXBATCHSIZE);
$io->block(count($donations) . " donations are due to have Payment Intent set at this time");

foreach ($donations as $donation) {
Expand All @@ -127,7 +128,7 @@ private function confirmPreCreatedDonationsThatHaveReachedPaymentDate(
- Ensure we don't send emails that are meant for confirmation of on-session donations
- Probably other things.
*/
$donations = $this->donationRepository->findPreAuthorizedDonationsReadyToConfirm($now, limit:20);
$donations = $this->donationRepository->findPreAuthorizedDonationsReadyToConfirm($now, self::MAXBATCHSIZE);

$io->block(count($donations) . " donations are due to be confirmed at this time");

Expand Down

0 comments on commit 06be75c

Please sign in to comment.