Skip to content

Feat/#274 add payment reminder email#420

Open
Sintry1 wants to merge 24 commits intodevelopmentfrom
feat/#274-add-payment-reminder-email
Open

Feat/#274 add payment reminder email#420
Sintry1 wants to merge 24 commits intodevelopmentfrom
feat/#274-add-payment-reminder-email

Conversation

@Sintry1
Copy link
Contributor

@Sintry1 Sintry1 commented Oct 30, 2022

This pull request closes:

✔️ Closes Jira Issue: TC-274

Which service(s) does this issue affect:

  • 🛰️ API
  • 🛒 webstore
  • 🎓 admin-page

Types of changes

  • 🐛 Bug fix (a non-breaking change which fixes an issue)
  • 🧱 New feature (a non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🤖 CI/CD (a change to the CI/CD pipeline)
  • ⚗️ Refactoring (an update to some already existing code)
  • 💄 Style (Markup, formatting, CSS)

Documentation Updates

  • 📂 No need for updates
  • 📁 Requires an update ( not done within this issue )
  • 🗃️ Has been updated ( done within this issue )

Testing checklist

  • 💪 Manual tests
  • 🔧 Automatic tests

Browser compatibility - [Frontend only]

  • Tested on Safari
  • Tested on Chrome
  • Tested on Mozilla Firefox

What changes have been done within this issue?

Scheduled a method to send a payment reminder email to every unpaid order > 5 minutes old

How should this be manually tested?

  • Run API and Webstore
  • Change the cron expression in OrderService.java from (cron = "* 1 * * *?") to (cron = "1 * * * * ? ") to enable the scheduling every minute
  • Create a new order in webstore, go to payment, do not input payment details and then wait 5-6 minutes.
  • If an email is sent to the email address (needs to be a valid email) after the 5-6 minute wait, it works, if not, something is wrong.

Screenshots or example usage

@Sintry1 Sintry1 added the feat 🎸 A new feature label Oct 30, 2022
@Sintry1 Sintry1 requested review from Kwandes and Teodor25 October 30, 2022 12:50
@Sintry1 Sintry1 self-assigned this Oct 30, 2022
Copy link
Member

@Kwandes Kwandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Teodor25 Add a more detailed, localized email template before merging this

There is a minor issue but other than that it looks perfect

String subject = "Your Treecreate order is waiting for your payment!";
Context context = new Context(new Locale("da"));
context.setVariable("paymentLink", quickpayService.getPaymentLink(order.getPaymentId()).getUrl());
System.out.println(quickpayService.getPaymentLink(order.getPaymentId()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use normal console logs for this, use the Logger
But this log is redundant anyway since the ordersService already logs this, so it can be removed

Suggested change
System.out.println(quickpayService.getPaymentLink(order.getPaymentId()));

, 'ac86995f-60ae-4520-a434-c8abc98980b9' AS user_id
, 'c0a80121-7e81-1c3e-817e-82cc11180004' AS billing_info_contact_info_id
, 'c0a80121-7e81-1c3e-817e-82cc11180005' AS contact_info_contact_info_id
, false AS paymentReminderSent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably follow the naming convention for the database: payment_reminder_sent

Tho, if calli approves of it as it is, it's fine. But check with her.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works either way, but might as well make it match the rest of the data
If it doesn't work after changing it to payment_reminder_sent then leave it as is @Sintry1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 🎸 A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants