Ejemplo n.º 1
0
 private void When(ClaimRequestCreatedPendingVerificationEvent @event)
 {
     _id               = new Guid(@event.ClaimRequestId);
     _claimAmount      = @event.Amount.Dollars();
     _claimType        = @event.ClaimType;
     CurrentClaimState = ClaimRequestStateEnum.PendingSubstantiation;
 }
Ejemplo n.º 2
0
        //to start testing, the coordinator has been instructed to send this message on the bus
        //we then wait until we get the ScheduleTimeout message back from the Saga (see the Consumes() method, where we signal our threading event)
        public bool CreateClaimRequest(int amount, string claimtype, DateTime serviceDate, string provider, string reason)
        {
            var requestCommand = new ClaimRequestCreatedPendingVerificationEvent();

            requestCommand.Amount            = amount;
            requestCommand.ClaimType         = claimtype;
            requestCommand.DateOfTransaction = serviceDate;
            requestCommand.ProviderName      = provider;
            requestCommand.Reason            = reason;
            //requestCommand.ClaimRequestId = requestCommand.CorrelationId.ToString();
            _bus.Publish(requestCommand);

            return(_timeoutScheduled.WaitOne(_timeout));
        }
Ejemplo n.º 3
0
        private void Handle(ClaimRequestCreatedPendingVerificationEvent @event)
        {
            //send a message to the timeout service to start a timeout
            //CorrelationId = new Guid(@event.ClaimRequestId); //- can not reset the correlation id because the saga has already been created with the original ID and
            //that is how it is persisted in the saga repository. If you reset the ID then the original saga state (in the saga repository) will not be retrieved and
            //the new ID you just specified does not exist in the saga repository.
            ClaimRequestId = new Guid(@event.ClaimRequestId);
            ParticipantId  = @event.ParticipantId;
            var timeoutAt  = DateTime.Now.Add(TimeSpan.FromSeconds(30));
            var newTimeout = new ScheduleTimeout(CorrelationId, timeoutAt);

            logger.DebugFormat("ClaimRequestSaga: handle pending verification event: ClaimId [{0}] - CorrrelationId [{1}]", ClaimRequestId, CorrelationId);
            Bus.Publish(newTimeout);
        }
Ejemplo n.º 4
0
        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));
        }