Skip to content

Commit

Permalink
Replaced all DateTimes with DateTimeOffsets and fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgenious committed Oct 7, 2021
1 parent 9f1e500 commit 95fc3c2
Show file tree
Hide file tree
Showing 38 changed files with 184 additions and 186 deletions.
4 changes: 2 additions & 2 deletions RechargeSharp/Entities/Addresses/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override int GetHashCode()
public string Country { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("customer_id")]
public long CustomerId { get; set; }
Expand Down Expand Up @@ -113,7 +113,7 @@ public override int GetHashCode()
public string Province { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("zip")]
public string Zip { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public override int GetHashCode()

[Required]
[JsonProperty("next_charge_date")]
public DateTime? NextChargeDate { get; set; }
public DateTimeOffset? NextChargeDate { get; set; }
}
}
12 changes: 6 additions & 6 deletions RechargeSharp/Entities/Charges/Charge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Charge : IEquatable<Charge>
public ChargeClientDetails ClientDetails { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("customer_hash")]
public string CustomerHash { get; set; }
Expand Down Expand Up @@ -57,13 +57,13 @@ public class Charge : IEquatable<Charge>
public IEnumerable<Property> NoteAttributes { get; set; }

[JsonProperty("processed_at")]
public DateTime? ProcessedAt { get; set; }
public DateTimeOffset? ProcessedAt { get; set; }

[JsonProperty("processor_name")]
public string ProcessorName { get; set; }

[JsonProperty("scheduled_at")]
public DateTime? ScheduledAt { get; set; }
public DateTimeOffset? ScheduledAt { get; set; }

