0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Fixed webhook handling for Checkout Sessions (#245)

no-issue

Fetching relations via the model returns a promise, and this was missing
the `await` keyword. We also need to `get` the subscription_id attribute
as we're working with models rather than subscription objects.
This commit is contained in:
Fabien 'egg' O'Carroll 2021-02-17 17:12:45 +00:00 committed by GitHub
parent 5bb1706f8d
commit 274412b051

View file

@ -157,11 +157,11 @@ module.exports = class StripeWebhookService {
setupIntent.payment_method
);
const subscriptions = member.related('stripeSubscriptions').fetch();
const subscriptions = await member.related('stripeSubscriptions').fetch();
for (const subscription of subscriptions.models) {
const updatedSubscription = await this._stripeAPIService.updateSubscriptionDefaultPaymentMethod(
subscription.id,
subscription.get('subscription_id'),
setupIntent.payment_method
);
await this._memberRepository.linkSubscription({