Ghost/ghost/admin/tests/helpers/stripe.js
Kevin Ansfield ed235b374d Increased publish flow acceptance tests
refs https://github.com/TryGhost/Team/issues/1586

- updated `?newsletter_id=id` handling in posts API mock to match the real `?newsletter=slug` behaviour
- added additional publish flow acceptance tests for single/multiple newsletter behaviour, scheduling, and sending
2022-05-31 22:59:20 +01:00

21 lines
1.4 KiB
JavaScript

export function enableStripe(server, enabled = true) {
server.db.settings.find({key: 'stripe_connect_account_id'})
? server.db.settings.update({key: 'stripe_connect_account_id'}, {value: (enabled ? 'stripe_account_id' : null)})
: server.create('setting', {key: 'stripe_connect_account_id', value: (enabled ? 'stripe_account_id' : null), group: 'members'});
// needed for membersUtils.isStripeEnabled
server.db.settings.find({key: 'stripe_connect_secret_key'})
? server.db.settings.update({key: 'stripe_connect_secret_key'}, {value: (enabled ? 'stripe_secret_key' : null)})
: server.create('setting', {key: 'stripe_connect_secret_key', value: (enabled ? 'stripe_secret_key' : null), group: 'members'});
server.db.settings.find({key: 'stripe_connect_publishable_key'})
? server.db.settings.update({key: 'stripe_connect_publishable_key'}, {value: (enabled ? 'stripe_secret_key' : null)})
: server.create('setting', {key: 'stripe_connect_publishable_key', value: (enabled ? 'stripe_secret_key' : null), group: 'members'});
server.db.settings.find({key: 'paid_members_enabled'})
? server.db.settings.update({key: 'paid_members_enabled'}, {value: enabled})
: server.create('setting', {key: 'paid_members_enabled', value: enabled, group: 'members'});
}
export function disableStripe(server) {
enableStripe(server, false);
}