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 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();
}

View File

@ -1 +1,2 @@
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 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({

View File

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