Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add origin_tax_address_source & destination_tax_address_source to business_entity and adjustment resource. #839

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 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 Expand Up @@ -396,6 +406,10 @@ internal void WriteXml(XmlTextWriter xmlWriter, bool embedded = false)
xmlWriter.WriteElementString("end_date", EndDate.Value.ToString("s"));
if (Origin != null)
xmlWriter.WriteElementString("origin", Origin);
if (OriginTaxAddressSource != null)
xmlWriter.WriteElementString("origin_tax_address_source", OriginTaxAddressSource);
if (DestinationTaxAddressSource != null)
xmlWriter.WriteElementString("destination_tax_address_source", DestinationTaxAddressSource);
xmlWriter.WriteEndElement(); // End: adjustment
}

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
Loading