Renamed member require payment setting

no issue

Renames member setting `requirePaymentForsSignup` -> `allowSelfSignup` to match existing usage in members API
This commit is contained in:
Rish 2019-10-11 14:04:39 +05:30
parent 079f40611b
commit e90b80822d
4 changed files with 10 additions and 30 deletions

View File

@ -21,7 +21,7 @@ export default Component.extend({
yearly: yearlyPlan
};
subscriptionSettings.stripeConfig = stripeProcessor.config;
subscriptionSettings.requirePaymentForSetup = !!subscriptionSettings.requirePaymentForSetup;
subscriptionSettings.allowSelfSignup = !!subscriptionSettings.allowSelfSignup;
subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || 'noreply';
return subscriptionSettings;
@ -59,8 +59,8 @@ export default Component.extend({
return plan;
});
}
if (key === 'requirePaymentForSignup') {
subscriptionSettings.requirePaymentForSignup = !subscriptionSettings.requirePaymentForSignup;
if (key === 'allowSelfSignup') {
subscriptionSettings.allowSelfSignup = !subscriptionSettings.allowSelfSignup;
}
if (key === 'fromAddress') {
subscriptionSettings.fromAddress = event.target.value;
@ -75,7 +75,7 @@ export default Component.extend({
} catch (e) {
return {
isPaid: false,
requirePaymentForSignup: false,
allowSelfSignup: true,
fromAddress: 'noreply',
paymentProcessors: [{
adapter: 'stripe',

View File

@ -8,7 +8,6 @@ import {
isRequestEntityTooLargeError,
isUnsupportedMediaTypeError
} from 'ghost-admin/services/ajax';
import {computed} from '@ember/object';
import {isBlank} from '@ember/utils';
import {isArray as isEmberArray} from '@ember/array';
import {run} from '@ember/runloop';
@ -63,25 +62,6 @@ export default Controller.extend({
this.yamlMimeType = YAML_MIME_TYPE;
},
subscriptionSettings: computed('settings.membersSubscriptionSettings', function () {
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => {
return (proc.adapter === 'stripe');
});
let monthlyPlan = stripeProcessor.config.plans.find(plan => plan.interval === 'month');
let yearlyPlan = stripeProcessor.config.plans.find(plan => plan.interval === 'year');
monthlyPlan.dollarAmount = parseInt(monthlyPlan.amount) ? (monthlyPlan.amount / 100) : 0;
yearlyPlan.dollarAmount = parseInt(yearlyPlan.amount) ? (yearlyPlan.amount / 100) : 0;
stripeProcessor.config.plans = {
monthly: monthlyPlan,
yearly: yearlyPlan
};
subscriptionSettings.stripeConfig = stripeProcessor.config;
subscriptionSettings.requirePaymentForSetup = !!subscriptionSettings.requirePaymentForSetup;
subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || 'noreply';
return subscriptionSettings;
}),
actions: {
onUpload(file) {
let formData = new FormData();

View File

@ -83,11 +83,11 @@
</div>
<div>
<div class="for-switch">
<label class="switch" for="members-require-payment"
{{action "setSubscriptionSettings" "requirePaymentForSignup" bubbles="false"}}>
<input type="checkbox" checked={{subscriptionSettings.requirePaymentForSignup}} class="gh-input"
onclick={{action "setSubscriptionSettings" "requirePaymentForSignup"}}
data-test-checkbox="members-require-payment">
<label class="switch" for="members-allow-self-signup"
{{action "setSubscriptionSettings" "allowSelfSignup" bubbles="false"}}>
<input type="checkbox" checked={{subscriptionSettings.allowSelfSignup}} class="gh-input"
onclick={{action "setSubscriptionSettings" "allowSelfSignup"}}
data-test-checkbox="members-allow-self-signup">
<span class="input-toggle-component mt1"></span>
</label>
</div>

View File

@ -177,7 +177,7 @@ export default [
id: 23,
type: 'members',
key: 'members_subscription_settings',
value: '{"isPaid":false,"requirePaymentForSignup":false,"fromAddress":"noreply","paymentProcessors":[{"adapter":"stripe","config":{"secret_token":"","public_token":"","product":{"name":"Ghost Subscription"},"plans":[{"name":"Monthly","currency":"usd","interval":"month","amount":""},{"name":"Yearly","currency":"usd","interval":"year","amount":""}]}}]}',
value: '{"isPaid":false,"allowSelfSignup":true,"fromAddress":"noreply","paymentProcessors":[{"adapter":"stripe","config":{"secret_token":"","public_token":"","product":{"name":"Ghost Subscription"},"plans":[{"name":"Monthly","currency":"usd","interval":"month","amount":""},{"name":"Yearly","currency":"usd","interval":"year","amount":""}]}}]}',
created_at: '2019-10-09T09:49:00.000Z',
created_by: 1,
updated_at: '2019-10-09T09:49:00.000Z',