mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Added disconnectStripe method to handle cleaning up
refs https://github.com/TryGhost/Team/issues/1006 As part of the work to handle cleaning up webhooks when we disconnect from Stripe, I'm moving the logic to clear out the Stripe related data from the database into a disconnectStripe method. This then allows us to start handling the cleanup of webhooks via the Stripe API.
This commit is contained in:
parent
ae1f905766
commit
8476e7cbd7
@ -168,6 +168,16 @@ module.exports = function MembersAPI({
|
||||
logging: common.logging
|
||||
});
|
||||
|
||||
async function disconnectStripe() {
|
||||
await Product.forge().query().update({
|
||||
monthly_price_id: null,
|
||||
yearly_price_id: null
|
||||
});
|
||||
await StripePrice.forge().query().del();
|
||||
await StripeProduct.forge().query().del();
|
||||
await StripeCustomer.forge().query().del();
|
||||
}
|
||||
|
||||
const ready = paymentConfig.stripe ? Promise.all([
|
||||
stripeMigrations.populateProductsAndPrices().then(() => {
|
||||
return stripeMigrations.populateStripePricesFromStripePlansSetting(stripeConfig.plans);
|
||||
@ -387,6 +397,7 @@ module.exports = function MembersAPI({
|
||||
getMemberIdentityToken,
|
||||
getMemberIdentityData,
|
||||
setMemberGeolocationFromIp,
|
||||
disconnectStripe,
|
||||
getPublicConfig,
|
||||
bus,
|
||||
sendEmailWithMagicLink,
|
||||
|
Loading…
Reference in New Issue
Block a user