Skip to content

Commit 474c288

Browse files
authored
Merge pull request #492 from Xriuk/main
Order converted date strings to DateTime
2 parents 6a54734 + 5fe3e62 commit 474c288

File tree

1 file changed

+91
-42
lines changed
  • Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders

1 file changed

+91
-42
lines changed

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/Order.cs

Lines changed: 91 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -337,22 +337,36 @@ public Order() { }
337337
/// </summary>
338338
/// <value>The date when the order was created.</value>
339339
[DataMember(Name = "PurchaseDate", EmitDefaultValue = false)]
340+
[Obsolete("Use PurchaseDateTime instead")]
340341
public string PurchaseDate { get; set; }
342+
#pragma warning disable 0618
343+
public DateTime PurchaseDateTime {
344+
get => DateTime.Parse(PurchaseDate);
345+
set => PurchaseDate = value.ToString("o");
346+
}
347+
#pragma warning restore 0618
341348

342349
/// <summary>
343350
/// The date when the order was last updated. Note: LastUpdateDate is returned with an incorrect date for orders that were last updated before 2009-04-01.
344351
/// </summary>
345352
/// <value>The date when the order was last updated. Note: LastUpdateDate is returned with an incorrect date for orders that were last updated before 2009-04-01.</value>
346353
[DataMember(Name = "LastUpdateDate", EmitDefaultValue = false)]
347-
public string LastUpdateDate { get; set; }
348-
349-
350-
351-
/// <summary>
352-
/// The sales channel of the first item in the order.
353-
/// </summary>
354-
/// <value>The sales channel of the first item in the order.</value>
355-
[DataMember(Name = "SalesChannel", EmitDefaultValue = false)]
354+
[Obsolete("Use LastUpdateDateTime instead")]
355+
public string LastUpdateDate { get; set; }
356+
#pragma warning disable 0618
357+
public DateTime LastUpdateDateTime {
358+
get => DateTime.Parse(LastUpdateDate);
359+
set => LastUpdateDate = value.ToString("o");
360+
}
361+
#pragma warning restore 0618
362+
363+
364+
365+
/// <summary>
366+
/// The sales channel of the first item in the order.
367+
/// </summary>
368+
/// <value>The sales channel of the first item in the order.</value>
369+
[DataMember(Name = "SalesChannel", EmitDefaultValue = false)]
356370
public string SalesChannel { get; set; }
357371

