mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 11:46:53 +00:00
Make gift amount validation consistent between PayPal and Stripe
This commit is contained in:
1 parent
7b8141d174
commit
b5e490b987
3 files changed
+22
-63
No files matched your search
-1
@@ -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
|
||||
*/
|
||||
|
||||
+3
-19
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user