|
1
|
import { NotificationTypes } from "@medusajs/framework/types" |
|
2
|
import { AbstractNotificationProviderService } from "@medusajs/framework/utils" |
|
3
|
|
|
4
|
export class NotificationProviderServiceFixtures extends AbstractNotificationProviderService { |
|
5
|
static identifier = "fixtures-notification-provider" |
|
6
|
|
|
7
|
async send( |
|
8
|
notification: NotificationTypes.ProviderSendNotificationDTO |
|
9
|
): Promise<NotificationTypes.ProviderSendNotificationResultsDTO> { |
|
10
|
if (notification.to === "fail") { |
|
11
|
throw new Error("Failed to send notification") |
|
12
|
} |
|
13
|
return { id: "external_id" } |
|
14
|
} |
|
15
|
} |
|
16
|
|
|
17
|
export const services = [NotificationProviderServiceFixtures] |