From 41f67607db938bfe6f1e6f97b1b29f019534264f Mon Sep 17 00:00:00 2001 From: Paulo Pinho Date: Mon, 3 Jun 2024 09:38:05 -0300 Subject: [PATCH] Add origin_tax_address_source & destination_tax_address_source to business_entity and adjustment resource. Changes on model BusinessEntity and Adjustment to get those params. Add tests for origin_tax_address_source and destination_tax_address_source. --- .../billing/recurly/model/Adjustment.java | 24 +++++++++++++++++++ .../billing/recurly/model/BusinessEntity.java | 24 +++++++++++++++++++ .../recurly/model/TestAdjustements.java | 6 ++++- .../billing/recurly/model/TestAdjustment.java | 6 +++++ .../recurly/model/TestBusinessEntities.java | 4 ++++ .../recurly/model/TestBusinessEntity.java | 4 ++++ 6 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ning/billing/recurly/model/Adjustment.java b/src/main/java/com/ning/billing/recurly/model/Adjustment.java index 2c2f2db95..94c66fd9c 100644 --- a/src/main/java/com/ning/billing/recurly/model/Adjustment.java +++ b/src/main/java/com/ning/billing/recurly/model/Adjustment.java @@ -90,6 +90,12 @@ public class Adjustment extends RecurlyObject { @XmlElement(name = "tax_region") private String taxRegion; + @XmlElement(name = "origin_tax_address_source") + private String originTaxAddressSource; + + @XmlElement(name = "destination_tax_address_source") + private String destinationTaxAddressSource; + @XmlElement(name = "tax_rate") private String taxRate; @@ -340,6 +346,22 @@ public void setTaxRegion(final Object taxRegion) { this.taxRegion = stringOrNull(taxRegion); } + public void setOriginTaxAddressSource(final Object originTaxAddressSource) { + this.originTaxAddressSource = stringOrNull(originTaxAddressSource); + } + + public String getOriginTaxAddressSource() { + return this.originTaxAddressSource; + } + + public void setDestinationTaxAddressSource(final Object destinationTaxAddressSource) { + this.destinationTaxAddressSource = stringOrNull(destinationTaxAddressSource); + } + + public String getDestinationTaxAddressSource() { + return this.destinationTaxAddressSource; + } + public String getTaxRate() { return taxRate; } @@ -557,6 +579,8 @@ public String toString() { sb.append(", taxInCents=").append(taxInCents); sb.append(", taxType=").append(taxType); sb.append(", taxRegion=").append(taxRegion); + sb.append(", originTaxAddressSource=").append(originTaxAddressSource); + sb.append(", destinationTaxAddressSource=").append(destinationTaxAddressSource); sb.append(", taxRate=").append(taxRate); sb.append(", taxCode=").append(taxCode); sb.append(", taxExempt=").append(taxExempt); diff --git a/src/main/java/com/ning/billing/recurly/model/BusinessEntity.java b/src/main/java/com/ning/billing/recurly/model/BusinessEntity.java index 0f3db458a..63ea3660f 100644 --- a/src/main/java/com/ning/billing/recurly/model/BusinessEntity.java +++ b/src/main/java/com/ning/billing/recurly/model/BusinessEntity.java @@ -41,6 +41,12 @@ public class BusinessEntity extends RecurlyObject { @XmlElement(name = "tax_address") private TaxAddress taxAddress; + @XmlElement(name = "origin_tax_address_source") + private String originTaxAddressSource; + + @XmlElement(name = "destination_tax_address_source") + private String destinationTaxAddressSource; + @XmlList @XmlElementWrapper(name = "subscriber_location_countries") @XmlElement(name = "subscriber_location_country") @@ -107,6 +113,22 @@ public TaxAddress getTaxAddress() { return this.taxAddress; } + public void setOriginTaxAddressSource(final Object originTaxAddressSource) { + this.originTaxAddressSource = stringOrNull(originTaxAddressSource); + } + + public String getOriginTaxAddressSource() { + return this.originTaxAddressSource; + } + + public void setDestinationTaxAddressSource(final Object destinationTaxAddressSource) { + this.destinationTaxAddressSource = stringOrNull(destinationTaxAddressSource); + } + + public String getDestinationTaxAddressSource() { + return this.destinationTaxAddressSource; + } + public void setDefaultVatNumber(final Object defaultVatNumber) { this.defaultVatNumber = stringOrNull(defaultVatNumber); } @@ -187,6 +209,8 @@ public String toString() { ", name='" + getName() + "'" + ", invoiceDisplayAddress='" + getInvoiceDisplayAddress() + "'" + ", taxAddress='" + getTaxAddress() + "'" + + ", originTaxAddressSource='" + getOriginTaxAddressSource() + "'" + + ", destinationTaxAddressSource='" + getDestinationTaxAddressSource() + "'" + ", subscriberLocationCountries='" + getSubscriberLocationCountries() + "'" + ", defaultVatNumber='" + getDefaultVatNumber() + "'" + ", defaultRegistrationNumber='" + getDefaultRegistrationNumber() + "'" + diff --git a/src/test/java/com/ning/billing/recurly/model/TestAdjustements.java b/src/test/java/com/ning/billing/recurly/model/TestAdjustements.java index b0307aa0e..551637ba1 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestAdjustements.java +++ b/src/test/java/com/ning/billing/recurly/model/TestAdjustements.java @@ -41,7 +41,9 @@ public void testDeserialization() throws Exception { " -2000\n" + " USD\n" + " false\n" + - " true\n" + + " origin" + + " destination" + + " true\n" + " 2011-08-31T03:30:00Z\n" + " \n" + " 2011-08-31T03:30:00Z\n" + @@ -66,6 +68,8 @@ public void testDeserialization() throws Exception { Assert.assertEquals((int) adjustment.getTotalInCents(), -2000); Assert.assertEquals(adjustment.getCurrency(), "USD"); Assert.assertEquals((boolean) adjustment.getTaxable(), false); + Assert.assertEquals(adjustment.getOriginTaxAddressSource(), "origin"); + Assert.assertEquals(adjustment.getDestinationTaxAddressSource(), "destination"); Assert.assertEquals((boolean) adjustment.getTaxExempt(), true); Assert.assertEquals(adjustment.getStartDate(), new DateTime("2011-08-31T03:30:00Z")); Assert.assertNull(adjustment.getEndDate()); diff --git a/src/test/java/com/ning/billing/recurly/model/TestAdjustment.java b/src/test/java/com/ning/billing/recurly/model/TestAdjustment.java index ef370c450..5148f2f6b 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestAdjustment.java +++ b/src/test/java/com/ning/billing/recurly/model/TestAdjustment.java @@ -56,6 +56,8 @@ public void testSerialization() throws Exception { " 100\n" + " usst\n" + " CA\n" + + " origin" + + " destination" + " 0.0875\n" + " false\n" + " digital\n" + @@ -103,6 +105,8 @@ public void testSerialization() throws Exception { Assert.assertEquals(adjustment.getType(), "charge"); Assert.assertEquals(adjustment.getTaxType(), "usst"); Assert.assertEquals(adjustment.getTaxRegion(), "CA"); + Assert.assertEquals(adjustment.getOriginTaxAddressSource(), "origin"); + Assert.assertEquals(adjustment.getDestinationTaxAddressSource(), "destination"); Assert.assertEquals(adjustment.getTaxCode(), "digital"); Assert.assertEquals(adjustment.getTaxDetails(), this.getTaxDetails()); Assert.assertEquals(adjustment.getProductCode(), "product123"); @@ -137,6 +141,8 @@ public void testSerialization() throws Exception { Assert.assertEquals(readValue.getEndDate(), adjustment.getEndDate()); Assert.assertEquals(readValue.getCreatedAt(), adjustment.getCreatedAt()); Assert.assertEquals(readValue.getRevenueScheduleType(), adjustment.getRevenueScheduleType()); + Assert.assertEquals(readValue.getOriginTaxAddressSource(), adjustment.getOriginTaxAddressSource()); + Assert.assertEquals(readValue.getDestinationTaxAddressSource(), adjustment.getDestinationTaxAddressSource()); } private List getTaxDetails() { diff --git a/src/test/java/com/ning/billing/recurly/model/TestBusinessEntities.java b/src/test/java/com/ning/billing/recurly/model/TestBusinessEntities.java index 382437329..2a2e2876d 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestBusinessEntities.java +++ b/src/test/java/com/ning/billing/recurly/model/TestBusinessEntities.java @@ -53,6 +53,8 @@ public void testDeserialization() throws Exception { " US" + " 718-555-1234" + " " + + " origin" + + " destination" + " " + " GB" + " CO" + @@ -91,6 +93,8 @@ public void testDeserialization() throws Exception { Assert.assertEquals(businessEntity.getTaxAddress().getZip(), "94605"); Assert.assertEquals(businessEntity.getTaxAddress().getCountry(), "US"); Assert.assertEquals(businessEntity.getTaxAddress().getPhone(), "718-555-1234"); + Assert.assertEquals(businessEntity.getOriginTaxAddressSource(), "origin"); + Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "destination"); Assert.assertEquals(subscriberLocationCountries.get(0), "GB"); Assert.assertEquals(subscriberLocationCountries.get(1), "CO"); Assert.assertEquals(businessEntity.getDefaultVatNumber(), "1234"); diff --git a/src/test/java/com/ning/billing/recurly/model/TestBusinessEntity.java b/src/test/java/com/ning/billing/recurly/model/TestBusinessEntity.java index 7b0bd21b9..d27615400 100644 --- a/src/test/java/com/ning/billing/recurly/model/TestBusinessEntity.java +++ b/src/test/java/com/ning/billing/recurly/model/TestBusinessEntity.java @@ -52,6 +52,8 @@ public void testDeserialization() throws Exception { " US" + " 718-555-1234" + " " + + " origin" + + " destination" + " " + " GB" + " CO" + @@ -86,6 +88,8 @@ public void testDeserialization() throws Exception { Assert.assertEquals(businessEntity.getTaxAddress().getZip(), "94605"); Assert.assertEquals(businessEntity.getTaxAddress().getCountry(), "US"); Assert.assertEquals(businessEntity.getTaxAddress().getPhone(), "718-555-1234"); + Assert.assertEquals(businessEntity.getOriginTaxAddressSource(), "origin"); + Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "destination"); Assert.assertEquals(subscriberLocationCountries.get(0), "GB"); Assert.assertEquals(subscriberLocationCountries.get(1), "CO"); Assert.assertEquals(businessEntity.getDefaultVatNumber(), "1234");