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:
Keith Holliday
2017-07-06 14:43:43 -06:00
committed by Sabe Jones
parent 48bbc22fb4
commit e901850a6f
9 changed files with 101 additions and 4 deletions

View File

@@ -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}`;
}
}