Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get external sub by uuid #485

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading