No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

PaymentNotifier.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 cagnotte',
  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. }