Make gift amount validation consistent between PayPal and Stripe

This commit is contained in:
Chris Eager authored and Chris Eager committed 2026-04-13 17:12:35 -05:00
1 parent 7b8141d174
commit b5e490b987
3 files changed
+22 -63

No files matched your search

@@ -35,7 +35,6 @@ class AbstractV1SubscriptionControllerTest {
static final ServerZkReceiptOperations ZK_OPS = mock(ServerZkReceiptOperations.class);
/**
* Encapsulates {@code static} configuration, to keep the class header simpler and avoid illegal forward references
*/
@@ -158,23 +158,6 @@ class OneTimeDonationControllerTest extends AbstractV1SubscriptionControllerTest
assertThat(responseMap.get("error")).isEqualTo("unsupported_currency");
}
@Test
void testCreateBoostPaymentIntentLevelAmountMismatch() {
when(STRIPE_MANAGER.getSupportedCurrenciesForPaymentMethod(PaymentMethod.CARD))
.thenReturn(Set.of("usd", "jpy", "bif", "eur"));
final Response response = RESOURCE_EXTENSION.target("/v1/subscription/boost/create")
.request()
.post(Entity.json("""
{
"currency": "USD",
"amount": 25,
"level": 100
}
"""
));
assertThat(response.getStatus()).isEqualTo(409);
}
@Test
void testCreateBoostPaymentIntent() {
when(STRIPE_MANAGER.getSupportedCurrenciesForPaymentMethod(PaymentMethod.CARD))
@@ -268,7 +251,8 @@ class OneTimeDonationControllerTest extends AbstractV1SubscriptionControllerTest
@Test
void confirmPaypalBoostProcessorError() {
when(BRAINTREE_MANAGER.getSupportedCurrenciesForPaymentMethod(PaymentMethod.PAYPAL))
.thenReturn(Set.of("usd", "jpy", "bif", "eur"));
when(BRAINTREE_MANAGER.captureOneTimePayment(anyString(), anyString(), anyString(), anyString(), anyLong(),
anyLong(), any()))
.thenReturn(CompletableFuture.failedFuture(new SubscriptionProcessorException(PaymentProvider.BRAINTREE,
@@ -280,7 +264,7 @@ class OneTimeDonationControllerTest extends AbstractV1SubscriptionControllerTest
"paymentId", "PAYID-456",
"paymentToken", "EC-789",
"currency", "usd",
"amount", 123)));
"amount", 300)));
assertThat(response.getStatus()).isEqualTo(SubscriptionExceptionMapper.PROCESSOR_ERROR_STATUS_CODE);