0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added stripe config check to members site data

refs https://github.com/TryGhost/members.js/issues/43

- Adds new `isStripeConfigured` flag to public members site data which denotes if stripe setup is completed
- Helps clients like members.js/themes to configure payment behavior based on this flag
This commit is contained in:
Rish 2020-06-10 21:14:45 +05:30
parent 0d11c66c26
commit 82cf095600

View file

@ -84,6 +84,12 @@ const updateMemberData = async function (req, res) {
};
const getMemberSiteData = async function (req, res) {
const stripePaymentProcessor = settingsCache.get('members_subscription_settings').paymentProcessors.find(
paymentProcessor => paymentProcessor.adapter === 'stripe'
);
const stripeSecretToken = stripePaymentProcessor && stripePaymentProcessor.config.secret_token;
const stripePublicToken = stripePaymentProcessor && stripePaymentProcessor.config.public_token;
const isStripeConfigured = (!!stripeSecretToken && stripeSecretToken !== '' && !!stripePublicToken && stripePublicToken !== '');
const response = {
title: settingsCache.get('title'),
description: settingsCache.get('description'),
@ -92,7 +98,8 @@ const getMemberSiteData = async function (req, res) {
url: urlUtils.urlFor('home', true),
version: ghostVersion.safe,
plans: membersService.config.getPublicPlans(),
allowSelfSignup: membersService.config.getAllowSelfSignup()
allowSelfSignup: membersService.config.getAllowSelfSignup(),
isStripeConfigured
};
// Brand is currently an experimental feature