mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
continuation of PR #8161 Display error notification when attempting to purchase invalid amount of gems - fixes #8145 (#8688)
* Translation string for error notification * Use function instead of a link for paypal * Inject notification service, function to check the amount of gems to purchase, function to handle payments with paypal * Throw error if amount of gems is zero or negative * Add condition to raise error if amount is negative * Added gem errors for gifts 0 or less * Fixed linting and broken test * Fixed test syntax * Added back needed strings * Fixed group locales
This commit is contained in:
committed by
Sabe Jones
parent
48bbc22fb4
commit
e901850a6f
@@ -107,6 +107,9 @@ api.checkout = async function checkout (options, stripeInc) {
|
||||
if (gift.type === 'subscription') {
|
||||
amount = `${shared.content.subscriptionBlocks[gift.subscription.key].price * 100}`;
|
||||
} else {
|
||||
if (gift.gems.amount <= 0) {
|
||||
throw new BadRequest(shared.i18n.t('badAmountOfGemsToPurchase'));
|
||||
}
|
||||
amount = `${gift.gems.amount / 4 * 100}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user