public async Task <GetLearnerLearningEventsResponse> GetLearnerEventsAsync(RegisteredLearnerDetails learnerDetails) { try { var invokingOrganisation = new InvokingOrganisationR10 { OrganisationRef = _configuration.LearningRecordServiceSettings.Ukprn, Ukprn = _configuration.LearningRecordServiceSettings.Ukprn, Username = _configuration.LearningRecordServiceSettings.Username, Password = _configuration.LearningRecordServiceSettings.Password }; return(await _learnerServiceR9Client.GetLearnerLearningEventsAsync(invokingOrganisation, Constants.LearnerLearningEventsUserType, _configuration.LearningRecordServiceSettings.VendorId, Constants.LrsLanguage, learnerDetails.Uln.ToString(), learnerDetails.Firstname, learnerDetails.Lastname, learnerDetails.DateofBirth.ToString(Constants.LrsDateFormat), null, Constants.LearnerLearningEventsGetType)); } catch (Exception ex) { if (_learnerServiceR9Client.State == CommunicationState.Faulted) { _learnerServiceR9Client.Abort(); } _logger.LogError($"Error while executing GetLearnerEventsAsync({learnerDetails}). Exception = {ex}"); return(null); } }
public async Task <bool> GetLearnerEventsAsync(string uln, string firstName, string lastName, string dateOfBirth) { try { var invokingOrganisation = new InvokingOrganisationR10 { OrganisationRef = _configuration.LearningRecordServiceSettings.Ukprn, Ukprn = _configuration.LearningRecordServiceSettings.Ukprn, Username = _configuration.LearningRecordServiceSettings.Username, Password = _configuration.LearningRecordServiceSettings.Password }; var response = await _learnerServiceR9Client.GetLearnerLearningEventsAsync(invokingOrganisation, "ORG", _configuration.LearningRecordServiceSettings.VendorId, "ENG", uln, firstName, lastName, dateOfBirth, null, "FULL"); //_learnerServiceR9Client.Close(); return(true); } catch (Exception ex) { if (_learnerServiceR9Client.State == CommunicationState.Faulted) { _learnerServiceR9Client.Abort(); } _logger.LogError($"Error while executing GetLearnerLearningEventsAsync. Exception = {ex}"); //_learnerServiceR9Client.Close(); return(false); } }
public override void Given() { _apiClient = new PersonalLearningRecordServiceApiClient(_logger, _learnerServiceR9Client, _configuration); _learnerServiceR9Client.GetLearnerLearningEventsAsync(Arg.Any <InvokingOrganisationR10>(), "LNR", _configuration.LearningRecordServiceSettings.VendorId, "ENG", _registrationLearnerDetails.Uln.ToString(), _registrationLearnerDetails.Firstname, _registrationLearnerDetails.Lastname, _registrationLearnerDetails.DateofBirth.ToString("yyyy-MM-dd"), null, "FULL").Returns(_mockHttpResult); }