From c9f81c796ee8e472ecb954df1fe0c51c6750fa3f Mon Sep 17 00:00:00 2001 From: sam-allen-shippo Date: Wed, 21 Apr 2021 11:41:52 -0700 Subject: [PATCH] Adding tax id fields --- Shippo/CustomsDeclaration.cs | 13 +++++++++++++ ShippoTesting/CustomsDeclarationTest.cs | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Shippo/CustomsDeclaration.cs b/Shippo/CustomsDeclaration.cs index 2c04ca2..dc56e71 100644 --- a/Shippo/CustomsDeclaration.cs +++ b/Shippo/CustomsDeclaration.cs @@ -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)] diff --git a/ShippoTesting/CustomsDeclarationTest.cs b/ShippoTesting/CustomsDeclarationTest.cs index cb3466a..ef94dc3 100644 --- a/ShippoTesting/CustomsDeclarationTest.cs +++ b/ShippoTesting/CustomsDeclarationTest.cs @@ -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)parameters["exporter_identification"]; + var exporterIdentificationParameters = (Dictionary)parameters["exporter_identification"]; + var taxIdParameters = (Dictionary) 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); } @@ -114,8 +117,14 @@ public static Hashtable getDefaultParameters() }; parameters.Add("invoiced_charges", invoicedCharges); - var exporterIdentification = new Dictionary(){ + var taxId = new Dictionary() + { + {"number", "123456789"}, + {"type", "EIN" } + }; + var exporterIdentification = new Dictionary(){ {"eori_number", "PL12345678912345"}, + {"tax_id", taxId} }; parameters.Add("exporter_identification", exporterIdentification);