-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDonationFundsNotifier.php
More file actions
40 lines (35 loc) · 1.38 KB
/
DonationFundsNotifier.php
File metadata and controls
40 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace MatchBot\Domain;
use MatchBot\Application\Assertion;
use MatchBot\Client\Mailer;
class DonationFundsNotifier
{
public function __construct(private Mailer $mailer)
{
}
/**
* Although we take the new balance as a param here since we thought it might be useful in development of this, we
* don't actually do anything with that new balance. This is because we know that in many cases the balance will be
* changing at almost exactly the same time that this email is generated, so the balance would be confusingly
* outdated by the time the recipient got to read it.
*
* If they want to know their balance, they can look at "My Account" on the site.
*/
public function notifyRecieptOfAccountFunds(
DonorAccount $donorAccount,
Money $transferAmount,
Money $_newBalance,
): void {
$donorName = $donorAccount->donorName;
/** @psalm-suppress DeprecatedMethod - method was deprecated after this was written. */
$this->mailer->sendEmail([
'templateKey' => 'donor-funds-thanks',
'recipientEmailAddress' => $donorAccount->emailAddress->email,
'params' => [
'donorFirstName' => $donorName->first,
'donorLastName' => $donorName->last,
'transferAmount' => $transferAmount->format(),
],
]);
}
}