mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-01 14:13:22 +01:00
Add backupSubscription field to configuration object.
This commit is contained in:
committed by
Greyson Parrelli
parent
d9e9fe1d6a
commit
735a8e680c
@@ -19,7 +19,7 @@ import org.whispersystems.signalservice.internal.ServiceResponse;
|
||||
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
|
||||
import org.whispersystems.signalservice.internal.push.BankMandate;
|
||||
import org.whispersystems.signalservice.internal.push.DonationProcessor;
|
||||
import org.whispersystems.signalservice.internal.push.DonationsConfiguration;
|
||||
import org.whispersystems.signalservice.internal.push.SubscriptionsConfiguration;
|
||||
import org.whispersystems.signalservice.internal.push.PushServiceSocket;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -42,8 +42,8 @@ public class DonationsService {
|
||||
|
||||
private final PushServiceSocket pushServiceSocket;
|
||||
|
||||
private final AtomicReference<CacheEntry<DonationsConfiguration>> donationsConfigurationCache = new AtomicReference<>(null);
|
||||
private final AtomicReference<CacheEntry<BankMandate>> sepaBankMandateCache = new AtomicReference<>(null);
|
||||
private final AtomicReference<CacheEntry<SubscriptionsConfiguration>> donationsConfigurationCache = new AtomicReference<>(null);
|
||||
private final AtomicReference<CacheEntry<BankMandate>> sepaBankMandateCache = new AtomicReference<>(null);
|
||||
|
||||
private static class CacheEntry<T> {
|
||||
private final T cachedValue;
|
||||
@@ -111,7 +111,7 @@ public class DonationsService {
|
||||
return wrapInServiceResponse(() -> new Pair<>(pushServiceSocket.submitBoostReceiptCredentials(paymentIntentId, receiptCredentialRequest, processor), 200));
|
||||
}
|
||||
|
||||
public ServiceResponse<DonationsConfiguration> getDonationsConfiguration(Locale locale) {
|
||||
public ServiceResponse<SubscriptionsConfiguration> getDonationsConfiguration(Locale locale) {
|
||||
return getCachedValue(
|
||||
locale,
|
||||
donationsConfigurationCache,
|
||||
|
||||
@@ -1348,11 +1348,11 @@ public class PushServiceSocket {
|
||||
/**
|
||||
* Get the DonationsConfiguration pointed at by /v1/subscriptions/configuration
|
||||
*/
|
||||
public DonationsConfiguration getDonationsConfiguration(Locale locale) throws IOException {
|
||||
public SubscriptionsConfiguration getDonationsConfiguration(Locale locale) throws IOException {
|
||||
Map<String, String> headers = Collections.singletonMap("Accept-Language", locale.getLanguage() + "-" + locale.getCountry());
|
||||
String result = makeServiceRequestWithoutAuthentication(DONATIONS_CONFIGURATION, "GET", null, headers, NO_HANDLER);
|
||||
|
||||
return JsonUtil.fromJson(result, DonationsConfiguration.class);
|
||||
return JsonUtil.fromJson(result, SubscriptionsConfiguration.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Response JSON for a call to /v1/subscriptions/configuration
|
||||
*/
|
||||
public class DonationsConfiguration {
|
||||
public class SubscriptionsConfiguration {
|
||||
|
||||
public static final String PAYPAL = "PAYPAL";
|
||||
public static final String CARD = "CARD";
|
||||
@@ -44,6 +44,9 @@ public class DonationsConfiguration {
|
||||
@JsonProperty("subscription")
|
||||
private Map<Integer, BigDecimal> subscription;
|
||||
|
||||
@JsonProperty("backupSubscription")
|
||||
private Map<Integer, BigDecimal> backupSubscription;
|
||||
|
||||
@JsonProperty("supportedPaymentMethods")
|
||||
private Set<String> supportedPaymentMethods;
|
||||
|
||||
@@ -59,6 +62,10 @@ public class DonationsConfiguration {
|
||||
return subscription;
|
||||
}
|
||||
|
||||
public Map<Integer, BigDecimal> getBackupSubscription() {
|
||||
return backupSubscription;
|
||||
}
|
||||
|
||||
public Set<String> getSupportedPaymentMethods() {
|
||||
return supportedPaymentMethods;
|
||||
}
|
||||
Reference in New Issue
Block a user