Skip to content

Commit c162ab7

Browse files
authored
Merge pull request #775 from Baros6647/main
"Expiration" field for Item and ItemInput models changed to DateTime. Fixed GenerateShipmentContentUpdatePreviewsRequest model. An example of using the ItemInput model has been updated.
2 parents f384d69 + 98c3846 commit c162ab7

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

Source/FikaAmazonAPI.SampleCode/FulFillmentInboundv20240320Sample .cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public void CreateShipmentPlan()
3636
oInboundShipmentPlanRequestItem.Quantity = 1;
3737
oInboundShipmentPlanRequestItem.LabelOwner = AmazonSpApiSDK.Models.FulfillmentInboundv20240320.LabelOwner.SELLER;
3838
oInboundShipmentPlanRequestItem.PrepOwner = AmazonSpApiSDK.Models.FulfillmentInboundv20240320.PrepOwner.SELLER;
39-
39+
oInboundShipmentPlanRequestItem.Expiration = DateTime.Now.AddDays(110);
40+
4041
var oResult = amazonConnection.FulFillmentInboundv20240320.CreateInboundPlan(oCreateInboundShipmentPlanRequest);
4142

4243
}

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/FulfillmentInboundv20240320/GenerateShipmentContentUpdatePreviewsRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public GenerateShipmentContentUpdatePreviewsRequest() { }
6868
/// A list of all items that will be present in the shipment after the update.
6969
/// </summary>
7070
/// <value>A list of all items that will be present in the shipment after the update.</value>
71-
[DataMember(Name= "items ", EmitDefaultValue=false)]
71+
[DataMember(Name= "items", EmitDefaultValue=false)]
7272
public List<ItemInput> Items { get; set; }
7373

7474
/// <summary>

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/FulfillmentInboundv20240320/Item.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public Item() { }
4343
/// <param name="prepInstructions">Special preparations that are required for an item. (required).</param>
4444
/// <param name="quantity">The number of the specified MSKU. (required).</param>
4545
public Item(string asin = default(string),
46-
string expiration = default(string),
46+
DateTime? expiration = default(DateTime?),
4747
string fnsku = default(string),
4848
LabelOwner labelOwner = default(LabelOwner),
4949
string manufacturingLotCode = default(string),
@@ -121,7 +121,7 @@ public Item() { }
121121
/// </summary>
122122
/// <value>The expiration date of the MSKU in ISO 8601 format. The same MSKU with different expiration dates cannot go into the same box.</value>
123123
[DataMember(Name="expiration", EmitDefaultValue=false)]
124-
public string Expiration { get; set; }
124+
public DateTime? Expiration { get; set; }
125125

126126
/// <summary>
127127
/// A unique identifier assigned by Amazon to products stored in and fulfilled from an Amazon fulfillment center.
@@ -305,12 +305,6 @@ public override int GetHashCode()
305305
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Asin, length must be greater than 1.", new [] { "Asin" });
306306
}
307307

308-
// Expiration (string) pattern
309-
Regex regexExpiration = new Regex(@"^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", RegexOptions.CultureInvariant);
310-
if (false == regexExpiration.Match(this.Expiration).Success)
311-
{
312-
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Expiration, must match a pattern of " + regexExpiration, new [] { "Expiration" });
313-
}
314308

315309
// Fnsku (string) maxLength
316310
if(this.Fnsku != null && this.Fnsku.Length > 10)

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/FulfillmentInboundv20240320/ItemInput.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Generated by: https://github.com/swagger-api/swagger-codegen.git
99
*/
1010

11+
using FikaAmazonAPI.Utils;
1112
using Newtonsoft.Json;
1213
using System;
1314
using System.Collections.Generic;
@@ -39,7 +40,7 @@ public ItemInput() { }
3940
/// <param name="msku">The merchant SKU. (required).</param>
4041
/// <param name="prepOwner">In some situations, special preparations are required for items and this field reflects the owner of the preparations. Options include AMAZON, SELLER or NONE. (required).</param>
4142
/// <param name="quantity">The number of units of the specified MSKU that will be shipped. (required).</param>
42-
public ItemInput(string expiration = default(string),
43+
public ItemInput(DateTime? expiration = default(DateTime?),
4344
LabelOwner labelOwner = default(LabelOwner),
4445
string manufacturingLotCode = default(string),
4546
string msku = default(string),
@@ -90,8 +91,10 @@ public ItemInput() { }
9091
/// The expiration date of the MSKU in ISO 8601 format. The same MSKU with different expiration dates cannot go into the same box.
9192
/// </summary>
9293
/// <value>The expiration date of the MSKU in ISO 8601 format. The same MSKU with different expiration dates cannot go into the same box.</value>
94+
[JsonConverter(typeof(Iso8601DateConverter))]
9395
[DataMember(Name="expiration", EmitDefaultValue=false)]
94-
public string Expiration { get; set; }
96+
97+
public DateTime? Expiration { get; set; }
9598

9699
/// <summary>
97100
/// Specifies who will label the items. Options include AMAZON, SELLER or NONE.
@@ -238,12 +241,6 @@ public override int GetHashCode()
238241
/// <returns>Validation Result</returns>
239242
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
240243
{
241-
// Expiration (string) pattern
242-
Regex regexExpiration = new Regex(@"^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", RegexOptions.CultureInvariant);
243-
if (false == regexExpiration.Match(this.Expiration).Success)
244-
{
245-
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Expiration, must match a pattern of " + regexExpiration, new [] { "Expiration" });
246-
}
247244

248245
// ManufacturingLotCode (string) maxLength
249246
if(this.ManufacturingLotCode != null && this.ManufacturingLotCode.Length > 256)

Source/FikaAmazonAPI/Utils/JsonConverters.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@ public Iso8601DateTimeConverter()
77
base.DateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ";
88
}
99
}
10+
11+
class Iso8601DateConverter : Newtonsoft.Json.Converters.IsoDateTimeConverter
12+
{
13+
public Iso8601DateConverter()
14+
{
15+
base.DateTimeFormat = "yyyy-MM-dd";
16+
}
17+
}
1018
}

0 commit comments

Comments
 (0)