From cdce71ea5ce8aee2260288952ebfee3f227aca4f Mon Sep 17 00:00:00 2001 From: Amanda Date: Tue, 13 Aug 2024 12:39:20 -0700 Subject: [PATCH] get external sub by uuid --- .../com/ning/billing/recurly/RecurlyClient.java | 13 +++++++++++++ .../billing/recurly/model/ExternalSubscription.java | 11 +++++++++++ .../recurly/model/TestExternalSubscription.java | 4 +++- .../recurly/model/TestExternalSubscriptions.java | 4 +++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ning/billing/recurly/RecurlyClient.java b/src/main/java/com/ning/billing/recurly/RecurlyClient.java index 59785456..7f1cb402 100644 --- a/src/main/java/com/ning/billing/recurly/RecurlyClient.java +++ b/src/main/java/com/ning/billing/recurly/RecurlyClient.java @@ -1221,6 +1221,19 @@ public ExternalSubscription getExternalSubscription(final String externalSubscri public ExternalSubscription getExternalSubscriptionByExternalId(final String externalSubscriptionExternalId) { return doGET(ExternalSubscriptions.EXTERNAL_SUBSCRIPTIONS_RESOURCE + "/" + urlEncode("external-id-"+externalSubscriptionExternalId), ExternalSubscription.class); } + + /** + * Get a specific External Subscription by uuid + *

+ * Returns the requested external subscriptions + * + * @param externalSubscriptionUuid external subscription uuid + * @return The requested external subscription + */ + public ExternalSubscription getExternalSubscriptionByUuid(final String externalSubscriptionUuid) { + return doGET(ExternalSubscriptions.EXTERNAL_SUBSCRIPTIONS_RESOURCE + "/" + urlEncode("uuid-"+externalSubscriptionUuid), ExternalSubscription.class); + } + /** * Get External Accounts of an account *

diff --git a/src/main/java/com/ning/billing/recurly/model/ExternalSubscription.java b/src/main/java/com/ning/billing/recurly/model/ExternalSubscription.java index 30f92296..01ba9f5c 100644 --- a/src/main/java/com/ning/billing/recurly/model/ExternalSubscription.java +++ b/src/main/java/com/ning/billing/recurly/model/ExternalSubscription.java @@ -58,6 +58,9 @@ public class ExternalSubscription extends RecurlyObject { @XmlElement(name = "app_identifier") private String appIdentifier; + @XmlElement(name = "uuid") + private String uuid; + @XmlElement(name = "quantity") private Integer quantity; @@ -168,6 +171,14 @@ public void setAppIdentifier(final Object appIdentifier) { this.appIdentifier = stringOrNull(appIdentifier); } + public String getUuid() { + return this.uuid; + } + + public void setUuid(final Object uuid) { + this.uuid = stringOrNull(uuid); + } + public Integer getQuantity() { return quantity; } diff --git a/src/test/java/com/ning/billing/recurly/model/TestExternalSubscription.java b/src/test/java/com/ning/billing/recurly/model/TestExternalSubscription.java index 9a50f09b..e37b9dee 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestExternalSubscription.java +++ b/src/test/java/com/ning/billing/recurly/model/TestExternalSubscription.java @@ -30,6 +30,8 @@ public void testDeserialization() throws Exception { "" + " " + " " + + " 1_ext_id" + + " 72bb9966bb5dc3767461ce4368a6b366" + " " + " rgybkg3d1l41" + " apple-code" + @@ -44,7 +46,6 @@ public void testDeserialization() throws Exception { " false" + " com.foo.id" + " 1" + - " 1_ext_id" + " 2022-09-12T18:40:51Z" + " 2022-09-12T18:40:51Z" + " 2022-09-12T18:40:51Z" + @@ -69,6 +70,7 @@ public void testDeserialization() throws Exception { Assert.assertEquals(externalSubscription.getAutoRenew(), Boolean.FALSE); Assert.assertEquals(externalSubscription.getInGracePeriod(), Boolean.FALSE); Assert.assertEquals(externalSubscription.getAppIdentifier(), "com.foo.id"); + Assert.assertEquals(externalSubscription.getUuid(), "72bb9966bb5dc3767461ce4368a6b366"); Assert.assertEquals(externalSubscription.getQuantity(), new Integer(1)); Assert.assertEquals(externalSubscription.getExternalId(), "1_ext_id"); Assert.assertEquals(externalSubscription.getActivatedAt(), new DateTime("2022-09-12T18:40:51Z")); diff --git a/src/test/java/com/ning/billing/recurly/model/TestExternalSubscriptions.java b/src/test/java/com/ning/billing/recurly/model/TestExternalSubscriptions.java index c64b6a35..9d65e07e 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestExternalSubscriptions.java +++ b/src/test/java/com/ning/billing/recurly/model/TestExternalSubscriptions.java @@ -31,6 +31,8 @@ public void testDeserialization() throws Exception { " " + " " + " " + + " 1_ext_id" + + " 72bb9966bb5dc3767461ce4368a6b366" + " " + " rgybkg3d1l41" + " apple-code" + @@ -45,7 +47,6 @@ public void testDeserialization() throws Exception { " false" + " com.foo.id" + " 1" + - " 1_ext_id" + " 2022-09-12T18:40:51Z" + " 2022-09-12T18:40:51Z" + " 2022-09-12T18:40:51Z" + @@ -74,6 +75,7 @@ public void testDeserialization() throws Exception { Assert.assertEquals(externalSubscription.getAutoRenew(), Boolean.FALSE); Assert.assertEquals(externalSubscription.getInGracePeriod(), Boolean.FALSE); Assert.assertEquals(externalSubscription.getAppIdentifier(), "com.foo.id"); + Assert.assertEquals(externalSubscription.getUuid(), "72bb9966bb5dc3767461ce4368a6b366"); Assert.assertEquals(externalSubscription.getQuantity(), new Integer(1)); Assert.assertEquals(externalSubscription.getExternalId(), "1_ext_id"); Assert.assertEquals(externalSubscription.getActivatedAt(), new DateTime("2022-09-12T18:40:51Z"));