mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Created Stripe Coupons when Offers are created
refs https://github.com/TryGhost/Team/issues/1166 We've moved the Stripe Coupon creation out of the Offers module as part of the work for Stripe disconnect, so we have to make sure that we are still creating coupons when an Offer is created.
This commit is contained in:
parent
ff2da8a417
commit
dbf564d137
@ -1,3 +1,6 @@
|
||||
const DomainEvents = require('@tryghost/domain-events');
|
||||
const OfferCreatedEvent = require('@tryghost/members-offers').events.OfferCreatedEvent;
|
||||
|
||||
class PaymentsService {
|
||||
/**
|
||||
* @param {object} deps
|
||||
@ -12,6 +15,10 @@ class PaymentsService {
|
||||
this.offersAPI = deps.offersAPI;
|
||||
/** @private */
|
||||
this.stripeAPIService = deps.stripeAPIService;
|
||||
|
||||
DomainEvents.subscribe(OfferCreatedEvent, async (event) => {
|
||||
await this.getCouponForOffer(event.data.offer.id);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,5 +24,8 @@
|
||||
"should": "13.2.3",
|
||||
"sinon": "11.1.2"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {
|
||||
"@tryghost/domain-events": "^0.1.2",
|
||||
"@tryghost/members-offers": "^0.7.2"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user