2022-06-01 00:59:12 +03:00
|
|
|
export function enableStripe(server, enabled = true) {
|
2022-04-21 16:48:25 +03:00
|
|
|
server.db.settings.find({key: 'stripe_connect_account_id'})
|
2022-06-01 00:59:12 +03:00
|
|
|
? 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'});
|
2022-04-21 16:48:25 +03:00
|
|
|
// needed for membersUtils.isStripeEnabled
|
|
|
|
server.db.settings.find({key: 'stripe_connect_secret_key'})
|
2022-06-01 00:59:12 +03:00
|
|
|
? 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'});
|
2022-04-21 16:48:25 +03:00
|
|
|
server.db.settings.find({key: 'stripe_connect_publishable_key'})
|
2022-06-01 00:59:12 +03:00
|
|
|
? 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'});
|
2022-05-24 17:53:03 +03:00
|
|
|
|
|
|
|
server.db.settings.find({key: 'paid_members_enabled'})
|
2022-06-01 00:59:12 +03:00
|
|
|
? 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);
|
2022-04-21 16:48:25 +03:00
|
|
|
}
|