mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
🐛 Fixed complimentary plan creation when there was none in plans collection
closes https://github.com/TryGhost/Ghost/issues/11649 closes https://github.com/TryGhost/Ghost/issues/11648 - When complimentary plan with new currency is created for the first time it doesn't have a reference to a previously default "Complimentary USD" plan which caused problems when switching currencies for the first time. - Value for complimentary plan taken from https://github.com/TryGhost/Ghost/blob/3.10.0/core/server/services/members/config.js#L8-L13
This commit is contained in:
parent
2a8ae8b17f
commit
c341cf4638
@ -161,9 +161,14 @@ export default Component.extend({
|
||||
let currentCurrencyComplimentary = stripeProcessor.config.plans.filter(plan => (plan.currency === event.value && plan.name === 'Complimentary'));
|
||||
|
||||
if (!currentCurrencyComplimentary.length) {
|
||||
let complimentary = stripeProcessor.config.plans.find(plan => (plan.name === 'Complimentary'));
|
||||
let newComplimentary = Object.assign({}, complimentary, {currency: event.value});
|
||||
stripeProcessor.config.plans.push(newComplimentary);
|
||||
let complimentary = {
|
||||
name: 'Complimentary',
|
||||
currency: event.value,
|
||||
interval: 'year',
|
||||
amount: '0'
|
||||
};
|
||||
|
||||
stripeProcessor.config.plans.push(complimentary);
|
||||
}
|
||||
|
||||
stripeProcessor.config.currency = event.value;
|
||||
|
Loading…
Reference in New Issue
Block a user