|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace common\logic\Payment\Service;
-
- use common\logic\AbstractNotifier;
- use common\logic\User\User\Model\User;
- use common\logic\User\User\Repository\UserRepository;
-
- 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;
- }
- }
|