Skip to content

Commit

Permalink
Merge pull request #482 from killbilling/v2_origin_destination_tax_ad…
Browse files Browse the repository at this point in the history
…dress

Add origin_tax_address_source & destination_tax_address_source to business_entity and adjustment resource.
  • Loading branch information
amandamfielding authored Jul 3, 2024
2 parents e52c09b + 41f6760 commit 5578663
Show file tree
Hide file tree
Showing 6 changed files with 67 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>origin</origin_tax_address_source>" +
" <destination_tax_address_source>destination</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(), "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());
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>origin</origin_tax_address_source>" +
" <destination_tax_address_source>destination</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(), "origin");
Assert.assertEquals(adjustment.getDestinationTaxAddressSource(), "destination");
Assert.assertEquals(adjustment.getTaxCode(), "digital");
Assert.assertEquals(adjustment.getTaxDetails(), this.getTaxDetails());
Assert.assertEquals(adjustment.getProductCode(), "product123");
Expand Down Expand Up @@ -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<TaxDetail> getTaxDetails() {
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>origin</origin_tax_address_source>" +
" <destination_tax_address_source>destination</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(), "origin");
Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "destination");
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>origin</origin_tax_address_source>" +
" <destination_tax_address_source>destination</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(), "origin");
Assert.assertEquals(businessEntity.getDestinationTaxAddressSource(), "destination");
Assert.assertEquals(subscriberLocationCountries.get(0), "GB");
Assert.assertEquals(subscriberLocationCountries.get(1), "CO");
Assert.assertEquals(businessEntity.getDefaultVatNumber(), "1234");
Expand Down

0 comments on commit 5578663

Please sign in to comment.