Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

38 lines
1.0KB

  1. <?php
  2. namespace common\logic\Payment\Service;
  3. use common\logic\AbstractNotifier;
  4. use common\logic\User\User\Model\User;
  5. use common\logic\User\User\Repository\UserRepository;
  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. $producer = $this->getProducerContext();
  17. $credit = $this->userRepository->getCredit($user, true);
  18. $this->mailer->sendFromProducer(
  19. 'Mouvement de crédit',
  20. 'creditUser',
  21. [
  22. 'user' => $user,
  23. 'producer' => $producer,
  24. 'credit' => $credit,
  25. 'type' => $type,
  26. 'amount' => $amount
  27. ],
  28. $user->email,
  29. $producer
  30. );
  31. }
  32. }