diff --git a/src/MessageHandler/PaymentOrderDeletedNotificationHandler.php b/src/MessageHandler/PaymentOrderDeletedNotificationHandler.php deleted file mode 100644 index 0d80ed4..0000000 --- a/src/MessageHandler/PaymentOrderDeletedNotificationHandler.php +++ /dev/null @@ -1,79 +0,0 @@ -. - */ - -namespace App\MessageHandler; - -use App\Message\PaymentOrder\PaymentOrderDeletedNotification; -use App\Services\ReplyEmailDecisonMaker; -use Symfony\Bridge\Twig\Mime\TemplatedEmail; -use Symfony\Component\Mailer\MailerInterface; -use Symfony\Component\Messenger\Attribute\AsMessageHandler; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; -use Symfony\Component\Mime\Email; -use Symfony\Contracts\Translation\TranslatorInterface; - -#[AsMessageHandler] -final readonly class PaymentOrderDeletedNotificationHandler -{ - - public function __construct( - private MailerInterface $mailer, - private ReplyEmailDecisonMaker $reply_decision_maker, - private TranslatorInterface $translator - ) - { - } - - public function __invoke(PaymentOrderDeletedNotification $message): void - { - $paymentOrder = $message->getPaymentOrder(); - - $email = new TemplatedEmail(); - $email->priority(Email::PRIORITY_HIGH); - $reply_to_email = $this->reply_decision_maker->getReplyToMailForPaymentOrder($paymentOrder); - $email->replyTo($reply_to_email); - - $email->subject( - $this->translator->trans( - 'payment_order.deletion_email.subject', - [ - '%project%' => $paymentOrder->getProjectName(), - ] - )); - - $email->htmlTemplate('mails/deletion_notification.html.twig'); - $email->context([ - 'payment_order' => $paymentOrder, - 'blame_user' => $message->getBlameUser(), - 'deleted_where' => $message->getDeletedWhere(), - ]); - - //Send the email to the FSR officers and the HHV/FSB - $email_addresses = array_merge( - $paymentOrder->getDepartment()->getEmailHhv(), - $paymentOrder->getDepartment()->getEmailTreasurer(), - [$reply_to_email] - ); - - $email->addBcc(...$email_addresses); - - - //Send email - $this->mailer->send($email); - } -} \ No newline at end of file diff --git a/templates/mails/_payment_order_table.html.twig b/templates/mails/_payment_order_table.html.twig new file mode 100644 index 0000000..96c2e21 --- /dev/null +++ b/templates/mails/_payment_order_table.html.twig @@ -0,0 +1,21 @@ + + + +

+ {% trans %}payment_order.notification_user.department{% endtrans %}: {{ payment_order.department.name }} +

+

+ {% trans %}payment_order.notification_user.project_name{% endtrans %}: {{ payment_order.projectName }} +

+

+ {% trans %}payment_order.notification_user.amount{% endtrans %}: {{ payment_order.amountString }} € +

+

+ {% trans %}payment_order.notification_user.datetime{% endtrans %} {{ payment_order.creationDate | format_datetime }} +

+

+ {% trans %}payment_order.notification_user.id{% endtrans %}: {{ payment_order.iDString }} +

+
+
+
\ No newline at end of file diff --git a/templates/mails/confirmation.html.twig b/templates/mails/confirmation.html.twig index 41f9e2f..a398eaa 100644 --- a/templates/mails/confirmation.html.twig +++ b/templates/mails/confirmation.html.twig @@ -12,27 +12,7 @@

{% trans with {'%fsb_email%': payment_order.department.fsr ? fsb_email : hhv_email} %}payment_order.confirmation_mail.info{% endtrans %}

- - - -

- {% trans %}payment_order.notification_user.department{% endtrans %}: {{ payment_order.department.name }} -

-

- {% trans %}payment_order.notification_user.project_name{% endtrans %}: {{ payment_order.projectName }} -

-

- {% trans %}payment_order.notification_user.amount{% endtrans %}: {{ payment_order.amountString }} € -

-

- {% trans %}payment_order.notification_user.datetime{% endtrans %} {{ payment_order.creationDate | format_datetime }} -

-

- {% trans %}payment_order.notification_user.id{% endtrans %}: {{ payment_order.iDString }} -

-
-
-
+ {% include "mails/_payment_order_table.html.twig" %}

{% trans %}payment_order.confirmation_email.vpn_hint{% endtrans %}

diff --git a/templates/mails/deletion_notification.html.twig b/templates/mails/deletion_notification.html.twig index f4b05ea..465266e 100644 --- a/templates/mails/deletion_notification.html.twig +++ b/templates/mails/deletion_notification.html.twig @@ -9,32 +9,11 @@

{% trans with {'%fsb_email%': payment_order.department.fsr ? fsb_email : hhv_email} %}payment_order.deletion_email.info{% endtrans %}

- - - -

- {% trans %}payment_order.notification_user.department{% endtrans %}: {{ payment_order.department.name }} -

-

- {% trans %}payment_order.notification_user.project_name{% endtrans %}: {{ payment_order.projectName }} -

-

- {% trans %}payment_order.notification_user.amount{% endtrans %}: {{ payment_order.amountString }} € -

-

- {% trans %}payment_order.notification_user.datetime{% endtrans %} {{ payment_order.creationDate | format_datetime }} -

-

- {% trans %}payment_order.notification_user.id{% endtrans %}: {{ payment_order.iDString }} -

- {% if deleted_where == "backend" %} -

- {% trans %}payment_order.notification_deletion.blame_user{% endtrans %}: {{ blame_user }} [StuRa] -

- {% endif %} -
-
-
+ {% if deleted_where == "backend" %} +

Der Zahlungsauftrag wurde durch eine*n StuRa-Finanzer*in ({{ blame_user }}) gelöscht.

+ {% endif %} + + {% include "mails/_payment_order_table.html.twig" %}
diff --git a/templates/mails/manual_confirmation.html.twig b/templates/mails/manual_confirmation.html.twig index 8aa5475..9f9cb6c 100644 --- a/templates/mails/manual_confirmation.html.twig +++ b/templates/mails/manual_confirmation.html.twig @@ -19,27 +19,7 @@

- - - -

- {% trans %}payment_order.notification_user.department{% endtrans %}: {{ payment_order.department.name }} -

-

- {% trans %}payment_order.notification_user.project_name{% endtrans %}: {{ payment_order.projectName }} -

-

- {% trans %}payment_order.notification_user.amount{% endtrans %}: {{ payment_order.amountString }} € -

-

- {% trans %}payment_order.notification_user.datetime{% endtrans %} {{ payment_order.creationDate | format_datetime }} -

-

- {% trans %}payment_order.notification_user.id{% endtrans %}: {{ payment_order.iDString}} -

-
-
-
+ {% include "mails/_payment_order_table.html.twig" %}
diff --git a/templates/mails/user_notification.html.twig b/templates/mails/user_notification.html.twig index 6760e05..6a93458 100644 --- a/templates/mails/user_notification.html.twig +++ b/templates/mails/user_notification.html.twig @@ -9,27 +9,7 @@

{% trans with {'%fsb_email%': payment_order.department.fsr ? fsb_email : hhv_email } %}payment_order.notification_user.info{% endtrans %}

- - - -

- {% trans %}payment_order.notification_user.department{% endtrans %}: {{ payment_order.department.name }} -

-

- {% trans %}payment_order.notification_user.project_name{% endtrans %}: {{ payment_order.projectName }} -

-

- {% trans %}payment_order.notification_user.amount{% endtrans %}: {{ payment_order.amountString }} € -

-

- {% trans %}payment_order.notification_user.datetime{% endtrans %} {{ payment_order.creationDate | format_datetime }} -

-

- {% trans %}payment_order.notification_user.id{% endtrans %}: {{ payment_order.iDString}} -

-
-
-
+ {% include "mails/_payment_order_table.html.twig" %}

{% trans with {'%fsb_email%': payment_order.department.fsr ? fsb_email : hhv_email } %}payment_order.notification_user.why{% endtrans %}