Skip to content

Commit 98f3b65

Browse files
authored
Merge pull request #502 from Xriuk/main
FulFillmentOutbound and Orders fixes + Deprecation
2 parents a5b9a9b + 815e33d commit 98f3b65

File tree

10 files changed

+253
-173
lines changed

10 files changed

+253
-173
lines changed

Source/FikaAmazonAPI.SampleCode/CatalogItemsSample.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using FikaAmazonAPI.Utils;
2+
using System.ComponentModel;
23
using static FikaAmazonAPI.Utils.Constants;
34

45
namespace FikaAmazonAPI.SampleCode
@@ -12,7 +13,7 @@ public CatalogItemsSample(AmazonConnection amazonConnection)
1213
}
1314

1415
[Obsolete("This method deprecated in June 2022. Please use GetCatalogItem(ParameterGetCatalogItem parameterListCatalogItem) instead.", true)]
15-
public void GetCatalogItemAsync()
16+
public void GetCatalogItemAsync()
1617
{
1718
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
1819

@@ -25,7 +26,7 @@ public void ListCatalogCategories()
2526
}
2627

2728
[Obsolete("This method deprecated in June 2022. Please use SearchCatalogItems202204 instead.", true)]
28-
public void ListCatalogItems()
29+
public void ListCatalogItems()
2930
{
3031
var items = amazonConnection.CatalogItem.ListCatalogItems(new Parameter.CatalogItems.ParameterListCatalogItems()
3132
{

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/FulfillmentOutbound/CreateFulfillmentOrderRequest.cs

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Newtonsoft.Json;
1212
using System;
1313
using System.Collections.Generic;
14+
using System.ComponentModel;
1415
using System.ComponentModel.DataAnnotations;
1516
using System.IO;
1617
using System.Runtime.Serialization;
@@ -29,11 +30,19 @@ public partial class CreateFulfillmentOrderRequest : IEquatable<CreateFulfillmen
2930
/// </summary>
3031
/// <value>The shipping method for the fulfillment order.</value>
3132
[DataMember(Name = "shippingSpeedCategory", EmitDefaultValue = false)]
32-
public string ShippingSpeedCategory { get; set; }
33-
/// <summary>
34-
/// Gets or Sets FulfillmentAction
35-
/// </summary>
36-
[DataMember(Name = "fulfillmentAction", EmitDefaultValue = false)]
33+
[Obsolete("Use ShippingSpeedCategoryMethod instead")]
34+
[EditorBrowsable(EditorBrowsableState.Never)]
35+
public string ShippingSpeedCategory { get; set; }
36+
public ShippingSpeedCategory ShippingSpeedCategoryMethod {
37+
#pragma warning disable 0618
38+
get => (ShippingSpeedCategory)Enum.Parse(typeof(ShippingSpeedCategory), ShippingSpeedCategory, true);
39+
set => ShippingSpeedCategory = value.ToString();
40+
#pragma warning restore 0618
41+
}
42+
/// <summary>
43+
/// Gets or Sets FulfillmentAction
44+
/// </summary>
45+
[DataMember(Name = "fulfillmentAction", EmitDefaultValue = false)]
3746
public FulfillmentAction? FulfillmentAction { get; set; }
3847
/// <summary>
3948
/// Gets or Sets FulfillmentPolicy
@@ -63,7 +72,9 @@ public CreateFulfillmentOrderRequest() { }
6372
/// <param name="ShipFromCountryCode">The two-character country code for the country from which the fulfillment order ships. Must be in ISO 3166-1 alpha-2 format..</param>
6473
/// <param name="NotificationEmailList">NotificationEmailList.</param>
6574
/// <param name="Items">A list of items to include in the fulfillment order preview, including quantity. (required).</param>
66-
public CreateFulfillmentOrderRequest(string MarketplaceId = default(string), string SellerFulfillmentOrderId = default(string), string DisplayableOrderId = default(string), DateTime DisplayableOrderDate = default(DateTime), string DisplayableOrderComment = default(string), string ShippingSpeedCategory = null, DeliveryWindow DeliveryWindow = default(DeliveryWindow), Address DestinationAddress = default(Address), FulfillmentAction? FulfillmentAction = default(FulfillmentAction?), FulfillmentPolicy? FulfillmentPolicy = default(FulfillmentPolicy?), string FulfillmentMethod = default(string), CODSettings CODSettings = default(CODSettings), string ShipFromCountryCode = default(string), NotificationEmailList NotificationEmails = default(NotificationEmailList), CreateFulfillmentOrderItemList Items = default(CreateFulfillmentOrderItemList))
75+
[Obsolete("FulfillmentMethod no longer used and ShippingSpeedCategory is deprecated, use the other constructor instead")]
76+
[EditorBrowsable(EditorBrowsableState.Never)]
77+
public CreateFulfillmentOrderRequest(string MarketplaceId = default(string), string SellerFulfillmentOrderId = default(string), string DisplayableOrderId = default(string), DateTime? DisplayableOrderDate = default(DateTime?), string DisplayableOrderComment = default(string), string ShippingSpeedCategory = null, DeliveryWindow DeliveryWindow = default(DeliveryWindow), Address DestinationAddress = default(Address), FulfillmentAction? FulfillmentAction = default(FulfillmentAction?), FulfillmentPolicy? FulfillmentPolicy = default(FulfillmentPolicy?), string FulfillmentMethod = default(string), CODSettings CODSettings = default(CODSettings), string ShipFromCountryCode = default(string), NotificationEmailList NotificationEmails = default(NotificationEmailList), CreateFulfillmentOrderItemList Items = default(CreateFulfillmentOrderItemList))
6778
{
6879
// to ensure "SellerFulfillmentOrderId" is required (not null)
6980
if (SellerFulfillmentOrderId == null)
@@ -90,7 +101,7 @@ public CreateFulfillmentOrderRequest() { }
90101
}
91102
else
92103
{
93-
this.DisplayableOrderDate = DisplayableOrderDate;
104+
this.DisplayableOrderDate = DisplayableOrderDate.Value;
94105
}
95106
// to ensure "DisplayableOrderComment" is required (not null)
96107
if (DisplayableOrderComment == null)
@@ -108,10 +119,12 @@ public CreateFulfillmentOrderRequest() { }
108119
}
109120
else
110121
{
111-
this.ShippingSpeedCategory = ShippingSpeedCategory;
112-
}
113-
// to ensure "DestinationAddress" is required (not null)
114-
if (DestinationAddress == null)
122+
#pragma warning disable 0618
123+
this.ShippingSpeedCategory = ShippingSpeedCategory;
124+
#pragma warning restore 0618
125+
}
126+
// to ensure "DestinationAddress" is required (not null)
127+
if (DestinationAddress == null)
115128
{
116129
throw new InvalidDataException("DestinationAddress is a required property for CreateFulfillmentOrderRequest and cannot be null");
117130
}
@@ -132,11 +145,14 @@ public CreateFulfillmentOrderRequest() { }
132145
this.DeliveryWindow = DeliveryWindow;
133146
this.FulfillmentAction = FulfillmentAction;
134147
this.FulfillmentPolicy = FulfillmentPolicy;
135-
this.FulfillmentMethod = FulfillmentMethod;
136148
this.CODSettings = CODSettings;
137149
this.ShipFromCountryCode = ShipFromCountryCode;
138150
this.NotificationEmails = NotificationEmails;
139151
}
152+
#pragma warning disable 0618
153+
public CreateFulfillmentOrderRequest(string MarketplaceId = default(string), string SellerFulfillmentOrderId = default(string), string DisplayableOrderId = default(string), DateTime? DisplayableOrderDate = default(DateTime?), string DisplayableOrderComment = default(string), ShippingSpeedCategory? ShippingSpeedCategory = default(ShippingSpeedCategory?), DeliveryWindow DeliveryWindow = default(DeliveryWindow), Address DestinationAddress = default(Address), FulfillmentAction? FulfillmentAction = default(FulfillmentAction?), FulfillmentPolicy? FulfillmentPolicy = default(FulfillmentPolicy?), CODSettings CODSettings = default(CODSettings), string ShipFromCountryCode = default(string), NotificationEmailList NotificationEmails = default(NotificationEmailList), CreateFulfillmentOrderItemList Items = default(CreateFulfillmentOrderItemList))
154+
: this(MarketplaceId, SellerFulfillmentOrderId, DisplayableOrderId, DisplayableOrderDate, DisplayableOrderComment, ShippingSpeedCategory?.ToString(), DeliveryWindow, DestinationAddress, FulfillmentAction, FulfillmentPolicy, null, CODSettings, ShipFromCountryCode, NotificationEmails, Items) { }
155+
#pragma warning restore 0618
140156

