Skip to content

Conversation

@gustaavik
Copy link
Member

This pull request introduces several enhancements to email notifications and order status management, along with configuration updates and testing improvements. The changes primarily focus on adding support for tracking information in order shipment emails, refining configuration handling, and updating documentation to reflect the new features.

Email Notifications Enhancements:

  • Added a new method SendOrderShipped in SMTPEmailService to send order shipment emails with optional tracking information. This includes updates to email templates and debug logging for tracking URLs. (internal/infrastructure/email/smtp_email_service.go)
  • Modified the handleEmailsForOrderStatusChange function in OrderUseCase to send shipment emails when the order status changes to "shipped". It now supports tracking information. (internal/application/usecase/order_usecase.go)

Configuration Updates:

  • Added new environment variables (EMAIL_CONTACT_ADDRESS, STORE_NAME) to .env.example for better customization of email sender details and store name. (.env.example) [1] [2]
  • Updated the EmailConfig struct in config.go to include ContactEmail and StoreName fields, and modified the LoadConfig function to handle defaults and environment variables for these fields. (config/config.go) [1] [2]

Documentation Improvements:

  • Expanded the RESTAPI.md and order_api_examples.md documentation to include details about updating order status with tracking information, valid statuses, and email notification features. (docs/RESTAPI.md, docs/order_api_examples.md) [1] [2]

Testing Enhancements:

  • Added unit tests in config_test.go to verify default and custom values for ContactEmail and StoreName in the configuration. (config/config_test.go)

Codebase Simplification:

  • Refactored SMTPEmailService to use StoreName and ContactEmail from the configuration instead of hardcoded values. (internal/infrastructure/email/smtp_email_service.go) [1] [2]

- Implemented new API endpoint to update order status with tracking information.
- Enhanced order status update logic to handle tracking details and send notification emails.
- Updated email service to include tracking information in shipment emails.
- Created new HTML template for order shipped notification.
- Added tests for the new email functionality and ensured template existence.
- Updated documentation to reflect changes in API and email notifications.
@gustaavik gustaavik merged commit 177646d into main Jul 14, 2025
5 checks passed
@gustaavik gustaavik deleted the email-refactor branch July 14, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants