Ghost/ghost/admin/app/services/members-utils.js
Nazar Gargol 0a0ce4098d Refactored stripe configuration checks into separate service
no issue

- This logic is planned to be reused in more places, e.g. members import data validation. This change is meant to be a prep work for that.
- With stripe connect functionality coming it is important to have a central place checking for configured Stripe
2020-06-11 21:05:40 +12:00

14 lines
593 B
JavaScript

import Service from '@ember/service';
import {inject as service} from '@ember/service';
export default class MembersUtilsService extends Service {
@service settings;
isStripeEnabled() {
let membersSubscriptionSettings = this.settings.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
let stripeEnabled = membersSubscriptionSettings && !!(membersSubscriptionSettings.paymentProcessors[0].config.secret_token) && !!(membersSubscriptionSettings.paymentProcessors[0].config.public_token);
debugger
return stripeEnabled;
}
}