From 1661e0d911b52bdefd751c670364eafb62fdb45e Mon Sep 17 00:00:00 2001 From: Brandon Moffett Date: Fri, 23 May 2025 10:03:57 -0700 Subject: [PATCH] Update versioning and address model properties - Bump version in `GitVersion.yml` to 6.3.8 and enable commit-message-incrementing. - Change `AddressLine1`, `AddressLine2`, and `AddressLine3` to nullable types in `DHLExpressApi.cs`, enforcing non-nullability for `AddressLine2`. - Update assignment logic for `AddressLine1` and `AddressLine3` in `DHLExpressRateProvider.cs` to handle null or empty values. - Modify `stateOrProvince` in `TestShipments.cs` to be optional by changing it to an empty string. --- GitVersion.yml | 2 +- .../OpenApis/V2/Express/DHLExpressApi.cs | 6 +++--- src/EasyKeys.Shipping.DHL.Rates/DHLExpressRateProvider.cs | 4 ++-- .../EasyKeys.Shipping.FuncTest/TestHelpers/TestShipments.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 3d2eb69..598af7e 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: ContinuousDelivery -next-version: 6.3.7 +next-version: 6.3.8 increment: Patch major-version-bump-message: '\+semver:\s?(breaking|major|release)' minor-version-bump-message: '\+semver:\s?(feat|feature|minor)' diff --git a/src/EasyKeys.Shipping.DHL.Abstractions/OpenApis/V2/Express/DHLExpressApi.cs b/src/EasyKeys.Shipping.DHL.Abstractions/OpenApis/V2/Express/DHLExpressApi.cs index 378d6d8..dfda819 100644 --- a/src/EasyKeys.Shipping.DHL.Abstractions/OpenApis/V2/Express/DHLExpressApi.cs +++ b/src/EasyKeys.Shipping.DHL.Abstractions/OpenApis/V2/Express/DHLExpressApi.cs @@ -3979,12 +3979,12 @@ public partial class SupermodelIoLogisticsExpressAddressRatesRequest /// [Newtonsoft.Json.JsonProperty("addressLine1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(45, MinimumLength = 1)] - public string AddressLine1 { get; set; } + public string? AddressLine1 { get; set; } /// /// Please enter address line 3 /// - [Newtonsoft.Json.JsonProperty("addressLine2", Required = Newtonsoft.Json.Required.AllowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("addressLine2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(45, MinimumLength = 1)] public string? AddressLine2 { get; set; } @@ -3993,7 +3993,7 @@ public partial class SupermodelIoLogisticsExpressAddressRatesRequest /// [Newtonsoft.Json.JsonProperty("addressLine3", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(45, MinimumLength = 1)] - public string AddressLine3 { get; set; } + public string? AddressLine3 { get; set; } /// /// Please enter your suburb or county name diff --git a/src/EasyKeys.Shipping.DHL.Rates/DHLExpressRateProvider.cs b/src/EasyKeys.Shipping.DHL.Rates/DHLExpressRateProvider.cs index 6f6ab65..fe9b921 100644 --- a/src/EasyKeys.Shipping.DHL.Rates/DHLExpressRateProvider.cs +++ b/src/EasyKeys.Shipping.DHL.Rates/DHLExpressRateProvider.cs @@ -111,9 +111,9 @@ public async Task GetRatesManyAsync(Shipment shipment, CancellationTok PostalCode = shipment.DestinationAddress.PostalCode, CityName = shipment.DestinationAddress.City, CountryCode = shipment.DestinationAddress.CountryCode, - AddressLine1 = shipment.DestinationAddress.StreetLine, + AddressLine1 = string.IsNullOrEmpty(shipment.DestinationAddress.StreetLine) ? null : shipment.DestinationAddress.StreetLine, AddressLine2 = string.IsNullOrEmpty(shipment.DestinationAddress.StreetLine2) ? null : shipment.DestinationAddress.StreetLine2, - AddressLine3 = shipment.DestinationAddress.StateOrProvince + AddressLine3 = string.IsNullOrEmpty(shipment.DestinationAddress.StateOrProvince) ? null : shipment.DestinationAddress.StateOrProvince } }, Accounts = new[] diff --git a/test/EasyKeys.Shipping.FuncTest/TestHelpers/TestShipments.cs b/test/EasyKeys.Shipping.FuncTest/TestHelpers/TestShipments.cs index d9f127e..e0af24d 100644 --- a/test/EasyKeys.Shipping.FuncTest/TestHelpers/TestShipments.cs +++ b/test/EasyKeys.Shipping.FuncTest/TestHelpers/TestShipments.cs @@ -64,7 +64,7 @@ public static Shipment CreateInternationalShipment() stateOrProvince: "ON", postalCode: "K1M 1M4", countryCode: "CA"); - destinationAddress = new Address("285 Wang Fu Jing Avenue", "BEIJING", "Beijing", "100006", "CN", isResidential: false); + destinationAddress = new Address("285 Wang Fu Jing Avenue", "BEIJING", "", "100006", "CN", isResidential: false); var packages = new List { new Package(