diff --git a/src/main/java/com/ning/billing/recurly/model/Plan.java b/src/main/java/com/ning/billing/recurly/model/Plan.java index 95729ab5..d14a022e 100644 --- a/src/main/java/com/ning/billing/recurly/model/Plan.java +++ b/src/main/java/com/ning/billing/recurly/model/Plan.java @@ -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; @@ -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; } @@ -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); @@ -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; } @@ -650,6 +665,7 @@ public int hashCode() { pricingModel, rampIntervals, description, + vertexTransactionType, successLink, cancelLink, displayDonationAmounts, diff --git a/src/test/java/com/ning/billing/recurly/model/TestPlan.java b/src/test/java/com/ning/billing/recurly/model/TestPlan.java index 5c7614a4..88ea94cb 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestPlan.java +++ b/src/test/java/com/ning/billing/recurly/model/TestPlan.java @@ -36,6 +36,7 @@ public void testDeserializationWithAmounts() throws Exception { " gold\n" + " Gold plan\n" + " \n" + + " \n" + " \n" + " \n" + " false\n" + @@ -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()); @@ -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 = "\n" + + "\n" + + " \n" + + " gold\n" + + " Gold plan\n" + + " rental\n" + + " rental\n" + + " 1\n" + + " months\n" + + " ramp\n" + + ""; + final Plan plan = xmlMapper.readValue(planData, Plan.class); + Assert.assertEquals(plan.getPlanCode(), "gold"); + Assert.assertEquals(plan.getVertexTransactionType(), "rental"); + } +}