2020-06-11 12:05:40 +03:00
|
|
|
import Service from '@ember/service';
|
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
|
|
|
export default class MembersUtilsService extends Service {
|
|
|
|
@service settings;
|
2020-06-29 20:37:11 +03:00
|
|
|
@service config;
|
2020-06-11 12:05:40 +03:00
|
|
|
|
2020-06-11 15:46:04 +03:00
|
|
|
get isStripeEnabled() {
|
2020-06-29 20:37:11 +03:00
|
|
|
const stripeDirect = this.config.get('stripeDirect');
|
2020-06-11 17:45:45 +03:00
|
|
|
|
2020-06-29 20:37:11 +03:00
|
|
|
const hasDirectKeys = !!this.settings.get('stripeSecretKey') && !!this.settings.get('stripePublishableKey');
|
|
|
|
const hasConnectKeys = !!this.settings.get('stripeConnectSecretKey') && !!this.settings.get('stripeConnectPublishableKey');
|
2020-06-11 17:45:45 +03:00
|
|
|
|
2020-06-29 20:37:11 +03:00
|
|
|
if (stripeDirect) {
|
|
|
|
return hasDirectKeys;
|
|
|
|
}
|
2020-06-11 17:45:45 +03:00
|
|
|
|
2020-06-29 20:37:11 +03:00
|
|
|
return hasConnectKeys || hasDirectKeys;
|
2020-06-11 12:05:40 +03:00
|
|
|
}
|
|
|
|
}
|