[JsonProperty("shipments_count")]
public long? ShipmentsCount { get; set; }
Expand Down Expand Up @@ -117,19 +117,19 @@ public class Charge : IEquatable<Charge>
public string Type { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

/// <summary>
/// only present for failed charges
/// </summary>
[JsonProperty("last_charge_attempt_date", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? LastChargeAttemptDate { get; set; }
public DateTimeOffset? LastChargeAttemptDate { get; set; }

/// <summary>
/// only present for failed charges
/// </summary>
[JsonProperty("retry_date", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? RetryDate { get; set; }
public DateTimeOffset? RetryDate { get; set; }

/// <summary>
/// only present for failed charges
Expand Down
6 changes: 3 additions & 3 deletions RechargeSharp/Entities/Checkouts/Checkout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class Checkout : IEquatable<Checkout>
public long? ChargeId { get; set; }

[JsonProperty("completed_at")]
public DateTime? CompletedAt { get; set; }
public DateTimeOffset? CompletedAt { get; set; }

[JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? CreatedAt { get; set; }
public DateTimeOffset? CreatedAt { get; set; }

[JsonProperty("currency", NullValueHandling = NullValueHandling.Ignore)]
public string Currency { get; set; }
Expand Down Expand Up @@ -102,7 +102,7 @@ public class Checkout : IEquatable<Checkout>
public string TotalTax { get; set; }

[JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? UpdatedAt { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }

public bool Equals(Checkout other)
{
Expand Down
4 changes: 2 additions & 2 deletions RechargeSharp/Entities/Collections/Collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override int GetHashCode()
}

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("id")]
public long Id { get; set; }
Expand All @@ -52,6 +52,6 @@ public override int GetHashCode()
public string Name { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}
}
6 changes: 3 additions & 3 deletions RechargeSharp/Entities/Customers/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public override int GetHashCode()
public string Email { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("first_name")]
public string FirstName { get; set; }
Expand Down Expand Up @@ -137,6 +137,6 @@ public override int GetHashCode()
public long NumberSubscriptions { get; set; }

[JsonProperty("first_charge_processed_at")]
public DateTime? FirstChargeProcessedAt { get; set; }
public DateTimeOffset? FirstChargeProcessedAt { get; set; }
}
}
6 changes: 3 additions & 3 deletions RechargeSharp/Entities/Discounts/CreateDiscountRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override int GetHashCode()
public string AppliesToProductType { get; set; }

[JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[Required]
[StringValues(AllowableValues = new[] { "forever", "usage_limit", "single_use" })]
Expand All @@ -92,10 +92,10 @@ public override int GetHashCode()
public long? DurationUsageLimit { get; set; }

[JsonProperty("ends_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? EndsAt { get; set; }
public DateTimeOffset? EndsAt { get; set; }

[JsonProperty("starts_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? StartsAt { get; set; }
public DateTimeOffset? StartsAt { get; set; }

[JsonProperty("once_per_customer", NullValueHandling = NullValueHandling.Ignore)]
public bool? OncePerCustomer { get; set; }
Expand Down
8 changes: 4 additions & 4 deletions RechargeSharp/Entities/Discounts/Discount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public override int GetHashCode()
public long Value { get; set; }

[JsonProperty("ends_at")]
public DateTime? EndsAt { get; set; }
public DateTimeOffset? EndsAt { get; set; }

[JsonProperty("starts_at")]
public DateTime? StartsAt { get; set; }
public DateTimeOffset? StartsAt { get; set; }

[JsonProperty("status")]
public DiscountStatus? Status { get; set; }
Expand Down Expand Up @@ -103,10 +103,10 @@ public override int GetHashCode()
public AppliesToProductType? AppliesToProductType { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("once_per_customer")]
public bool OncePerCustomer { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions RechargeSharp/Entities/Discounts/UpdateDiscountRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override int GetHashCode()
}

[JsonProperty("starts_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? StartsAt { get; set; }
public DateTimeOffset? StartsAt { get; set; }

[JsonProperty("usage_limit", NullValueHandling = NullValueHandling.Ignore)]
public long? UsageLimit { get; set; }
Expand All @@ -54,6 +54,6 @@ public override int GetHashCode()
public string Status { get; set; }

[JsonProperty("ends_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? EndsAt { get; set; }
public DateTimeOffset? EndsAt { get; set; }
}
}
4 changes: 2 additions & 2 deletions RechargeSharp/Entities/Metafields/Metafield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public override int GetHashCode()
}

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("description")]
public string Description { get; set; }
Expand All @@ -71,7 +71,7 @@ public override int GetHashCode()
public OwnerResource? OwnerResource { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("value")]
public string Value { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Onetimes/CreateOneTimeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override int GetHashCode()

[Required]
[JsonProperty("next_charge_scheduled_at")]
public DateTime? NextChargeScheduledAt { get; set; }
public DateTimeOffset? NextChargeScheduledAt { get; set; }

[Required]
[JsonProperty("price")]
Expand Down
6 changes: 3 additions & 3 deletions RechargeSharp/Entities/Onetimes/OneTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override int GetHashCode()
public long AddressId { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("customer_id")]
public long CustomerId { get; set; }
Expand All @@ -68,7 +68,7 @@ public override int GetHashCode()
public long Id { get; set; }

[JsonProperty("next_charge_scheduled_at")]
public DateTime? NextChargeScheduledAt { get; set; }
public DateTimeOffset? NextChargeScheduledAt { get; set; }

[JsonProperty("price")]
public long Price { get; set; }
Expand Down Expand Up @@ -98,7 +98,7 @@ public override int GetHashCode()
public string Status { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("variant_title")]
public string VariantTitle { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Orders/ChangeOrderDateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public override int GetHashCode()

[Required]
[JsonProperty("scheduled_at")]
public DateTime? ScheduledAt { get; set; }
public DateTimeOffset? ScheduledAt { get; set; }
}
}
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Orders/CloneOrderRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public override int GetHashCode()

[Required]
[JsonProperty("scheduled_at")]
public DateTime? ScheduledAt { get; set; }
public DateTimeOffset? ScheduledAt { get; set; }
}
}
12 changes: 6 additions & 6 deletions RechargeSharp/Entities/Orders/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Order : IEquatable<Order>
public string ChargeStatus { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("customer_id")]
public long CustomerId { get; set; }
Expand Down Expand Up @@ -60,19 +60,19 @@ public class Order : IEquatable<Order>
public string PaymentProcessor { get; set; }

[JsonProperty("processed_at")]
public DateTime? ProcessedAt { get; set; }
public DateTimeOffset? ProcessedAt { get; set; }

[JsonProperty("scheduled_at")]
public DateTime? ScheduledAt { get; set; }
public DateTimeOffset? ScheduledAt { get; set; }

[JsonProperty("shipped_date")]
public DateTime? ShippedDate { get; set; }
public DateTimeOffset? ShippedDate { get; set; }

[JsonProperty("shipping_address")]
public Address ShippingAddress { get; set; }

[JsonProperty("shipping_date")]
public DateTime? ShippingDate { get; set; }
public DateTimeOffset? ShippingDate { get; set; }

[JsonProperty("shipping_lines")]
public IEnumerable<ShippingLine> ShippingLines { get; set; }
Expand Down Expand Up @@ -126,7 +126,7 @@ public class Order : IEquatable<Order>
public string Type { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

public bool Equals(Order other)
{
Expand Down
4 changes: 2 additions & 2 deletions RechargeSharp/Entities/Products/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override int GetHashCode()
public long CollectionId { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("discount_amount")]
public long DiscountAmount { get; set; }
Expand All @@ -81,6 +81,6 @@ public override int GetHashCode()
public string Title { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}
}
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Shared/UtmParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public class UtmParams
public string UtmTerm { get; set; }

[JsonProperty("utm_time_stamp", NullValueHandling = NullValueHandling.Ignore)]
public DateTime UtmTimeStamp { get; set; }
public DateTimeOffset UtmTimeStamp { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public override int GetHashCode()
public long? AddressId { get; set; }

[JsonProperty("next_charge_scheduled_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? NextChargeScheduledAt { get; set; }
public DateTimeOffset? NextChargeScheduledAt { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override int GetHashCode()

[Required]
[JsonProperty("next_charge_scheduled_at")]
public DateTime? NextChargeScheduledAt { get; set; }
public DateTimeOffset? NextChargeScheduledAt { get; set; }

[Required]
[JsonProperty("shopify_variant_id")]
Expand Down
8 changes: 4 additions & 4 deletions RechargeSharp/Entities/Subscriptions/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ public override int GetHashCode()
public long CustomerId { get; set; }

[JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("next_charge_scheduled_at", NullValueHandling = NullValueHandling.Include)]
public DateTime? NextChargeScheduledAt { get; set; }
public DateTimeOffset? NextChargeScheduledAt { get; set; }

[JsonProperty("cancelled_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? CancelledAt { get; set; }
public DateTimeOffset? CancelledAt { get; set; }

[JsonProperty("product_title")] public string ProductTitle { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public override int GetHashCode()
}

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("id")]
public long Id { get; set; }
Expand Down
Loading

0 comments on commit 95fc3c2

Please sign in to comment.