Expose Stripe events in package

This commit is contained in:
Aileen Booker 2023-06-08 10:59:30 -04:00 committed by Aileen Booker
parent 98fd6a7dbf
commit 48f9e85e09
6 changed files with 7 additions and 3 deletions

View File

@ -236,7 +236,7 @@ class SettingsBREADService {
const previous = stripePublicKeySetting.previousAttributes().value; const previous = stripePublicKeySetting.previousAttributes().value;
const current = stripePublicKeySetting.get('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 // This method currently only triggers a DomainEvent
await stripeService.connect(); await stripeService.connect();
} }

View File

@ -1 +1,2 @@
module.exports = require('./lib/StripeService'); module.exports = require('./lib/StripeService');
module.exports.events = require('./lib/events');

View File

@ -3,8 +3,7 @@ const StripeAPI = require('./StripeAPI');
const StripeMigrations = require('./StripeMigrations'); const StripeMigrations = require('./StripeMigrations');
const WebhookController = require('./WebhookController'); const WebhookController = require('./WebhookController');
const DomainEvents = require('@tryghost/domain-events'); const DomainEvents = require('@tryghost/domain-events');
const StripeLiveEnabledEvent = require('./StripeLiveEnabledEvent'); const {StripeLiveEnabledEvent, StripeLiveDisabledEvent} = require('./events');
const StripeLiveDisabledEvent = require('./StripeLiveDisabledEvent');
module.exports = class StripeService { module.exports = class StripeService {
constructor({ constructor({

View File

@ -0,0 +1,4 @@
module.exports = {
StripeLiveEnabledEvent: require('./StripeLiveEnabledEvent'),
StripeLiveDisabledEvent: require('./StripeLiveDisabledEvent')
};