Skip to content

Commit

Permalink
Merge pull request #485 from killbilling/get-external-sub-by-uuid
Browse files Browse the repository at this point in the history
Get external sub by uuid
  • Loading branch information
douglasmiller authored Aug 27, 2024
2 parents 27f0c37 + cdce71e commit 0a6c334
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 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 @@ -30,6 +30,8 @@ public void testDeserialization() throws Exception {
"<external_subscription href=\"https://your-subdomain.recurly.com/v2/external_subscriptions/rpap82ntgqqh\">" +
" <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>" +
" <external_invoices href=\"https://your-subdomain.recurly.com/v2/external_subscriptions/tsfnx2vn5wh6/external_invoices\"/>" +
" <external_id>1_ext_id</external_id>" +
" <uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>" +
" <external_product_reference>" +
" <id>rgybkg3d1l41</id>" +
" <reference_code>apple-code</reference_code>" +
Expand All @@ -44,7 +46,6 @@ public void testDeserialization() throws Exception {
" <in_grace_period type=\"boolean\">false</in_grace_period>" +
" <app_identifier>com.foo.id</app_identifier>" +
" <quantity type=\"integer\">1</quantity>" +
" <external_id>1_ext_id</external_id>" +
" <activated_at type=\"datetime\">2022-09-12T18:40:51Z</activated_at>" +
" <canceled_at type=\"datetime\">2022-09-12T18:40:51Z</canceled_at>" +
" <expires_at type=\"datetime\">2022-09-12T18:40:51Z</expires_at>" +
Expand All @@ -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 @@ -31,6 +31,8 @@ public void testDeserialization() throws Exception {
" <external_subscription href=\"https://your-subdomain.recurly.com/v2/external_subscriptions/rpap82ntgqqh\">" +
" <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>" +
" <external_invoices href=\"https://your-subdomain.recurly.com/v2/external_subscriptions/tsfnx2vn5wh6/external_invoices\"/>" +
" <external_id>1_ext_id</external_id>" +
" <uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>" +
" <external_product_reference>" +
" <id>rgybkg3d1l41</id>" +
" <reference_code>apple-code</reference_code>" +
Expand All @@ -45,7 +47,6 @@ public void testDeserialization() throws Exception {
" <in_grace_period type=\"boolean\">false</in_grace_period>" +
" <app_identifier>com.foo.id</app_identifier>" +
" <quantity type=\"integer\">1</quantity>" +
" <external_id>1_ext_id</external_id>" +
" <activated_at type=\"datetime\">2022-09-12T18:40:51Z</activated_at>" +
" <canceled_at type=\"datetime\">2022-09-12T18:40:51Z</canceled_at>" +
" <expires_at type=\"datetime\">2022-09-12T18:40:51Z</expires_at>" +
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 0a6c334

Please sign in to comment.