You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 satır
1.1KB

  1. <?php
  2. namespace domain\Payment;
  3. use domain\User\User\User;
  4. use domain\User\User\UserRepository;
  5. use domain\_\AbstractNotifier;
  6. class PaymentNotifier extends AbstractNotifier
  7. {
  8. protected UserRepository $userRepository;
  9. public function loadDependencies(): void
  10. {
  11. parent::loadDependencies();
  12. $this->userRepository = $this->loadService(UserRepository::class);
  13. }
  14. public function notifyUserCreditMovement(User $user, string $type, float $amount)
  15. {
  16. if($user->email) {
  17. $producer = $this->getProducerContext();
  18. $credit = $this->userRepository->getCredit($user, true);
  19. $this->mailer->sendFromProducer(
  20. 'Mouvement de crédit',
  21. 'creditUser',
  22. [
  23. 'user' => $user,
  24. 'producer' => $producer,
  25. 'credit' => $credit,
  26. 'type' => $type,
  27. 'amount' => $amount
  28. ],
  29. $user->email,
  30. $producer
  31. );
  32. return true;
  33. }
  34. return false;
  35. }
  36. }