chore: Inject sandbox handle in cloud config (#13879)

* chore: Inject sandbox handle in cloud config

* Create wet-seas-lie.md

* chore: rename medusaCloudOptions to cloud

* fix tests
This commit is contained in:
Oli Juhl
2025-10-29 10:02:37 +01:00
committed by GitHub
parent 85b1f3d43a
commit 1defb3c29b
7 changed files with 248 additions and 22 deletions

View File

@@ -16,14 +16,23 @@ export class MedusaCloudEmailNotificationProvider extends AbstractNotificationPr
async send(
notification: NotificationTypes.ProviderSendNotificationDTO
): Promise<NotificationTypes.ProviderSendNotificationResultsDTO> {
const headers = {
"Content-Type": "application/json",
Authorization: `Basic ${this.options_.api_key}`,
}
if (this.options_.sandbox_handle) {
headers["x-medusa-sandbox-handle"] = this.options_.sandbox_handle
}
if (this.options_.environment_handle) {
headers["x-medusa-environment-handle"] = this.options_.environment_handle
}
try {
const response = await fetch(`${this.options_.endpoint}/send`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Basic ${this.options_.api_key}`,
"x-medusa-environment-handle": this.options_.environment_handle,
},
headers,
body: JSON.stringify({
to: notification.to,
from: notification.from,