Skip to content

Commit

Permalink
Add year as property for email templates (#507)
Browse files Browse the repository at this point in the history
* Add year property to email templates

* Add year property to property file

* Add missing space between 'Hi' and name in order confirmation

(cherry picked from commit 9487bce)
  • Loading branch information
timovanasten committed Feb 12, 2019
1 parent 79e9ce3 commit 8895eb3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public class MailServiceImpl implements MailService {
@Value("${a5l.mail.contact}")
String contact;

@Value("${a5l.mail.year}")
String year;

@Autowired
public MailServiceImpl(JavaMailSender mailSender, SpringTemplateEngine templateEngine) {
this.mailSender = mailSender;
Expand Down Expand Up @@ -110,6 +113,7 @@ private String prepareHtmlContent(String name, String message) {
final Context ctx = new Context(new Locale("en"));
ctx.setVariable("name", name);
ctx.setVariable("message", message);
ctx.setVariable("year", year);
return this.templateEngine.process("mailTemplate", ctx);
}

Expand Down Expand Up @@ -156,6 +160,7 @@ public void sendOrderConfirmation(Order order) {
ctx.setVariable("name",
order.getUser().getProfile().getFirstName() + " " + order.getUser().getProfile().getLastName());
ctx.setVariable("order", order);
ctx.setVariable("year", year);
String content = this.templateEngine.process("orderConfirmation", ctx);

sendMailWithContent(order.getUser().getEmail(), "Order Confirmation", content);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ a5l:
sender: LANcie <[email protected]>
contact: LANcie <[email protected]>
confirmUrl: https://localhost:5100/register-confirm
year: 2019

orderLimit: 5
ticketLimit: 200
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ a5l:
sender: LANcie <[email protected]>
contact: LANcie <[email protected]>
confirmUrl: https://areafiftylan.nl/register-confirm
year: 2019

orderLimit: 15
ticketLimit: 220
Expand Down
11 changes: 6 additions & 5 deletions src/main/resources/config/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ a5l:
resetUrl: https://areafiftylan.nl/password-reset
acceptTransferUrl: https://areafiftylan.nl/transfer-accept

mail:
sender: LANcie <[email protected]>
contact: LANcie <[email protected]>
confirmUrl: https://areafiftylan.nl/register-confirm
mail:
sender: LANcie <[email protected]>
contact: LANcie <[email protected]>
confirmUrl: https://areafiftylan.nl/register-confirm
year: 2019

orderLimit: 5
orderLimit: 15
ticketLimit: 200
2 changes: 1 addition & 1 deletion src/main/resources/templates/mailTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div style="background-color: white; padding: 32px;">
<p>Hi<span th:text="${name}"></span>!</p>
<p th:utext="${message}">Message</p>
<p>Best Regards,<br />LANcie 2018</p>
<p>Best Regards,<br />LANcie <span th:text="${year}"></span></p>
</div>
</div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/orderConfirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
</div>
</div>
<div style="background-color: white; padding: 32px;">
<p>Hi<span th:text="${name}"></span>!</p>
<p>You have successfully ordered tickets for AreaFiftyLAN 2018. We are looking forward to seeing you there!</p>
<p>Hi <span th:text="${name}"></span>!</p>
<p>You have successfully ordered tickets for AreaFiftyLAN <span th:text="${year}"></span>. We are looking forward to seeing you there!</p>
<p>Order ID: <span th:text="${order.getId()}">#reference</span></p>
<div style="background-color: white; margin: 0 auto; border-top: 1px solid #e8e8e8;">
<div style="display: flex; padding: 16px 8px; border-bottom: 1px solid #e8e8e8; background-color: #EEECED; font-weight: 600;">
Expand All @@ -50,7 +50,7 @@
<span th:text="${'&euro;' + #numbers.formatDecimal(order.getAmount(), 0, 'COMMA', 2, 'POINT')}" style="width: 20%;">price</span>
</div>
</div>
<p>Best Regards,<br />LANcie 2018</p>
<p>Best Regards,<br />LANcie <span th:text="${year}"></span></p>
</div>
</div>
</body>
Expand Down

0 comments on commit 8895eb3

Please sign in to comment.