Skip to content

Commit

Permalink
changed GLS ApiDomain to full base path
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Venclovas committed Jul 4, 2024
1 parent b5d9742 commit bcf7a2b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion ShippingProAPICollection.NUnitTests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ShippingProAPICollection/Provider/GLS/GLSSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class GLSSettings : ProviderSettings
{
public override ShippingProviderType ShippingProviderType => ShippingProviderType.GLS;
/// <summary>
/// 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
/// </summary>
public required string ApiDomain { get; set; }
public required string Username { get; set; }
Expand Down
22 changes: 12 additions & 10 deletions ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<List<RequestShippingLabelResponse>> RequestLabel(RequestShipme
};

RestResponse<CreatedShipmentResponse> response = await CallApi<CreatedShipmentResponse>(
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
Expand Down Expand Up @@ -79,7 +79,7 @@ public async Task<List<RequestShippingLabelResponse>> RequestLabel(RequestShipme
public async Task<ShippingCancelResult> CancelLabel(string cancelId, CancellationToken cancelToken = default)
{
RestResponse<CancelShipmentResponse> response = await CallApi<CancelShipmentResponse>(
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
Expand Down Expand Up @@ -110,7 +110,7 @@ public async Task<ValidationReponse> ValidateLabel(RequestShipmentBase request,
var requestBody = new ValidateShipmentRequestData() { Shipment = shipment };

RestResponse<ValidateParcelsResponse> response = await CallApi<ValidateParcelsResponse>(
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
Expand Down Expand Up @@ -171,7 +171,9 @@ public async Task<ValidationReponse> ValidateLabel(RequestShipmentBase request,

public async Task<uint> GetEstimatedDeliveryDays(RequestShipmentBase request, CancellationToken cancelToken)
{

// Api NotFound on current GLS api
return 0;

EstimatedDeliveryDaysAddress senderAddress = new EstimatedDeliveryDaysAddress()

Check warning on line 177 in ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs

View workflow job for this annotation

GitHub Actions / Build-Publish

Unreachable code detected

Check warning on line 177 in ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs

View workflow job for this annotation

GitHub Actions / Build-Publish

Unreachable code detected

Check warning on line 177 in ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs

View workflow job for this annotation

GitHub Actions / Build-Publish

Unreachable code detected

Check warning on line 177 in ShippingProAPICollection/Provider/GLS/GLSShipmentService.cs

View workflow job for this annotation

GitHub Actions / Build-Publish

Unreachable code detected
{
City = accountSettings.City,
Expand Down Expand Up @@ -204,13 +206,13 @@ public async Task<uint> GetEstimatedDeliveryDays(RequestShipmentBase request, Ca
};

RestResponse<EstimatedDeliveryDaysResponse> response = await CallApi<EstimatedDeliveryDaysResponse>(
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;
}


Expand Down

0 comments on commit bcf7a2b

Please sign in to comment.