mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Refactored updateSubscription to fetch payment info
no-issue
This commit is contained in:
parent
5a0adce65d
commit
2d058d8a47
1 changed files with 8 additions and 1 deletions
|
@ -215,8 +215,15 @@ module.exports = class StripePaymentProcessor {
|
|||
}
|
||||
|
||||
async _updateSubscription(subscription) {
|
||||
debug(`Attaching subscription to customer ${subscription.customer} ${subscription.id}`);
|
||||
const payment = subscription.default_payment_method;
|
||||
if (typeof payment === 'string') {
|
||||
debug(`Fetching default_payment_method for subscription ${subscription.id}`);
|
||||
const subscriptionWithPayment = await retrieve(this._stripe, 'subscriptions', subscription.id, {
|
||||
expand: ['default_payment_method']
|
||||
});
|
||||
return this._updateSubscription(subscriptionWithPayment);
|
||||
}
|
||||
debug(`Attaching subscription to customer ${subscription.customer} ${subscription.id}`);
|
||||
await this.storage.set({
|
||||
subscription: {
|
||||
customer_id: subscription.customer,
|
||||
|
|
Loading…
Add table
Reference in a new issue