|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace domain\Payment;
-
- use domain\User\User\User;
- use domain\User\User\UserRepository;
- use domain\_\AbstractNotifier;
-
- class PaymentNotifier extends AbstractNotifier
- {
- protected UserRepository $userRepository;
-
- public function loadDependencies(): void
- {
- parent::loadDependencies();
- $this->userRepository = $this->loadService(UserRepository::class);
- }
-
- public function notifyUserCreditMovement(User $user, string $type, float $amount)
- {
- if($user->email) {
- $producer = $this->getProducerContext();
- $credit = $this->userRepository->getCredit($user, true);
-
- $this->mailer->sendFromProducer(
- 'Mouvement de crédit',
- 'creditUser',
- [
- 'user' => $user,
- 'producer' => $producer,
- 'credit' => $credit,
- 'type' => $type,
- 'amount' => $amount
- ],
- $user->email,
- $producer
- );
-
- return true;
- }
-
- return false;
- }
- }
|