Fixed Members Stripe config for Stripe Connect

no-issue

This was initially missed as local settings always had the original
stripeDirect keys, this ensures that regardless of Connect vs Direct vs
Both vs Neither that the config is correct.

Also ensures that the Members API instance is reloaded when the Stripe
Connect settings are changed.
This commit is contained in:
Fabien O'Carroll 2020-06-12 18:38:06 +02:00 committed by Fabien 'egg' O'Carroll
parent 008f86fc29
commit 63f1e57036
2 changed files with 5 additions and 5 deletions

View File

@ -131,10 +131,6 @@ class MembersConfigProvider {
return null; return null;
} }
if (!stripePaymentProcessor.config.public_token || !stripePaymentProcessor.config.secret_token) {
return null;
}
// NOTE: "Complimentary" plan has to be first in the queue so it is created even if regular plans are not configured // NOTE: "Complimentary" plan has to be first in the queue so it is created even if regular plans are not configured
stripePaymentProcessor.config.plans.unshift(COMPLIMENTARY_PLAN); stripePaymentProcessor.config.plans.unshift(COMPLIMENTARY_PLAN);
@ -157,6 +153,10 @@ class MembersConfigProvider {
stripePaymentProcessor.config.secret_token stripePaymentProcessor.config.secret_token
); );
if (!stripeApiKeys.publicKey || !stripeApiKeys.secretKey) {
return null;
}
return { return {
publicKey: stripeApiKeys.publicKey, publicKey: stripeApiKeys.publicKey,
secretKey: stripeApiKeys.secretKey, secretKey: stripeApiKeys.secretKey,

View File

@ -23,7 +23,7 @@ let membersSettings;
// Bind to events to automatically keep subscription info up-to-date from settings // Bind to events to automatically keep subscription info up-to-date from settings
events.on('settings.edited', function updateSettingFromModel(settingModel) { events.on('settings.edited', function updateSettingFromModel(settingModel) {
if (!['members_subscription_settings'].includes(settingModel.get('key'))) { if (!['members_subscription_settings', 'stripe_connect_integration'].includes(settingModel.get('key'))) {
return; return;
} }