Beispiel #1
0
        public async Task ShouldCallMediator()
        {
            //Arrange
            var model = new TransferApprovalConfirmationViewModel
            {
                ApprovalConfirmed = true
            };

            //Act
            await EmployerCommitmentOrchestrator.SetTransferRequestApprovalStatus(HashedTransferSenderId, HashedCommitmentId, HashedTransferRequestId, model, "UserId", "UserName", "UserEmail");

            //Assert
            MockMediator.Verify(x => x.SendAsync(It.Is <TransferApprovalCommand>(c =>
                                                                                 c.TransferSenderId == TransferSenderId && c.CommitmentId == CommitmentId && c.TransferRequestId == TransferRequestId && c.UserId == "UserId" && c.UserName == "UserName" && c.UserEmail == "UserEmail")), Times.Once);
        }
Beispiel #2
0
        public async Task <ActionResult> TransferApproval(string hashedAccountId, string hashedTransferRequestId, TransferApprovalConfirmationViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                var model = await Orchestrator.GetTransferRequestDetails(hashedAccountId, CallerType.TransferSender, hashedTransferRequestId, OwinWrapper.GetClaimValue(@"sub"));

                return(View("TransferDetails", model));
            }
            await Orchestrator.SetTransferRequestApprovalStatus(hashedAccountId, viewModel.HashedCohortReference, hashedTransferRequestId, viewModel, OwinWrapper.GetClaimValue(@"sub"),
                                                                OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName),
                                                                OwinWrapper.GetClaimValue(DasClaimTypes.Email));

            var status = (bool)viewModel.ApprovalConfirmed ? "approved" : "rejected";

            return(View("TransferConfirmation", new TransferConfirmationViewModel {
                TransferApprovalStatus = status, TransferReceiverName = viewModel.TransferReceiverName
            }));
        }