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.
  • Loading branch information
paulorbpinho-fullstacklabs committed Jun 7, 2024
1 parent 351dc00 commit 9d5ca79
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Library/Adjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public enum RevenueSchedule : short
public string TaxType { get; private set; }
public decimal? TaxRate { get; private set; }
public string TaxRegion { get; private set; }
public string OriginTaxAddressSource { get; set; }
public string DestinationTaxAddressSource { get; set; }

public AdjustmentState State { get; protected set; }

Expand Down Expand Up @@ -284,6 +286,14 @@ internal override void ReadXml(XmlTextReader reader)
TaxRegion = reader.ReadElementContentAsString();
break;

case "origin_tax_address_source":
OriginTaxAddressSource = reader.ReadElementContentAsString();
break;

case "destination_tax_address_source":
DestinationTaxAddressSource = reader.ReadElementContentAsString();
break;

case "credit_reason_code":
CreditReasonCode = reader.ReadElementContentAsString();
break;
Expand Down
9 changes: 9 additions & 0 deletions Library/BusinessEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class BusinessEntity : RecurlyEntity
public string Name { get; set; }
public InvoiceDisplayAddress InvoiceDisplayAddress { get; set; }
public TaxAddress TaxAddress { get; set; }
public string OriginTaxAddressSource { get; set; }
public string DestinationTaxAddressSource { get; set; }

public string DefaultVatNumber { get; set; }
public string DefaultRegistrationNumber { get; set; }
public string DefaultLiabilityGlAccountId { get; private set; }
Expand Down Expand Up @@ -74,6 +77,12 @@ internal override void ReadXml(XmlTextReader reader)
case "tax_address":
TaxAddress = new TaxAddress(reader);
break;
case "origin_tax_address_source":
OriginTaxAddressSource = reader.ReadElementContentAsString();
break;
case "destination_tax_address_source":
DestinationTaxAddressSource = reader.ReadElementContentAsString();
break;
case "subscriber_location_countries":
while (reader.Read())
{
Expand Down
6 changes: 6 additions & 0 deletions Test/AdjustmentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public void CreateAdjustmentWithProperties()
adjustment.Quantity = quantity;
adjustment.AccountingCode = accountingCode;
adjustment.UnitAmountInCents = unitAmountInCents;
adjustment.OriginTaxAddressSource = "origin";
adjustment.DestinationTaxAddressSource = "destination";

adjustment.Create();

Expand All @@ -58,6 +60,8 @@ public void CreateAdjustmentWithProperties()
Assert.Equal(quantity, adjustment.Quantity);
Assert.Equal(accountingCode, adjustment.AccountingCode);
Assert.Equal(unitAmountInCents, adjustment.UnitAmountInCents);
Assert.Equal("origin", adjustment.OriginTaxAddressSource);
Assert.Equal("destination", adjustment.DestinationTaxAddressSource);
}

[RecurlyFact(TestEnvironment.Type.Integration)]
Expand Down Expand Up @@ -216,6 +220,8 @@ public void AdjustmentGet()
var fromService = Adjustments.Get(adjustment.Uuid);

fromService.Uuid.Should().NotBeNull();
fromService.OriginTaxAddressSource.Should().Be("origin");
fromService.DestinationTaxAddressSource.Should().Be("destination");
}

[RecurlyFact(TestEnvironment.Type.Integration)]
Expand Down
2 changes: 2 additions & 0 deletions Test/BusinessEntityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public void LookupBusinessEntity()
businessEntity.InvoiceDisplayAddress.Country.Should().Be("US");
businessEntity.TaxAddress.Country.Should().Be("US");
businessEntity.GetInvoices().Should().BeOfType<InvoiceList>();
businessEntity.OriginTaxAddressSource.Should().Be("origin");
businessEntity.DestinationTaxAddressSource.Should().Be("destination");
}

[RecurlyFact(TestEnvironment.Type.Unit)]
Expand Down

0 comments on commit 9d5ca79

Please sign in to comment.