141157
/// <summary>
142158
/// The marketplace the fulfillment order is placed against.
@@ -189,17 +205,19 @@ public CreateFulfillmentOrderRequest() { }
189205

190206

191207

192-
/// <summary>
193-
/// Indicates the intended recipient channel for the order.
194-
/// </summary>
195-
/// <value>Indicates the intended recipient channel for the order.</value>
196-
[DataMember(Name = "FulfillmentMethod", EmitDefaultValue = false)]
197-
public string FulfillmentMethod { get; set; }
208+
/// <summary>
209+
/// Indicates the intended recipient channel for the order.
210+
/// </summary>
211+
/// <value>Indicates the intended recipient channel for the order.</value>
212+
[DataMember(Name = "FulfillmentMethod", EmitDefaultValue = false)]
213+
[Obsolete("Property no longer used")]
214+
[EditorBrowsable(EditorBrowsableState.Never)]
215+
public string FulfillmentMethod { get; set; }
198216

199-
/// <summary>
200-
/// Gets or Sets CODSettings
201-
/// </summary>
202-
[DataMember(Name = "codSettings", EmitDefaultValue = false)]
217+
/// <summary>
218+
/// Gets or Sets CODSettings
219+
/// </summary>
220+
[DataMember(Name = "codSettings", EmitDefaultValue = false)]
203221
public CODSettings CODSettings { get; set; }
204222

