diff --git a/ghost/core/core/server/services/settings/SettingsBREADService.js b/ghost/core/core/server/services/settings/SettingsBREADService.js index 85dad8e5ec..c439c92c9d 100644 --- a/ghost/core/core/server/services/settings/SettingsBREADService.js +++ b/ghost/core/core/server/services/settings/SettingsBREADService.js @@ -236,7 +236,7 @@ class SettingsBREADService { const previous = stripePublicKeySetting.previousAttributes().value; const current = stripePublicKeySetting.get('value'); - if (current?.match(/pk_test/) && (!previous?.match(/pk_test/) || !previous)) { + if (current?.match(/pk_live/) && (!previous?.match(/pk_live/) || !previous)) { // This method currently only triggers a DomainEvent await stripeService.connect(); } diff --git a/ghost/stripe/index.js b/ghost/stripe/index.js index 03184beb13..8b1c1844f1 100644 --- a/ghost/stripe/index.js +++ b/ghost/stripe/index.js @@ -1 +1,2 @@ module.exports = require('./lib/StripeService'); +module.exports.events = require('./lib/events'); diff --git a/ghost/stripe/lib/StripeService.js b/ghost/stripe/lib/StripeService.js index 194b0b53f6..040d4c4db0 100644 --- a/ghost/stripe/lib/StripeService.js +++ b/ghost/stripe/lib/StripeService.js @@ -3,8 +3,7 @@ const StripeAPI = require('./StripeAPI'); const StripeMigrations = require('./StripeMigrations'); const WebhookController = require('./WebhookController'); const DomainEvents = require('@tryghost/domain-events'); -const StripeLiveEnabledEvent = require('./StripeLiveEnabledEvent'); -const StripeLiveDisabledEvent = require('./StripeLiveDisabledEvent'); +const {StripeLiveEnabledEvent, StripeLiveDisabledEvent} = require('./events'); module.exports = class StripeService { constructor({ diff --git a/ghost/stripe/lib/StripeLiveDisabledEvent.js b/ghost/stripe/lib/events/StripeLiveDisabledEvent.js similarity index 100% rename from ghost/stripe/lib/StripeLiveDisabledEvent.js rename to ghost/stripe/lib/events/StripeLiveDisabledEvent.js diff --git a/ghost/stripe/lib/StripeLiveEnabledEvent.js b/ghost/stripe/lib/events/StripeLiveEnabledEvent.js similarity index 100% rename from ghost/stripe/lib/StripeLiveEnabledEvent.js rename to ghost/stripe/lib/events/StripeLiveEnabledEvent.js diff --git a/ghost/stripe/lib/events/index.js b/ghost/stripe/lib/events/index.js new file mode 100644 index 0000000000..de8847b0de --- /dev/null +++ b/ghost/stripe/lib/events/index.js @@ -0,0 +1,4 @@ +module.exports = { + StripeLiveEnabledEvent: require('./StripeLiveEnabledEvent'), + StripeLiveDisabledEvent: require('./StripeLiveDisabledEvent') +};