mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
🐛 Fixed upper price limit in Membership Tiers
closes https://github.com/TryGhost/Team/issues/2287 - Stripe allows a max. amount of 999,999.99, cf. Stripe docs https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount - The publisher now sees an error if they choose a price that is higher than the upper limit
This commit is contained in:
parent
ff5e7202c6
commit
1fd20151bd
@ -18,6 +18,10 @@ const CURRENCIES = currencies.map((currency) => {
|
||||
};
|
||||
});
|
||||
|
||||
// Stripe has an upper amount limit of 999,999.99
|
||||
// See https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount
|
||||
const MAX_AMOUNT = 999_999.99;
|
||||
|
||||
// TODO: update modals to work fully with Glimmer components
|
||||
@classic
|
||||
export default class ModalTierPrice extends ModalBase {
|
||||
@ -212,6 +216,10 @@ export default class ModalTierPrice extends ModalBase {
|
||||
if (!yearlyAmount || yearlyAmount < 1 || !monthlyAmount || monthlyAmount < 1) {
|
||||
throw new TypeError(`Subscription amount must be at least ${symbol}1.00`);
|
||||
}
|
||||
|
||||
if (yearlyAmount > MAX_AMOUNT || monthlyAmount > MAX_AMOUNT) {
|
||||
throw new TypeError(`Subscription amount cannot be higher than ${symbol}${MAX_AMOUNT}`);
|
||||
}
|
||||
} catch (err) {
|
||||
this.stripePlanError = err.message;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user