mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
77032262c4
fixes https://github.com/TryGhost/Team/issues/2542 fixes https://github.com/TryGhost/Team/issues/2543 fixes https://github.com/TryGhost/Team/issues/2544 - Hides incomplete subscriptions - Shows Past Due subscriptions - Fixed UI issues with 3+ subscriptions - Fixed missing complimentary subscription when one subscription was incomplete/inactive - Fixed sending a paid subscription started email for incomplete subscriptions. This change also required us to actually send the email when the incomplete subscription eventually becomes active. So the introduction of a new `SubscriptionActivatedEvent` made sense/was required (because sending a SubscriptionCreatedEvent again would cause other issues).
31 lines
749 B
JavaScript
31 lines
749 B
JavaScript
/**
|
|
* Fired when a subscription becomes active.
|
|
*
|
|
* @typedef {object} SubscriptionActivatedEventData
|
|
* @prop {string} source
|
|
* @prop {string} memberId
|
|
* @prop {string} batchId
|
|
* @prop {string} tierId
|
|
* @prop {string} subscriptionId
|
|
* @prop {string} offerId
|
|
*/
|
|
|
|
module.exports = class SubscriptionActivatedEvent {
|
|
/**
|
|
* @param {SubscriptionActivatedEventData} data
|
|
* @param {Date} timestamp
|
|
*/
|
|
constructor(data, timestamp) {
|
|
this.data = data;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
/**
|
|
* @param {SubscriptionActivatedEventData} data
|
|
* @param {Date} [timestamp]
|
|
*/
|
|
static create(data, timestamp) {
|
|
return new SubscriptionActivatedEvent(data, timestamp ?? new Date);
|
|
}
|
|
};
|