Skip to content

Commit

Permalink
Merge pull request #486 from epagerecurly/master
Browse files Browse the repository at this point in the history
adds support for plan vertex_transaction_type
  • Loading branch information
douglasmiller authored Nov 1, 2024
2 parents 6b710b4 + ab5151a commit e2f5295
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/main/java/com/ning/billing/recurly/model/Plan.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public class Plan extends RecurlyObject {
@XmlElement(name = "description")
private String description;

@XmlElement(name = "vertex_transaction_type")
private String vertexTransactionType;

@XmlElement(name = "success_url")
private String successLink;

Expand Down Expand Up @@ -192,6 +195,14 @@ public void setDescription(final Object description) {
this.description = stringOrNull(description);
}

public String getVertexTransactionType() {
return vertexTransactionType;
}

public void setVertexTransactionType(final Object vertexTransactionType) {
this.vertexTransactionType = stringOrNull(vertexTransactionType);
}

public String getSuccessLink() {
return successLink;
}
Expand Down Expand Up @@ -473,6 +484,7 @@ public String toString() {
sb.append(", planCode='").append(planCode).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", vertexTransactionType='").append(vertexTransactionType).append('\'');
sb.append(", successLink='").append(successLink).append('\'');
sb.append(", cancelLink='").append(cancelLink).append('\'');
sb.append(", displayDonationAmounts=").append(displayDonationAmounts);
Expand Down Expand Up @@ -541,6 +553,9 @@ public boolean equals(final Object o) {
if (description != null ? !description.equals(plan.description) : plan.description != null) {
return false;
}
if (vertexTransactionType != null ? !vertexTransactionType.equals(plan.vertexTransactionType) : plan.vertexTransactionType != null) {
return false;
}
if (displayDonationAmounts != null ? !displayDonationAmounts.equals(plan.displayDonationAmounts) : plan.displayDonationAmounts != null) {
return false;
}
Expand Down Expand Up @@ -650,6 +665,7 @@ public int hashCode() {
pricingModel,
rampIntervals,
description,
vertexTransactionType,
successLink,
cancelLink,
displayDonationAmounts,
Expand Down
22 changes: 21 additions & 1 deletion src/test/java/com/ning/billing/recurly/model/TestPlan.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void testDeserializationWithAmounts() throws Exception {
" <plan_code>gold</plan_code>\n" +
" <name>Gold plan</name>\n" +
" <description nil=\"nil\"></description>\n" +
" <vertex_transaction_type nil=\"nil\"></vertex_transaction_type>\n" +
" <success_url nil=\"nil\"></success_url>\n" +
" <cancel_url nil=\"nil\"></cancel_url>\n" +
" <display_donation_amounts type=\"boolean\">false</display_donation_amounts>\n" +
Expand Down Expand Up @@ -85,6 +86,7 @@ public void testDeserializationWithAmounts() throws Exception {
Assert.assertEquals(plan.getTaxExempt(), new Boolean(false));
Assert.assertEquals(plan.getTaxCode(), "digital");
Assert.assertNull(plan.getDescription());
Assert.assertNull(plan.getVertexTransactionType());
Assert.assertNull(plan.getSuccessLink());
Assert.assertNull(plan.getCancelLink());
Assert.assertEquals(24, (int) plan.getTotalBillingCycles());
Expand Down Expand Up @@ -238,5 +240,23 @@ public void testCreateWithCustomFields() throws Exception {
Assert.assertEquals(field.getName(), "food");
}

}
@Test(groups = "fast")
public void testCreateWithVertexTransactionType() throws Exception {
// See https://dev.recurly.com/docs/list-plans
final String planData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<plan href=\"https://api.recurly.com/v2/plans/gold\">\n" +
" <add_ons href=\"https://api.recurly.com/v2/plans/gold/add_ons\"/>\n" +
" <plan_code>gold</plan_code>\n" +
" <name>Gold plan</name>\n" +
" <description>rental</description>\n" +
" <vertex_transaction_type>rental</vertex_transaction_type>\n" +
" <plan_interval_length type=\"integer\">1</plan_interval_length>\n" +
" <plan_interval_unit>months</plan_interval_unit>\n" +
" <pricing_model>ramp</pricing_model>\n" +
"</plan>";

final Plan plan = xmlMapper.readValue(planData, Plan.class);
Assert.assertEquals(plan.getPlanCode(), "gold");
Assert.assertEquals(plan.getVertexTransactionType(), "rental");
}
}

0 comments on commit e2f5295

Please sign in to comment.