From e1651a4e81aba3ded111f6278282ed2627f3eced Mon Sep 17 00:00:00 2001 From: baros6647 Date: Thu, 12 Sep 2024 15:10:05 -0400 Subject: [PATCH] Fixed project SampleCode. Added constructor to Country, MarketPlace, Region models. To be able serialize and deserialize to json --- .../FulFillmentInboundv20240320Sample .cs | 2 +- Source/FikaAmazonAPI/Utils/Country.cs | 7 ++++++- Source/FikaAmazonAPI/Utils/MarketPlace.cs | 4 ++++ Source/FikaAmazonAPI/Utils/Region.cs | 7 ++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundv20240320Sample .cs b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundv20240320Sample .cs index b17b476e..d2d49b66 100644 --- a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundv20240320Sample .cs +++ b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundv20240320Sample .cs @@ -17,7 +17,7 @@ public void CreateShipmentPlan() oCreateInboundShipmentPlanRequest.DestinationMarketplaces = new List {amazonConnection.GetCurrentMarketplace.ID}; - oCreateInboundShipmentPlanRequest.SourceAddress = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInboundv20240320.Address(); + oCreateInboundShipmentPlanRequest.SourceAddress = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInboundv20240320.AddressInput(); oCreateInboundShipmentPlanRequest.SourceAddress.AddressLine1 = "Add"; oCreateInboundShipmentPlanRequest.SourceAddress.AddressLine2 = "ADD2"; oCreateInboundShipmentPlanRequest.SourceAddress.City = "City"; diff --git a/Source/FikaAmazonAPI/Utils/Country.cs b/Source/FikaAmazonAPI/Utils/Country.cs index 2b4d364a..3b73568a 100644 --- a/Source/FikaAmazonAPI/Utils/Country.cs +++ b/Source/FikaAmazonAPI/Utils/Country.cs @@ -1,7 +1,12 @@ -namespace FikaAmazonAPI.Utils +using System.Text.Json.Serialization; + +namespace FikaAmazonAPI.Utils { public class Country { + [JsonConstructorAttribute] + public Country() { } + public string Code { get; set; } public string Name { get; set; } public string SellercentralURL { get; set; } diff --git a/Source/FikaAmazonAPI/Utils/MarketPlace.cs b/Source/FikaAmazonAPI/Utils/MarketPlace.cs index 9f35c617..fb406d15 100644 --- a/Source/FikaAmazonAPI/Utils/MarketPlace.cs +++ b/Source/FikaAmazonAPI/Utils/MarketPlace.cs @@ -1,6 +1,7 @@ using FikaAmazonAPI.AmazonSpApiSDK.Models.Exceptions; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using static FikaAmazonAPI.ConstructFeed.BaseXML; namespace FikaAmazonAPI.Utils @@ -22,6 +23,9 @@ private MarketPlace(string id, Region region, Country country, BaseCurrencyCode CurrencyCode = currencyCode; } + [JsonConstructorAttribute] + public MarketPlace() { } + public static MarketPlace GetMarketPlaceByID(string id) { var list = new List(); diff --git a/Source/FikaAmazonAPI/Utils/Region.cs b/Source/FikaAmazonAPI/Utils/Region.cs index 9e0ac687..2e28af2f 100644 --- a/Source/FikaAmazonAPI/Utils/Region.cs +++ b/Source/FikaAmazonAPI/Utils/Region.cs @@ -1,7 +1,12 @@ -namespace FikaAmazonAPI.Utils +using System.Text.Json.Serialization; + +namespace FikaAmazonAPI.Utils { public class Region { + [JsonConstructorAttribute] + public Region() { } + private Region(string regionName, string hostUrl, string sandboxHostUrl) { RegionName = regionName;