From fb7316c9aeae4987ef2fb8629fc9590de6cacdac Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Fri, 19 Nov 2021 11:36:01 -0600 Subject: [PATCH] Return subscription status string in GET --- .../controllers/SubscriptionController.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java index 2062d8041..2513e3eb4 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java @@ -606,6 +606,7 @@ public class SubscriptionController { private final boolean cancelAtPeriodEnd; private final String currency; private final BigDecimal amount; + private final String status; public Subscription( @JsonProperty("level") long level, @@ -614,7 +615,8 @@ public class SubscriptionController { @JsonProperty("active") boolean active, @JsonProperty("cancelAtPeriodEnd") boolean cancelAtPeriodEnd, @JsonProperty("currency") String currency, - @JsonProperty("amount") BigDecimal amount) { + @JsonProperty("amount") BigDecimal amount, + @JsonProperty("status") String status) { this.level = level; this.billingCycleAnchor = billingCycleAnchor; this.endOfCurrentPeriod = endOfCurrentPeriod; @@ -622,6 +624,7 @@ public class SubscriptionController { this.cancelAtPeriodEnd = cancelAtPeriodEnd; this.currency = currency; this.amount = amount; + this.status = status; } public long getLevel() { @@ -651,6 +654,10 @@ public class SubscriptionController { public BigDecimal getAmount() { return amount; } + + public String getStatus() { + return status; + } } private final Subscription subscription; @@ -691,7 +698,8 @@ public class SubscriptionController { Objects.equals(subscription.getStatus(), "active"), subscription.getCancelAtPeriodEnd(), price.getCurrency().toUpperCase(Locale.ROOT), - price.getUnitAmountDecimal() + price.getUnitAmountDecimal(), + subscription.getStatus() ))).build()))); }); }