mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
947fa74b9e
refs https://github.com/TryGhost/Team/issues/1166 This will be handled by a payments module instead. In order to disconnect Stripe we must delete all Stripe related data, which means an Offer doesn't inherently have a stripe coupon id. Instead we can use a payments service which will get/create the coupon for us when we need it.
30 lines
683 B
JavaScript
30 lines
683 B
JavaScript
/** @typedef {import('../models/OfferCode')} OfferCode */
|
|
|
|
/**
|
|
* @typedef {object} OfferCodeChangeEventData
|
|
* @prop {string} offerId
|
|
* @prop {OfferCode} previousCode
|
|
* @prop {OfferCode} currentCode
|
|
*/
|
|
|
|
class OfferCodeChangeEvent {
|
|
/**
|
|
* @param {OfferCodeChangeEventData} data
|
|
* @param {Date} timestamp
|
|
*/
|
|
constructor(data, timestamp) {
|
|
this.data = data;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
/**
|
|
* @param {OfferCodeChangeEventData} data
|
|
* @param {Date} [timestamp]
|
|
*/
|
|
static create(data, timestamp) {
|
|
return new OfferCodeChangeEvent(data, timestamp || new Date);
|
|
}
|
|
}
|
|
|
|
module.exports = OfferCodeChangeEvent;
|