Skip to content

Commit

Permalink
Add origin_tax_address_source & destination_tax_address_source to bus…
Browse files Browse the repository at this point in the history
…iness_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.
  • Loading branch information
paulorbpinho-fullstacklabs committed Jun 3, 2024
1 parent a3d97b5 commit 6cabe3b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/main/java/com/ning/billing/recurly/model/Adjustment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/ning/billing/recurly/model/BusinessEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -187,6 +209,8 @@ public String toString() {
", name='" + getName() + "'" +
", invoiceDisplayAddress='" + getInvoiceDisplayAddress() + "'" +
", taxAddress='" + getTaxAddress() + "'" +
", originTaxAddressSource='" + getOriginTaxAddressSource() + "'" +
", destinationTaxAddressSource='" + getDestinationTaxAddressSource() + "'" +
", subscriberLocationCountries='" + getSubscriberLocationCountries() + "'" +
", defaultVatNumber='" + getDefaultVatNumber() + "'" +
", defaultRegistrationNumber='" + getDefaultRegistrationNumber() + "'" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public void testDeserialization() throws Exception {
" <total_in_cents type=\"integer\">-2000</total_in_cents>\n" +
" <currency>USD</currency>\n" +
" <taxable type=\"boolean\">false</taxable>\n" +
" <tax_exempt type=\"boolean\">true</tax_exempt>\n" +
" <origin_tax_address_source>Customer tax address</origin_tax_address_source>" +
" <destination_tax_address_source>Business entity tax address</destination_tax_address_source>" +
" <tax_exempt type=\"boolean\">true</tax_exempt>\n" +
" <start_date type=\"dateTime\">2011-08-31T03:30:00Z</start_date>\n" +
" <end_date nil=\"nil\"></end_date>\n" +
" <created_at type=\"dateTime\">2011-08-31T03:30:00Z</created_at>\n" +
Expand All @@ -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(), "Customer tax address");
Assert.assertEquals(adjustment.getDestinationTaxAddressSource(), "Business entity tax address");
Assert.assertEquals((boolean) adjustment.getTaxExempt(), true);
Assert.assertEquals(adjustment.getStartDate(), new DateTime("2011-08-31T03:30:00Z"));
Assert.assertNull(adjustment.getEndDate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public void testSerialization() throws Exception {
" <surcharge_in_cents type=\"integer\">100</surcharge_in_cents>\n" +
" <tax_type>usst</tax_type>\n" +
" <tax_region>CA</tax_region>\n" +
" <origin_tax_address_source>Customer tax address</origin_tax_address_source>" +
" <destination_tax_address_source>Business entity tax address</destination_tax_address_source>" +
" <tax_rate type=\"float\">0.0875</tax_rate>\n" +
" <tax_exempt type=\"boolean\">false</tax_exempt>\n" +
" <tax_code>digital</tax_code>\n" +
Expand Down Expand Up @@ -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(), "Customer tax address");
Assert.assertEquals(adjustment.getDestinationTaxAddressSource(), "Business entity tax address");
Assert.assertEquals(adjustment.getTaxCode(), "digital");
Assert.assertEquals(adjustment.getTaxDetails(), this.getTaxDetails());
Assert.assertEquals(adjustment.getProductCode(), "product123");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void testDeserialization() throws Exception {
" <country>US</country>" +
" <phone>718-555-1234</phone>" +
" </tax_address>" +
" <origin_tax_address_source>Customer tax address</origin_tax_address_source>" +
" <destination_tax_address_source>Business entity tax address</destination_tax_address_source>" +
" <subscriber_location_countries type=\"array\">" +
" <subscriber_location_country>GB</subscriber_location_country>" +
" <subscriber_location_country>CO</subscriber_location_country>" +
Expand Down Expand Up @@ -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(), "Customer tax address");
Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "Business entity tax address");
Assert.assertEquals(subscriberLocationCountries.get(0), "GB");
Assert.assertEquals(subscriberLocationCountries.get(1), "CO");
Assert.assertEquals(businessEntity.getDefaultVatNumber(), "1234");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void testDeserialization() throws Exception {
" <country>US</country>" +
" <phone>718-555-1234</phone>" +
" </tax_address>" +
" <origin_tax_address_source>Customer tax address</origin_tax_address_source>" +
" <destination_tax_address_source>Business entity tax address</destination_tax_address_source>" +
" <subscriber_location_countries type=\"array\">" +
" <subscriber_location_country>GB</subscriber_location_country>" +
" <subscriber_location_country>CO</subscriber_location_country>" +
Expand Down Expand Up @@ -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(), "Customer tax address");
Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "Business entity tax address");
Assert.assertEquals(subscriberLocationCountries.get(0), "GB");
Assert.assertEquals(subscriberLocationCountries.get(1), "CO");
Assert.assertEquals(businessEntity.getDefaultVatNumber(), "1234");
Expand Down

0 comments on commit 6cabe3b

Please sign in to comment.