コード例 #1
0
        public async override Task <TrackBillBO> RunAsync(FindTrackBillQr request, CancellationToken cancellationToken = default)
        {
            try
            {
                var httpRequest  = new HttpRequestMessage(HttpMethod.Get, $"{APIUriConstants.TrackBill}/{request.TrackBillID}");
                var httpResponse = await p_HttpClient.SendAsync(httpRequest, cancellationToken);

                var jsonContent = await httpResponse.Content.ReadAsStringAsync();

                if (!httpResponse.IsSuccessStatusCode)
                {
                    throw new LynxHttpException(httpResponse);
                }

                return(p_JsonSerializer.Deserialize <TrackBillBO>(jsonContent));
            }
            catch (Exception ex)
            {
                p_ExceptionHandler.LogError(ex);

                return(TrackBillBO.Null());
            }
        }
コード例 #2
0
        public async override Task InitializeAsync(FindTrackBillQr request, CancellationToken cancellationToken)
        {
            var token = await p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID));

            p_HttpClient = p_ClientFactory.LynxApiClient(token);
        }