mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Updated customer fetch from Stripe to include subscriptions (#264)
closes https://github.com/TryGhost/Team/issues/628
refs 9010a62d54
Following up on last commit, this moves up the expansion of Stripe customer fetch to always include `subscriptions` by default in api service so we don't accidentally miss it.
This commit is contained in:
parent
9010a62d54
commit
42ade8fd12
2 changed files with 6 additions and 3 deletions
|
@ -216,9 +216,7 @@ module.exports = class MemberRepository {
|
|||
if (!this._stripeAPIService.configured) {
|
||||
throw new Error('Cannot link Stripe Customer with no Stripe Connection');
|
||||
}
|
||||
const customer = await this._stripeAPIService.getCustomer(data.customer_id, {
|
||||
expand: ['subscriptions']
|
||||
});
|
||||
const customer = await this._stripeAPIService.getCustomer(data.customer_id);
|
||||
|
||||
if (!customer) {
|
||||
return;
|
||||
|
|
|
@ -214,6 +214,11 @@ module.exports = class StripeAPIService {
|
|||
debug(`getCustomer(${id}, ${JSON.stringify(options)})`);
|
||||
try {
|
||||
await this._rateLimitBucket.throttle();
|
||||
if (options.expand) {
|
||||
options.expand.push('subscriptions');
|
||||
} else {
|
||||
options.expand = ['subscriptions'];
|
||||
}
|
||||
const customer = await this._stripe.customers.retrieve(id, options);
|
||||
debug(`getCustomer(${id}, ${JSON.stringify(options)}) -> Success`);
|
||||
return customer;
|
||||
|
|
Loading…
Add table
Reference in a new issue