Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Adding tax id fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-allen-shippo committed Apr 21, 2021
1 parent ce2b521 commit c9f81c7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Shippo/CustomsDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ public class ExporterIdentification : ShippoId
{
[JsonProperty(PropertyName = "eori_number")]
public object EoriNumber { get; set; }

[JsonProperty(PropertyName = "tax_id")]
public TaxId TaxId { get; set; }
}

[JsonObject(MemberSerialization.OptIn)]
public class TaxId : ShippoId
{
[JsonProperty(PropertyName = "number")]
public object Number { get; set; }

[JsonProperty(PropertyName = "type")]
public object Type { get; set; }
}

[JsonObject(MemberSerialization.OptIn)]
Expand Down
13 changes: 11 additions & 2 deletions ShippoTesting/CustomsDeclarationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public void TestValidCreate()
Assert.AreEqual(invoicedChargesParameters["other_fees"], testObject.InvoicedCharges.OtherFees);
Assert.AreEqual(invoicedChargesParameters["currency"], testObject.InvoicedCharges.Currency);

var exporterIdentificationParameters = (Dictionary<String, String>)parameters["exporter_identification"];
var exporterIdentificationParameters = (Dictionary<String, Object>)parameters["exporter_identification"];
var taxIdParameters = (Dictionary<String, String>) exporterIdentificationParameters["tax_id"];
Assert.AreEqual(taxIdParameters["number"], testObject.ExporterIdentification.TaxId.Number);
Assert.AreEqual(taxIdParameters["type"], testObject.ExporterIdentification.TaxId.Type);
Assert.AreEqual(exporterIdentificationParameters["eori_number"], testObject.ExporterIdentification.EoriNumber);
}

Expand Down Expand Up @@ -114,8 +117,14 @@ public static Hashtable getDefaultParameters()
};
parameters.Add("invoiced_charges", invoicedCharges);

var exporterIdentification = new Dictionary<String, String>(){
var taxId = new Dictionary<String, String>()
{
{"number", "123456789"},
{"type", "EIN" }
};
var exporterIdentification = new Dictionary<String, Object>(){
{"eori_number", "PL12345678912345"},
{"tax_id", taxId}
};
parameters.Add("exporter_identification", exporterIdentification);

Expand Down

0 comments on commit c9f81c7

Please sign in to comment.