Skip to content

Commit

Permalink
get external sub by uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
amandamfielding committed Aug 13, 2024
1 parent a93a23a commit 3f5ec89
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/com/ning/billing/recurly/RecurlyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>
* 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
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void testDeserialization() throws Exception {
" <created_at type=\"datetime\">2022-09-12T18:40:51Z</created_at>" +
" <updated_at type=\"datetime\">2022-09-12T18:40:51Z</updated_at>" +
" </external_product_reference>" +
" <uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>" +
" <last_purchased type=\"datetime\">2022-09-12T18:40:51Z</last_purchased>" +
" <imported type=\"boolean\">false</imported>" +
" <test type=\"boolean\">false</test>" +
Expand Down Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void testDeserialization() throws Exception {
" <created_at type=\"datetime\">2022-09-12T18:40:51Z</created_at>" +
" <updated_at type=\"datetime\">2022-09-12T18:40:51Z</updated_at>" +
" </external_product_reference>" +
" <uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>" +
" <last_purchased type=\"datetime\">2022-09-12T18:40:51Z</last_purchased>" +
" <imported type=\"boolean\">false</imported>" +
" <test type=\"boolean\">false</test>" +
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit 3f5ec89

Please sign in to comment.