Giter VIP home page Giter VIP logo

Comments (1)

nathancartlidge avatar nathancartlidge commented on June 18, 2024

In the short term, it appears this can be fixed with the following changes to BaseServiceItem.cs and ServiceDetailsService.cs:

--- a/Huxley2/Connected Services/OpenLDBWS/BaseServiceItem.cs
+++ b/Huxley2/Connected Services/OpenLDBWS/BaseServiceItem.cs
@@ -11,9 +11,9 @@ namespace OpenLDBWS
 {
     public partial class BaseServiceItem
     {
         public string ServiceIdPercentEncoded => WebUtility.UrlEncode(serviceIDField);

-        public Guid ServiceIdGuid => new Guid(Convert.FromBase64String(serviceIDField));
+        // public Guid ServiceIdGuid => new Guid(serviceIDField);

         [SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "Not a URL")]
-        public string ServiceIdUrlSafe => WebEncoders.Base64UrlEncode(Convert.FromBase64String(serviceIDField));
+        public string ServiceIdUrlSafe => serviceIDField; // underscores are URL safe
     }
 }
--- a/Huxley2/Services/ServiceDetailsService.cs
+++ b/Huxley2/Services/ServiceDetailsService.cs
@@ -55,17 +55,27 @@ namespace Huxley2.Services

             // If ID looks like a RID (15 decimal digit long base 10 integer) then use the staff API if configured
             // This appears to be the date and the UID (with the first character in decimal representation)
-            if (request.ServiceId.Length == 15 && long.TryParse(request.ServiceId, out _)
-                && _accessTokenService.TryMakeStaffAccessToken(out var staffToken))
-            {
-                _logger.LogInformation($"Calling staff service details SOAP endpoint for {request.ServiceId}");
-                var staffService = await _staffSoapClient.GetServiceDetailsByRIDAsync(
-                    new GetServiceDetailsByRIDRequest
+            if (request.ServiceId.Length == 15) {
+                if (long.TryParse(request.ServiceId, out _)
+                    && _accessTokenService.TryMakeStaffAccessToken(out var staffToken)) {
+                    _logger.LogInformation($"Calling staff service details SOAP endpoint for {request.ServiceId}");
+                    var staffService = await _staffSoapClient.GetServiceDetailsByRIDAsync(
+                        new GetServiceDetailsByRIDRequest
+                        {
+                            AccessToken = staffToken,
+                            rid = request.ServiceId,
+                        });
+                    return staffService.GetServiceDetailsResult;
+                } else if (request.ServiceId.EndsWith("_")) {
+                    _logger.LogInformation($"Calling service details SOAP endpoint for {request.ServiceId}");
+                    var s = await _soapClient.GetServiceDetailsAsync(new GetServiceDetailsRequest
                     {
-                        AccessToken = staffToken,
-                        rid = request.ServiceId,
+                        AccessToken = _accessTokenService.MakeAccessToken(request),
+                        serviceID = request.ServiceId,
                     });
-                return staffService.GetServiceDetailsResult;
+                    return s.GetServiceDetailsResult;
+
+                }
             }

However, this will break GUID support and percent encoding, so a more elegant overall solution is likely needed

from huxley2.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.