From bcf7a2be2ca38732717c28df4143c2648502e862 Mon Sep 17 00:00:00 2001 From: Kevin Venclovas Date: Thu, 4 Jul 2024 15:05:21 +0200 Subject: [PATCH] changed GLS ApiDomain to full base path --- README.md | 6 ++--- .../TestBase.cs | 2 +- .../Provider/GLS/GLSSettings.cs | 2 +- .../Provider/GLS/GLSShipmentService.cs | 22 ++++++++++--------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b5bc4df..66a8337 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ To finalize the setup, register the ShippingProAPICollectionService as a scoped { // PLEASE GET IN TOUCH WITH YOUR GLS CONTACT TO GET THE FOLLOWING INFORMATIONS - // Api domain is the XXXXXXX part of your GLS-GLS api url => https://GLS-wbm-XXXXXXX.gls-group.eu:443/backend/rs - ApiDomain = "test01", + // Api domain => https://shipit-wbm-test01.gls-group.eu:443 + ApiDomain = "https://shipit-wbm-test01.gls-group.eu:443", ContactID = "276a45fkqM", Username = "276a45fkqM" Password = "lXZBIF7uRccyK7Ohr64d", @@ -148,7 +148,7 @@ Name | Type | Required | Example ### GLS Name | Type | Required | Example --- | --- | ---| --- -`GLS_API_DOMAIN` | String | * | test01 or de03 +`GLS_API_DOMAIN` | String | * | https://shipit-wbm-test01.gls-group.eu:443 `GLS_CONTRACT_ID` | String | * | 276a5fkqM `GLS_PASSWORD` | String | * | lXZBIF7uccyK7Ohr64d `GLS_USERNAME` | String | * | 276a5fkqM diff --git a/ShippingProAPICollection.NUnitTests/TestBase.cs b/ShippingProAPICollection.NUnitTests/TestBase.cs index baa68cb..d4f85cb 100644 --- a/ShippingProAPICollection.NUnitTests/TestBase.cs +++ b/ShippingProAPICollection.NUnitTests/TestBase.cs @@ -39,7 +39,7 @@ public void OneTimeSetUp() GLSSettings GLSSettings = new GLSSettings() { - ApiDomain = "test01", + ApiDomain = "https://shipit-wbm-test01.gls-group.eu:443", ContactID = "276a45fkqM", Password = "lXZBIF7uRccyK7Ohr64d", Username = "276a45fkqM" diff --git a/ShippingProAPICollection/Provider/GLS/GLSSettings.cs b/ShippingProAPICollection/Provider/GLS/GLSSettings.cs index 8eb8f76..b5eb33d 100644 --- a/ShippingProAPICollection/Provider/GLS/GLSSettings.cs +++ b/ShippingProAPICollection/Provider/GLS/GLSSettings.cs @@ -6,7 +6,7 @@ public class GLSSettings : ProviderSettings { public override ShippingProviderType ShippingProviderType => ShippingProviderType.GLS; /// - /// Api domain is the XXXXXXX part of your GLS-GLS api url provides by ur GLS contact => https://GLS-wbm-XXXXXXX.gls-group.eu:443/backend/rs + /// Api domain => https://shipit-wbm-test01.gls-group.eu:443 /// public required string ApiDomain { get; set; } public required string Username { get; set; } diff --git a/ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs b/ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs index b9e9b95..7116ae1 100644 --- a/ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs +++ b/ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs @@ -49,7 +49,7 @@ public async Task> RequestLabel(RequestShipme }; RestResponse response = await CallApi( - new Uri(string.Format("https://shipit-wbm-{0}.gls-group.eu:443/backend/rs/shipments", providerSettings.ApiDomain)), + new Uri(string.Format("{0}/backend/rs/shipments", providerSettings.ApiDomain)), Method.Post, shipmentRequest, cancelToken @@ -79,7 +79,7 @@ public async Task> RequestLabel(RequestShipme public async Task CancelLabel(string cancelId, CancellationToken cancelToken = default) { RestResponse response = await CallApi( - new Uri(string.Format("https://shipit-wbm-{0}.gls-group.eu:443/backend/rs/shipments/cancel/{1}", providerSettings.ApiDomain, cancelId)), + new Uri(string.Format("{0}/backend/rs/shipments/cancel/{1}", providerSettings.ApiDomain, cancelId)), Method.Post, cancelId, cancelToken @@ -110,7 +110,7 @@ public async Task ValidateLabel(RequestShipmentBase request, var requestBody = new ValidateShipmentRequestData() { Shipment = shipment }; RestResponse response = await CallApi( - new Uri(string.Format("https://shipit-wbm-{0}.gls-group.eu:443/backend/rs/shipments/validate", providerSettings.ApiDomain)), + new Uri(string.Format("{0}/backend/rs/shipments/validate", providerSettings.ApiDomain)), Method.Post, requestBody, cancelToken @@ -171,7 +171,9 @@ public async Task ValidateLabel(RequestShipmentBase request, public async Task GetEstimatedDeliveryDays(RequestShipmentBase request, CancellationToken cancelToken) { - + // Api NotFound on current GLS api + return 0; + EstimatedDeliveryDaysAddress senderAddress = new EstimatedDeliveryDaysAddress() { City = accountSettings.City, @@ -204,13 +206,13 @@ public async Task GetEstimatedDeliveryDays(RequestShipmentBase request, Ca }; RestResponse response = await CallApi( - new Uri(string.Format("https://shipit-wbm-{0}.gls-group.eu:443/backend/rs/timeframe/deliverydays", providerSettings.ApiDomain)), - Method.Post, - requestBody, - cancelToken - ); + new Uri(string.Format("{0}/backend/rs/timeframe/deliverydays", providerSettings.ApiDomain)), + Method.Post, + requestBody, + cancelToken + ); - return 0; + return response?.Data?.NumberOfWorkDays ?? 0; }