Apply stripe conversion factor to gift badge amount check

This commit is contained in:
Ehren Kret
2022-04-29 13:48:10 -05:00
parent 63be7b93ce
commit 7b7d309105
2 changed files with 15 additions and 1 deletions

View File

@@ -527,7 +527,7 @@ public class SubscriptionController {
}
if (request.level == giftConfiguration.level()) {
BigDecimal amountConfigured = giftConfiguration.currencies().get(request.currency.toLowerCase(Locale.ROOT));
if (amountConfigured == null || !amountConfigured.equals(BigDecimal.valueOf(request.amount))) {
if (amountConfigured == null || !stripeManager.convertConfiguredAmountToStripeAmount(request.currency, amountConfigured).equals(BigDecimal.valueOf(request.amount))) {
throw new WebApplicationException(Response.status(Status.CONFLICT).entity(Map.of("error", "level_amount_mismatch")).build());
}
}