358372
/// <summary>
@@ -439,34 +453,62 @@ public Order() { }
439453
/// </summary>
440454
/// <value>The start of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: EarliestShipDate might not be returned for orders placed before February 1, 2013.</value>
441455
[DataMember(Name = "EarliestShipDate", EmitDefaultValue = false)]
456+
[Obsolete("Use EarliestShipDateTime instead")]
442457
public string EarliestShipDate { get; set; }
443-
444-
/// <summary>
445-
/// The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: LatestShipDate might not be returned for orders placed before February 1, 2013.
446-
/// </summary>
447-
/// <value>The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: LatestShipDate might not be returned for orders placed before February 1, 2013.</value>
448-
[DataMember(Name = "LatestShipDate", EmitDefaultValue = false)]
449-
public string LatestShipDate { get; set; }
450-
451-
/// <summary>
452-
/// The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.
453-
/// </summary>
454-
/// <value>The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.</value>
455-
[DataMember(Name = "EarliestDeliveryDate", EmitDefaultValue = false)]
456-
public string EarliestDeliveryDate { get; set; }
457-
458-
/// <summary>
459-
/// The end of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending, or Canceled status.
460-
/// </summary>
461-
/// <value>The end of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending, or Canceled status.</value>
462-
[DataMember(Name = "LatestDeliveryDate", EmitDefaultValue = false)]
463-
public string LatestDeliveryDate { get; set; }
464-
465-
/// <summary>
466-
/// When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.
467-
/// </summary>
468-
/// <value>When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.</value>
469-
[DataMember(Name = "IsBusinessOrder", EmitDefaultValue = false)]
458+
#pragma warning disable 0618
459+
public DateTime? EarliestShipDateTime {
460+
get => !string.IsNullOrEmpty(EarliestShipDate) ? (DateTime?)DateTime.Parse(EarliestShipDate) : null;
461+
set => EarliestShipDate = value != null ? value.Value.ToString("o") : null;
462+
}
463+
#pragma warning restore 0618
464+
465+
/// <summary>
466+
/// The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: LatestShipDate might not be returned for orders placed before February 1, 2013.
467+
/// </summary>
468+
/// <value>The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders. Note: LatestShipDate might not be returned for orders placed before February 1, 2013.</value>
469+
[DataMember(Name = "LatestShipDate", EmitDefaultValue = false)]
470+
[Obsolete("Use LatestShipDateTime instead")]
471+
public string LatestShipDate { get; set; }
472+
#pragma warning disable 0618
473+
public DateTime? LatestShipDateTime {
474+
get => !string.IsNullOrEmpty(LatestShipDate) ? (DateTime?)DateTime.Parse(LatestShipDate) : null;
475+
set => LatestShipDate = value != null ? value.Value.ToString("o") : null;
476+
}
477+
#pragma warning restore 0618
478+
479+
/// <summary>
480+
/// The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.
481+
/// </summary>
482+
/// <value>The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.</value>
483+
[DataMember(Name = "EarliestDeliveryDate", EmitDefaultValue = false)]
484+
[Obsolete("Use EarliestDeliveryDateTime instead")]
485+
public string EarliestDeliveryDate { get; set; }
486+
#pragma warning disable 0618
487+
public DateTime? EarliestDeliveryDateTime {
488+
get => !string.IsNullOrEmpty(EarliestDeliveryDate) ? (DateTime?)DateTime.Parse(EarliestDeliveryDate) : null;
489+
set => EarliestDeliveryDate = value != null ? value.Value.ToString("o") : null;
490+
}
491+
#pragma warning restore 0618
492+
493+
/// <summary>
494+
/// The end of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending, or Canceled status.
495+
/// </summary>
496+
/// <value>The end of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending, or Canceled status.</value>
497+
[DataMember(Name = "LatestDeliveryDate", EmitDefaultValue = false)]
498+
[Obsolete("Use LatestDeliveryDateTime instead")]
499+
public string LatestDeliveryDate { get; set; }
500+
#pragma warning disable 0618
501+
public DateTime? LatestDeliveryDateTime {
502+
get => !string.IsNullOrEmpty(LatestDeliveryDate) ? (DateTime?)DateTime.Parse(LatestDeliveryDate) : null;
503+
set => LatestDeliveryDate = value != null ? value.Value.ToString("o") : null;
504+
}
505+
#pragma warning restore 0618
506+
507+
/// <summary>
508+
/// When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.
509+
/// </summary>
510+
/// <value>When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.</value>
511+
[DataMember(Name = "IsBusinessOrder", EmitDefaultValue = false)]
470512
public bool? IsBusinessOrder { get; set; }
471513

472514
/// <summary>
@@ -509,13 +551,20 @@ public Order() { }
509551
/// </summary>
510552
/// <value>Indicates the date by which the seller must respond to the buyer with an estimated ship date. Returned only for Sourcing on Demand orders.</value>
511553
[DataMember(Name = "PromiseResponseDueDate", EmitDefaultValue = false)]
554+
[Obsolete("Use PromiseResponseDueDateTime instead")]
512555
public string PromiseResponseDueDate { get; set; }
513-
514-
/// <summary>
515-
/// When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.
516-
/// </summary>
517-
/// <value>When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.</value>
518-
[DataMember(Name = "IsEstimatedShipDateSet", EmitDefaultValue = false)]
556+
#pragma warning disable 0618
557+
public DateTime? PromiseResponseDueDateTime {
558+
get => !string.IsNullOrEmpty(PromiseResponseDueDate) ? (DateTime?)DateTime.Parse(PromiseResponseDueDate) : null;
559+
set => PromiseResponseDueDate = value != null ? value.Value.ToString("o") : null;
560+
}
561+
#pragma warning restore 0618
562+
563+
/// <summary>
564+
/// When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.
565+
/// </summary>
566+
/// <value>When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.</value>
567+
[DataMember(Name = "IsEstimatedShipDateSet", EmitDefaultValue = false)]
519568
public bool? IsEstimatedShipDateSet { get; set; }
520569

521570
/// <summary>

0 commit comments

Comments
 (0)