mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Ensured latest subscription data is always stored (#240)
no-issue If we receive webhooks out of order, e.g. a `customer.subscription.updated` with a status of 'active', followed by a `customer.subscription.created` with a status of 'incomplete'. We would overwrite the correct value with data from the "older" webhook. This ensures that we always fetch the latest data from the Stripe API before storing in the database.
This commit is contained in:
parent
8b3cd5499c
commit
991b6e92a3
@ -169,7 +169,7 @@ module.exports = class MemberRepository {
|
||||
throw new Error('Subscription is not associated with a customer for the member');
|
||||
}
|
||||
|
||||
const subscription = data.subscription;
|
||||
const subscription = await this._stripeAPIService.getSubscription(data.subscription.id);
|
||||
let paymentMethodId;
|
||||
if (!subscription.default_payment_method) {
|
||||
paymentMethodId = null;
|
||||
|
Loading…
Reference in New Issue
Block a user