From 53d24e501d4cda26a7d9e87fae6c3a3543d5ec58 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Thu, 14 Oct 2021 12:01:12 +0200 Subject: [PATCH] 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. --- ghost/members-api/lib/controllers/router.js | 2 +- ghost/offers/lib/application/OfferMapper.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ghost/members-api/lib/controllers/router.js b/ghost/members-api/lib/controllers/router.js index f93d3e4704..9c7beb57c2 100644 --- a/ghost/members-api/lib/controllers/router.js +++ b/ghost/members-api/lib/controllers/router.js @@ -152,7 +152,7 @@ module.exports = class RouterController { } coupon = { - id: offer.stripeCouponId + id: offer.stripe_coupon_id }; } catch (err) { res.writeHead(500); diff --git a/ghost/offers/lib/application/OfferMapper.js b/ghost/offers/lib/application/OfferMapper.js index 09f4da5546..6cff4ecde0 100644 --- a/ghost/offers/lib/application/OfferMapper.js +++ b/ghost/offers/lib/application/OfferMapper.js @@ -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