示例#1
0
        public async Task <IEnumerable <LegalPartyDocumentDto> > SearchAsync(LegalPartySearchDto legalPartySearchDto)
        {
            var legalPartyRoleDocumentDtosEnumerable = await _httpClientWrapper.Post <IEnumerable <LegalPartyDocumentDto> >(
                _applicationSettingsHelper.LegalPartyServiceApiUrl, $"{Version}/LegalParties/Documents", legalPartySearchDto);

            if (legalPartyRoleDocumentDtosEnumerable == null)
            {
                throw new RecordNotFoundException(
                          string.Join(",", legalPartySearchDto.LegalPartyRoleIdList.Select(x => x.ToString()).ToArray()),
                          typeof(LegalPartyDocumentDto),
                          "The Legal Party Roles Documents could not be found for Legal Party HeaderValueId List");
            }

            var legalPartyRoleDocumentDtos = legalPartyRoleDocumentDtosEnumerable.ToList();

            if (legalPartyRoleDocumentDtos.Count == 0)
            {
                throw new RecordNotFoundException(
                          string.Join(",", legalPartySearchDto.LegalPartyRoleIdList.Select(x => x.ToString()).ToArray()),
                          typeof(LegalPartyDocumentDto),
                          "The Legal Party Roles Documents could not be found for Legal Party HeaderValueId List");
            }

            return(legalPartyRoleDocumentDtos);
        }
        public void NotifyOrderOcurred(int productId, int quantity)
        {
            var address = string.Format(AddressTemplate, productId);

            var json = string.Format(JsonTemplate, quantity);

            _client.Post(address, json);
        }
        public async Task <OAuthAccessToken> GetAccessToken(string oneTimePassword)
        {
            var request = new OAuthTokenRequest
            {
                ClientId     = _configuration.ClientId,
                ClientSecret = $"{oneTimePassword}{_configuration.ClientSecret}",
                GrantType    = "client_credentials",
                Scopes       = "read:apprenticeship-levy"
            };
            var hmrcToken = await _httpClient.Post <OAuthTokenResponse>(_configuration.Url, request);

            return(new OAuthAccessToken
            {
                AccessToken = hmrcToken.AccessToken,
                RefreshToken = hmrcToken.RefreshToken,
                ExpiresAt = DateTime.UtcNow.AddSeconds(hmrcToken.ExpiresIn),
                Scope = hmrcToken.Scope,
                TokenType = hmrcToken.TokenType
            });
        }
示例#4
0
        public async Task <IEnumerable <GrmEventInformationDto> > SearchAsync(GrmEventSearchDto grmEventSearchDto)
        {
            var grmEventInformationDtosEnumerable = await _httpClientWrapper.Post <IEnumerable <GrmEventInformationDto> >(Url,
                                                                                                                          $"{Version}/GrmEventInformation", grmEventSearchDto);

            if (grmEventInformationDtosEnumerable == null)
            {
                throw new RecordNotFoundException(
                          string.Join(",", grmEventSearchDto.GrmEventIdList.Select(x => x.ToString()).ToArray()),
                          typeof(GrmEventInformationDto), "The GRM Information could not be found GRM Event HeaderValueId List");
            }

            var grmEventInformationDtos = grmEventInformationDtosEnumerable.ToList();

            if (grmEventInformationDtos.Count == 0)
            {
                throw new RecordNotFoundException(
                          string.Join(",", grmEventSearchDto.GrmEventIdList.Select(x => x.ToString()).ToArray()),
                          typeof(GrmEventInformationDto), "The GRM Information could not be found GRM Event HeaderValueId List");
            }

            return(grmEventInformationDtos);
        }
 public async Task <BaseValueSegmentDto> CreateAsync(BaseValueSegmentDto baseValueSegmentDto)
 {
     return(await _httpClientWrapper.Post <BaseValueSegmentDto>(Url, $"{Version}/BaseValueSegments", baseValueSegmentDto));
 }
 public async Task <GrmEventListCreateDto> CreateAsync(GrmEventListCreateDto grmEventCreateInformation)
 {
     return(await _httpClientWrapper.Post <GrmEventListCreateDto>(Url,
                                                                  "v1.1/GrmEvents/CreateGrmEvents", grmEventCreateInformation));
 }
示例#7
0
        public double CalculateTrolley(TrolleyInput input)
        {
            var url = UrlConstructor.ConstructUri(UrlPath);

            return(_httpClientWrapper.Post <double>(url, JsonConvert.SerializeObject(input)).Result);
        }