public async Task <PinSettingsListModel> ProcessRequestAsync(RequestorModel data) { if (data is null) { throw new ArgumentNullException(nameof(data)); } await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(data.OpCoId); var config = _rulesConfiguratonStore.OpCoConfigurations[data.OpCoId]; if (config is null) { throw new InvalidOperationException("No config details for requested opco"); } var individual = new Dictionary <string, PinDetailsModel>(); foreach (var item in config.PinTypes) { data.PinType = item.Value.Id; var pin = await _pinRepository.TryGetPinDetailsAsync(data); if (pin == null) { continue; } var individualItem = new PinDetailsModel(item.Value, pin.PinSalt, pin.PinHash, pin.PinLocked); individual.Add(individualItem.Id.ToString(), individualItem); } return(await Task.FromResult(new PinSettingsListModel(individual))); }
public async Task ProcessRequestAsync(ChangePinParameters data) { await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(data.Requestor.OpCoId); var param = new VerifyPinParameters() { Requestor = data.Requestor, PinHash = data.OldPinHash }; var pinmodel = await _pinHashVerifier.VerifyPinHashAsync(param); var model = new PinChangeVerificationModel() { OpCoId = data.Requestor.OpCoId, PinType = data.PinType, NewPin = data.NewPin }; await _pinChangeVerifier.CheckNewPinAgainstRulesAsync(model); var newpin = _pinHashGenerator.GeneratePinHashWithNewSalt(data.NewPin); pinmodel.PinHash = newpin.Hash; pinmodel.PinSalt = newpin.Salt; await _pinRepository.CreateOrUpdatePinAsync(data.Requestor, pinmodel); }
public async Task ProcessRequestAsync(VerifyPinParameters data) { if (data is null) { throw new ArgumentNullException(nameof(data)); } if (data.Requestor is null) { throw new ArgumentNullException(nameof(data.Requestor)); } await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(data.Requestor.OpCoId); await _pinHashVerifier.VerifyPinHashAsync(data); }
public async Task ProcessRequestAsync(RequestorModel requestor, bool lockpin = true, string reason = null) { await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(requestor.OpCoId); var pinModel = await _pinRepository.TryGetPinDetailsAsync(requestor); if (pinModel is null) { throw new PinPlatform.Domain.Exceptions.PinDoesntExistException(); } pinModel.PinLocked = lockpin; pinModel.LockReason = lockpin ? reason : String.Empty; await _pinRepository.CreateOrUpdatePinAsync(requestor, pinModel); }
public async Task ProcessRequestAsync(RequestorModel requestor, string newPin) { await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(requestor.OpCoId); var model = new PinChangeVerificationModel() { OpCoId = requestor.OpCoId, PinType = requestor.PinType, NewPin = newPin }; await _pinChangeVerifier.CheckNewPinAgainstRulesAsync(model); var newpin = _pinHashGenerator.GeneratePinHashWithNewSalt(newPin); var pinmodel = new PinModel() { PinLocked = false, PinHash = newpin.Hash, PinSalt = newpin.Salt }; await _pinRepository.CreateOrUpdatePinAsync(requestor, pinmodel); }
public async Task ProcessRequestAsync(RequestorModel requestor) { await _opcoVerifier.CheckIfOpCoHasPinServiceAsync(requestor.OpCoId); await _pinRepository.DeletePinAsync(requestor); }