feat: notifications (#172)
The Notifications API allows plugins to register Notification Providers which have `sendNotification` and `resendNotification`. Each plugin can listen to any events transmittet over the event bus and the result of the notification send will be persisted in the database to allow for clear communications timeline + ability to resend notifications.
This commit is contained in:
@@ -3,4 +3,5 @@ export { default as BaseModel } from "./base-model"
|
||||
export { default as PaymentService } from "./payment-service"
|
||||
export { default as FulfillmentService } from "./fulfillment-service"
|
||||
export { default as FileService } from "./file-service"
|
||||
export { default as NotificationService } from "./notification-service"
|
||||
export { default as OauthService } from "./oauth-service"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import BaseService from "./base-service"
|
||||
|
||||
/**
|
||||
* Interface for Notification Providers
|
||||
* @interface
|
||||
*/
|
||||
class BaseNotificationService extends BaseService {
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
getIdentifier() {
|
||||
return this.constructor.identifier
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to retrieve documents related to a shipment.
|
||||
*/
|
||||
sendNotification(event, data) {
|
||||
throw new Error("Must be overridden by child")
|
||||
}
|
||||
|
||||
resendNotification(notification, config = {}) {
|
||||
throw new Error("Must be overridden by child")
|
||||
}
|
||||
}
|
||||
|
||||
export default BaseNotificationService
|
||||
Reference in New Issue
Block a user