Skip to content

Commit

Permalink
Merge pull request #483 from killbilling/v2_get_external_subscription…
Browse files Browse the repository at this point in the history
…_by_external_id

GET external_subscription by external_id
  • Loading branch information
amandamfielding authored Jul 3, 2024
2 parents a3d97b5 + 67772db commit e52c09b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/ning/billing/recurly/RecurlyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,17 @@ public ExternalSubscription getExternalSubscription(final String externalSubscri
return doGET(ExternalSubscriptions.EXTERNAL_SUBSCRIPTIONS_RESOURCE + "/" + urlEncode(externalSubscriptionUuid), ExternalSubscription.class);
}

/**
* Get a specific External Subscription by external id
* <p>
* Returns the requested external subscriptions
*
* @param externalSubscriptionExternalId external subscription external id
* @return The requested external subscription
*/
public ExternalSubscription getExternalSubscriptionByExternalId(final String externalSubscriptionExternalId) {
return doGET(ExternalSubscriptions.EXTERNAL_SUBSCRIPTIONS_RESOURCE + "/" + urlEncode("external-id-"+externalSubscriptionExternalId), ExternalSubscription.class);
}
/**
* Get External Accounts of an account
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public class ExternalSubscription extends RecurlyObject {
@XmlElement(name = "last_purchased")
private DateTime lastPurchased;

@XmlElement(name = "imported")
private Boolean imported;

@XmlElement(name = "test")
private Boolean test;

@XmlElement(name = "auto_renew")
private Boolean autoRenew;

Expand Down Expand Up @@ -138,6 +144,22 @@ public void setInGracePeriod(final Object inGracePeriod) {
this.inGracePeriod = booleanOrNull(inGracePeriod);
}

public Boolean getImported() {
return imported;
}

public void setImported(final Object imported) {
this.imported = booleanOrNull(imported);
}

public Boolean getTest() {
return test;
}

public void setTest(final Object test) {
this.test = booleanOrNull(test);
}

public String getAppIdentifier() {
return this.appIdentifier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public void testDeserialization() throws Exception {
" <updated_at type=\"datetime\">2022-09-12T18:40:51Z</updated_at>" +
" </external_product_reference>" +
" <last_purchased type=\"datetime\">2022-09-12T18:40:51Z</last_purchased>" +
" <imported type=\"boolean\">false</imported>" +
" <test type=\"boolean\">false</test>" +
" <auto_renew type=\"boolean\">false</auto_renew>" +
" <in_grace_period type=\"boolean\">false</in_grace_period>" +
" <app_identifier>com.foo.id</app_identifier>" +
Expand All @@ -62,6 +64,8 @@ public void testDeserialization() throws Exception {
Assert.assertEquals(externalSubscription.getExternalProductReference().getCreatedAt(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getExternalProductReference().getUpdatedAt(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getLastPurchased(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getImported(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getTest(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getAutoRenew(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getInGracePeriod(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getAppIdentifier(), "com.foo.id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public void testDeserialization() throws Exception {
" <updated_at type=\"datetime\">2022-09-12T18:40:51Z</updated_at>" +
" </external_product_reference>" +
" <last_purchased type=\"datetime\">2022-09-12T18:40:51Z</last_purchased>" +
" <imported type=\"boolean\">false</imported>" +
" <test type=\"boolean\">false</test>" +
" <auto_renew type=\"boolean\">false</auto_renew>" +
" <in_grace_period type=\"boolean\">false</in_grace_period>" +
" <app_identifier>com.foo.id</app_identifier>" +
Expand Down Expand Up @@ -67,6 +69,8 @@ public void testDeserialization() throws Exception {
Assert.assertEquals(externalSubscription.getExternalProductReference().getCreatedAt(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getExternalProductReference().getUpdatedAt(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getLastPurchased(), new DateTime("2022-09-12T18:40:51Z"));
Assert.assertEquals(externalSubscription.getImported(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getTest(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getAutoRenew(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getInGracePeriod(), Boolean.FALSE);
Assert.assertEquals(externalSubscription.getAppIdentifier(), "com.foo.id");
Expand Down

0 comments on commit e52c09b

Please sign in to comment.