Fix potentially null errorCode in switch

This commit is contained in:
Chris Eager authored and GitHub committed 2025-12-05 10:54:58 -05:00
1 parent 92f8623ad8
commit b887d1f7c0
1 file changed
+3 -1
@@ -230,7 +230,9 @@ public class StripeManager implements CustomerAwareSubscriptionPaymentProcessor
try {
return stripeClient.v1().paymentIntents().create(builder.build(), commonOptions());
} catch (StripeException e) {
final String errorCode = StringUtils.lowerCase(e.getCode(), Locale.ROOT);
final String errorCode = e.getCode() == null
? "unknown"
: e.getCode().toLowerCase(Locale.ROOT);
switch (errorCode) {
case "amount_too_small","amount_too_large" ->
throw ExceptionUtils.wrap(new SubscriptionInvalidAmountException(errorCode));