Skip to content

Commit

Permalink
DON-998 - additional query constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorota Hawro committed Jan 3, 2025
1 parent f8f1ad7 commit ea92c8a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Domain/DoctrineDonationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,12 @@ public function findDonationsToSetPaymentIntent(\DateTimeImmutable $atDateTime,
SELECT donation from Matchbot\Domain\Donation donation JOIN donation.mandate mandate
WHERE donation.donationStatus = '$preAuthorized'
AND donation.transactionId = null
AND donation.preAuthorizationDate <= $atDateTime
AND donation.preAuthorizationDate < 'atDateTime'
AND mandate.status = '$active'
AND mandate.dayOfMonth.value = '$dayOfMonthToday'
// @todo-regular-giving: add constraint on late donation collections
DQL
);

$query->setParameter('atDateTime', $atDateTime);
$query->setMaxResults($maxBatchSize);

/** @var list<Donation> $result */
Expand All @@ -776,11 +776,12 @@ public function findPreAuthorizedDonationsReadyToConfirm(\DateTimeImmutable $atD
SELECT donation from Matchbot\Domain\Donation donation JOIN donation.mandate mandate
WHERE donation.donationStatus = '$preAuthorized'
AND mandate.status = '$active'
AND donation.preAuthorizationDate <= :now
AND donation.transactionId != null
AND donation.preAuthorizationDate <= :atDateTime
DQL
);

$query->setParameter('now', $atDateTime);
$query->setParameter('atDateTime', $atDateTime);
$query->setMaxResults($limit);

/** @var list<Donation> $result */
Expand Down

0 comments on commit ea92c8a

Please sign in to comment.