Compare commits

..
5 changed files with 10 additions and 7 deletions

No files matched your search

@@ -38,7 +38,7 @@ public class FixerClient {
HttpResponse.BodyHandlers.ofString());
if (response.statusCode() < 200 || response.statusCode() >= 300) {
throw new FixerException("Bad response: " + response.statusCode() + " " + response.toString());
throw new FixerException("Bad response: " + response.statusCode() + " " + response.toString().replaceAll(apiKey, "***"));
}
final FixerResponse parsedResponse = SystemMapper.jsonMapper().readValue(response.body(), FixerResponse.class);
@@ -49,6 +49,8 @@ public class OneTimeDonationUtil {
}
/// Validates a request is for a valid one-time donation level and is at least the configured minimum for the currency
/// and payment method.
public static OneTimeDonationRequestValidationResult validateOneTimeDonationRequest(
final String currency,
final long amount,
@@ -181,7 +181,7 @@ public class MessagesManager {
final ServiceIdentifier sourceServiceIdentifier =
ServiceIdentifier.fromByteString(message.getSourceServiceId());
if (!accountIdentifier.equals(sourceServiceIdentifier.uuid())) {
if (!accountIdentifier.equals(sourceServiceIdentifier.uuid()) && message.getType() != Envelope.Type.SERVER_DELIVERY_RECEIPT) {
// Note that this is an asynchronous, best-effort, fire-and-forget operation
reportMessageManager.store(sourceServiceIdentifier.toServiceIdentifierString(), messageGuid);
}
@@ -40,6 +40,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.junitpioneer.jupiter.cartesian.CartesianTest;
import org.signal.libsignal.protocol.InvalidMessageException;
import org.signal.libsignal.protocol.InvalidVersionException;
import org.signal.libsignal.protocol.SealedSenderMultiRecipientMessage;
@@ -82,12 +83,12 @@ class MessagesManagerTest {
experimentEnrollmentManager);
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
void insert(final boolean mirrorInsert) {
@CartesianTest
void insert(@CartesianTest.Enum Envelope.Type envelopeType, @CartesianTest.Values(booleans = {true, false}) final boolean mirrorInsert) {
final UUID sourceAci = UUID.randomUUID();
final Envelope message = Envelope.newBuilder()
.setSourceServiceId(new AciServiceIdentifier(sourceAci).toCompactByteString())
.setType(envelopeType)
.build();
if (mirrorInsert) {
@@ -110,7 +111,7 @@ class MessagesManagerTest {
messagesManager.insert(destinationUuid, Map.of(Device.PRIMARY_ID, message));
verify(reportMessageManager).store(eq(sourceAci.toString()), any(UUID.class));
verify(reportMessageManager, times(envelopeType.equals(Envelope.Type.SERVER_DELIVERY_RECEIPT) ? 0 : 1)).store(eq(sourceAci.toString()), any(UUID.class));
final Envelope syncMessage = Envelope.newBuilder(message)
.setSourceServiceId(new AciServiceIdentifier(destinationUuid).toCompactByteString())