private void RaiseClaimRequestAutoSubstantiatedEvent(SubmitClaimRequest command) { var claimAutoSubstantiated = new ClaimRequestAutoSubstantiatedEvent { Amount = command.Amount, ClaimRequestId = command.ClaimRequestId, ClaimType = command.ClaimType, CompanyId = command.CompanyId, DateOfTransaction = command.DateOfTransaction, ParticipantId = command.ParticipantId, ProviderName = command.ProviderName, Source = command.Source, }; ApplyEvent(claimAutoSubstantiated, @event => _state.Apply(@event)); }
public void SubmitClaimRequest(SubmitClaimRequest command, ICompaniesReadModel companyService) { //if claim amount does not match co-pay amount, then hold pending //verification (receive supporting documentation) from the participant. IEnumerable <CopayInfo> copayList = companyService.GetCopayBy(command.CompanyId); if (copayList.Any(copay => copay.CopayAmount.Dollars() == command.Amount.Dollars() && copay.ClaimType == command.ClaimType)) { //then this is a recognized copay - we dont need any substantiation RaiseClaimRequestAutoSubstantiatedEvent(command); } else { //else, we need some substantiation from the participant RaiseClaimRequestCreatedPendingVerificationEvent(command); } }
private void RaiseClaimRequestCreatedPendingVerificationEvent(SubmitClaimRequest command) { var pendingEvent = new ClaimRequestCreatedPendingVerificationEvent { Amount = command.Amount, ClaimRequestId = command.ClaimRequestId, ClaimType = command.ClaimType, DateOfTransaction = command.DateOfTransaction, ProviderName = command.ProviderName, Reason = "Claim request amount is not recognised as a copay amount. Participant must substantiate this card use", Source = command.Source, CompanyId = command.CompanyId, ParticipantId = command.ParticipantId, CorrelationId = Guid.NewGuid(), }; ApplyEvent(pendingEvent, @event => _state.Apply(@event)); }