mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added stripe customer fetching method to member's API
no issue - This method is needed to be able to validate if customer exist in configured Stripe account before attempting to link one with local member.
This commit is contained in:
parent
a136e5f839
commit
d83525b54b
2 changed files with 11 additions and 0 deletions
|
@ -153,6 +153,10 @@ module.exports = class StripePaymentProcessor {
|
||||||
return customer;
|
return customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getStripeCustomer(id) {
|
||||||
|
return await retrieve(this._stripe, 'customers', id);
|
||||||
|
}
|
||||||
|
|
||||||
async createCheckoutSetupSession(member, options) {
|
async createCheckoutSetupSession(member, options) {
|
||||||
const customer = await this._customerForMemberCheckoutSession(member);
|
const customer = await this._customerForMemberCheckoutSession(member);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,12 @@ module.exports = function ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getStripeCustomer(id) {
|
||||||
|
if (stripe) {
|
||||||
|
return await stripe.getStripeCustomer(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function get(data, options) {
|
async function get(data, options) {
|
||||||
debug(`get id:${data.id} email:${data.email}`);
|
debug(`get id:${data.id} email:${data.email}`);
|
||||||
const member = await getMember(data, options);
|
const member = await getMember(data, options);
|
||||||
|
@ -189,6 +195,7 @@ module.exports = function ({
|
||||||
setComplimentarySubscription,
|
setComplimentarySubscription,
|
||||||
cancelComplimentarySubscription,
|
cancelComplimentarySubscription,
|
||||||
destroyStripeSubscriptions,
|
destroyStripeSubscriptions,
|
||||||
|
getStripeCustomer,
|
||||||
linkStripeCustomer
|
linkStripeCustomer
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue