Ghost/ghost/offers/lib/domain/events/OfferCodeChange.js
Fabien O'Carroll 947fa74b9e Removed stripe_coupon_id handling from Offers
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.
2021-10-21 15:40:55 +02:00

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;