Ghost/ghost/member-events/lib/SubscriptionCancelledEvent.js
Rishabh 8d07d6e93b Updated subscription created/canceled events data
refs https://github.com/TryGhost/Team/issues/1865

- adds new subscription canceled event
- updates existing subscription created event to include tier id and source data
2022-09-10 11:06:34 +05:30

27 lines
649 B
JavaScript

/**
* @typedef {object} SubscriptionCancelledEventData
* @prop {string} source
* @prop {string} memberId
* @prop {string} tierId
* @prop {string} subscriptionId
*/
module.exports = class SubscriptionCancelledEvent {
/**
* @param {SubscriptionCancelledEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {SubscriptionCancelledEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new SubscriptionCancelledEvent(data, timestamp || new Date);
}
};