Fixed Stripe Checkout using Offers

refs https://github.com/TryGhost/Members/commit/5172e40646

When we updated to use the OffersAPI instead of OfferRepository this was
missed, and we were passing blank coupon to Stripe Checkout. This should
eventually be replaced with a call like `getCoupon(offerId)` from a
payments service.
This commit is contained in:
Fabien O'Carroll 2021-10-14 12:01:12 +02:00
parent 2a3df8e3db
commit 53d24e501d
2 changed files with 4 additions and 1 deletions

View File

@ -152,7 +152,7 @@ module.exports = class RouterController {
}
coupon = {
id: offer.stripeCouponId
id: offer.stripe_coupon_id
};
} catch (err) {
res.writeHead(500);

View File

@ -24,6 +24,8 @@
*
* @prop {'active'|'archived'} status
*
* @prop {string} stripe_coupon_id
*
* @prop {object} tier
* @prop {string} tier.id
* @prop {string} tier.name
@ -49,6 +51,7 @@ class OfferMapper {
currency_restriction: offer.type.value === 'fixed',
currency: offer.type.value === 'fixed' ? offer.currency.value : null,
status: offer.status.value,
stripe_coupon_id: offer.stripeCouponId,
tier: {
id: offer.tier.id,
name: offer.tier.name