mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 15:16:53 +00:00
Add an interface for one-time purchase retrieval
This commit is contained in:
1 parent
e4b09112f1
commit
5b6d6f28c9
10 files changed
+80
-40
No files matched your search
+4
-6
@@ -23,12 +23,10 @@ import jakarta.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Stream;
|
||||
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||
import org.glassfish.jersey.server.ServerProperties;
|
||||
@@ -258,9 +256,9 @@ class OneTimeDonationControllerTest extends AbstractV1SubscriptionControllerTest
|
||||
@MethodSource
|
||||
void createBoostReceiptPaymentRequired(final ChargeFailure chargeFailure, boolean expectChargeFailure)
|
||||
throws IOException {
|
||||
when(STRIPE_MANAGER.getPaymentDetails(any())).thenReturn(Optional.of(new PaymentDetails(
|
||||
when(STRIPE_MANAGER.claimOneTimePurchase(any())).thenReturn(Optional.of(new PaymentDetails(
|
||||
"id",
|
||||
Collections.emptyMap(),
|
||||
null,
|
||||
PaymentStatus.FAILED,
|
||||
Instant.now(),
|
||||
chargeFailure))
|
||||
@@ -341,9 +339,9 @@ class OneTimeDonationControllerTest extends AbstractV1SubscriptionControllerTest
|
||||
ServerSecretParams.generate().getPublicParams()).createReceiptCredentialRequestContext(
|
||||
new ReceiptSerial(new byte[ReceiptSerial.SIZE])).getRequest();
|
||||
|
||||
when(STRIPE_MANAGER.getPaymentDetails(any())).thenReturn(Optional.of(new PaymentDetails(
|
||||
when(STRIPE_MANAGER.claimOneTimePurchase(any())).thenReturn(Optional.of(new PaymentDetails(
|
||||
"id",
|
||||
Collections.emptyMap(),
|
||||
ONETIME_CONFIG.boost().level(),
|
||||
PaymentStatus.SUCCEEDED,
|
||||
Instant.now(),
|
||||
null)));
|
||||
|
||||
+5
-6
@@ -20,7 +20,6 @@ import com.stripe.model.PaymentIntent;
|
||||
import jakarta.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -271,8 +270,8 @@ public class OneTimeDonationsGrpcServiceTest extends
|
||||
void createBoostReceiptCredentialsPaymentRequired(
|
||||
@Nullable final ChargeFailure chargeFailure,
|
||||
final boolean expectChargeFailure) throws IOException {
|
||||
when(stripeManager.getPaymentDetails(any())).thenReturn(
|
||||
Optional.of(new PaymentDetails("id", Collections.emptyMap(), PaymentStatus.FAILED,
|
||||
when(stripeManager.claimOneTimePurchase(any())).thenReturn(
|
||||
Optional.of(new PaymentDetails("id", null, PaymentStatus.FAILED,
|
||||
clock.instant(), chargeFailure)));
|
||||
|
||||
final CreateBoostReceiptCredentialsResponse response =
|
||||
@@ -305,9 +304,9 @@ public class OneTimeDonationsGrpcServiceTest extends
|
||||
ServerSecretParams.generate().getPublicParams()).createReceiptCredentialRequestContext(
|
||||
new ReceiptSerial(new byte[ReceiptSerial.SIZE])).getRequest();
|
||||
|
||||
when(stripeManager.getPaymentDetails(any())).thenReturn(
|
||||
Optional.of(new PaymentDetails("id", Collections.emptyMap(), PaymentStatus.SUCCEEDED,
|
||||
clock.instant(), null)));
|
||||
when(stripeManager.claimOneTimePurchase(any())).thenReturn(
|
||||
Optional.of(new PaymentDetails("id", oneTimeDonationConfiguration.boost().level(),
|
||||
PaymentStatus.SUCCEEDED, clock.instant(), null)));
|
||||
doThrow(WriteConflictException.class).when(issuedReceiptsManager)
|
||||
.recordIssuance(any(), any(), any(), any());
|
||||
|
||||
|
||||
Reference in new issue
Block a user