diff --git a/ghost/members-api/lib/MembersAPI.js b/ghost/members-api/lib/MembersAPI.js index af6b4b2482..f46a749164 100644 --- a/ghost/members-api/lib/MembersAPI.js +++ b/ghost/members-api/lib/MembersAPI.js @@ -55,7 +55,7 @@ module.exports = function MembersAPI({ Settings }, stripeAPIService, - offerRepository, + offersAPI, logger, labsService }) { @@ -153,7 +153,7 @@ module.exports = function MembersAPI({ }); const routerController = new RouterController({ - offerRepository, + offersAPI, productRepository, memberRepository, StripePrice, diff --git a/ghost/members-api/lib/controllers/router.js b/ghost/members-api/lib/controllers/router.js index eab5a80adc..690e2da715 100644 --- a/ghost/members-api/lib/controllers/router.js +++ b/ghost/members-api/lib/controllers/router.js @@ -17,7 +17,7 @@ const _ = require('lodash'); */ module.exports = class RouterController { constructor({ - offerRepository, + offersAPI, productRepository, memberRepository, StripePrice, @@ -30,7 +30,7 @@ module.exports = class RouterController { config, logging }) { - this._offerRepository = offerRepository; + this._offersAPI = offersAPI; this._productRepository = productRepository; this._memberRepository = memberRepository; this._StripePrice = StripePrice; @@ -137,10 +137,10 @@ module.exports = class RouterController { let coupon = null; if (offerId && this.labsService.isSet('offers')) { try { - const offer = await this._offerRepository.getById(offerId); + const offer = await this._offersAPI.getOffer({id: offerId}); const tier = (await this._productRepository.get(offer.tier)).toJSON(); - if (offer.cadence.value === 'month') { + if (offer.cadence === 'month') { ghostPriceId = tier.monthly_price_id; } else { ghostPriceId = tier.yearly_price_id;