205223
/// <summary>
@@ -235,12 +253,13 @@ public override string ToString()
235253
sb.Append(" DisplayableOrderId: ").Append(DisplayableOrderId).Append("\n");
236254
sb.Append(" DisplayableOrderDate: ").Append(DisplayableOrderDate).Append("\n");
237255
sb.Append(" DisplayableOrderComment: ").Append(DisplayableOrderComment).Append("\n");
238-
sb.Append(" ShippingSpeedCategory: ").Append(ShippingSpeedCategory).Append("\n");
239-
sb.Append(" DeliveryWindow: ").Append(DeliveryWindow).Append("\n");
256+
#pragma warning disable 0618
257+
sb.Append(" ShippingSpeedCategory: ").Append(ShippingSpeedCategory).Append("\n");
258+
#pragma warning restore 0618
259+
sb.Append(" DeliveryWindow: ").Append(DeliveryWindow).Append("\n");
240260
sb.Append(" DestinationAddress: ").Append(DestinationAddress).Append("\n");
241261
sb.Append(" FulfillmentAction: ").Append(FulfillmentAction).Append("\n");
242262
sb.Append(" FulfillmentPolicy: ").Append(FulfillmentPolicy).Append("\n");
243-
sb.Append(" FulfillmentMethod: ").Append(FulfillmentMethod).Append("\n");
244263
sb.Append(" CODSettings: ").Append(CODSettings).Append("\n");
245264
sb.Append(" ShipFromCountryCode: ").Append(ShipFromCountryCode).Append("\n");
246265
sb.Append(" NotificationEmails: ").Append(NotificationEmails).Append("\n");
@@ -305,10 +324,12 @@ public bool Equals(CreateFulfillmentOrderRequest input)
305324
this.DisplayableOrderComment.Equals(input.DisplayableOrderComment))
306325
) &&
307326
(
308-
this.ShippingSpeedCategory == input.ShippingSpeedCategory ||
327+
#pragma warning disable 0618
328+
this.ShippingSpeedCategory == input.ShippingSpeedCategory ||
309329
(this.ShippingSpeedCategory != null &&
310330
this.ShippingSpeedCategory.Equals(input.ShippingSpeedCategory))
311-
) &&
331+
#pragma warning restore 0618
332+
) &&
312333
(
313334
this.DeliveryWindow == input.DeliveryWindow ||
314335
(this.DeliveryWindow != null &&
@@ -329,11 +350,6 @@ public bool Equals(CreateFulfillmentOrderRequest input)
329350
(this.FulfillmentPolicy != null &&
330351
this.FulfillmentPolicy.Equals(input.FulfillmentPolicy))
331352
) &&
332-
(
333-
this.FulfillmentMethod == input.FulfillmentMethod ||
334-
(this.FulfillmentMethod != null &&
335-
this.FulfillmentMethod.Equals(input.FulfillmentMethod))
336-
) &&
337353
(
338354
this.CODSettings == input.CODSettings ||
339355
(this.CODSettings != null &&
@@ -375,18 +391,18 @@ public override int GetHashCode()
375391
hashCode = hashCode * 59 + this.DisplayableOrderDate.GetHashCode();
376392
if (this.DisplayableOrderComment != null)
377393
hashCode = hashCode * 59 + this.DisplayableOrderComment.GetHashCode();
378-
if (this.ShippingSpeedCategory != null)
394+
#pragma warning disable 0618
395+
if (this.ShippingSpeedCategory != null)
379396
hashCode = hashCode * 59 + this.ShippingSpeedCategory.GetHashCode();
380-
if (this.DeliveryWindow != null)
397+
#pragma warning restore 0618
398+
if (this.DeliveryWindow != null)
381399
hashCode = hashCode * 59 + this.DeliveryWindow.GetHashCode();
382400
if (this.DestinationAddress != null)
383401
hashCode = hashCode * 59 + this.DestinationAddress.GetHashCode();
384402
if (this.FulfillmentAction != null)
385403
hashCode = hashCode * 59 + this.FulfillmentAction.GetHashCode();
386404
if (this.FulfillmentPolicy != null)
387405
hashCode = hashCode * 59 + this.FulfillmentPolicy.GetHashCode();
388-
if (this.FulfillmentMethod != null)
389-
hashCode = hashCode * 59 + this.FulfillmentMethod.GetHashCode();
390406
if (this.CODSettings != null)
391407
hashCode = hashCode * 59 + this.CODSettings.GetHashCode();
392408
if (this.ShipFromCountryCode != null)

0 commit comments

Comments
 (0)