public async Task <ActionResult> TransferDetail(GetTransferTransactionDetailsQuery query)
        {
            var response = await _mediator.SendAsync(query);

            var model = _mapper.Map <TransferTransactionDetailsViewModel>(response);

            return(View(ControllerConstants.TransferDetailsViewName, model));
        }
Ejemplo n.º 2
0
        public async Task ThenIShouldBeToldIfImTheSender()
        {
            //Arrange
            var query = new GetTransferTransactionDetailsQuery
            {
                AccountId = SenderAccountId,
                TargetAccountPublicHashedId = ReceiverPublicHashedId,
                PeriodEnd = PeriodEnd
            };

            //Act
            var result = await _handler.Handle(query);

            //Assert
            Assert.IsTrue(result.IsCurrentAccountSender);
        }
Ejemplo n.º 3
0
        public async Task ThenIShouldReturnSenderTransferDate()
        {
            //Assign
            var query = new GetTransferTransactionDetailsQuery
            {
                AccountId = SenderAccountId,
                TargetAccountPublicHashedId = ReceiverPublicHashedId,
                PeriodEnd = PeriodEnd
            };

            //Act
            var result = await _handler.Handle(query);

            //Assert
            Assert.AreEqual(_senderTranferTransaction.DateCreated, result.DateCreated);
        }
Ejemplo n.º 4
0
        public void Arrange()
        {
            _orchestrator = new Mock <EmployerAccountTransactionsOrchestrator>();
            _owinWrapper  = new Mock <IAuthenticationService>();
            _mapper       = new Mock <IMapper>();
            _mediator     = new Mock <IMediator>();

            _controller = new EmployerAccountTransactionsController(
                _owinWrapper.Object,
                _orchestrator.Object,
                _mapper.Object,
                _mediator.Object,
                Mock.Of <ILog>());

            _query = new GetTransferTransactionDetailsQuery
            {
                AccountId = SenderAccountId,
                TargetAccountPublicHashedId = ReceiverPublicHashedAccountId,
                PeriodEnd = PeriodEnd
            };
        }
Ejemplo n.º 5
0
 public ActionResult TransferDetail(GetTransferTransactionDetailsQuery query)
 {
     return(Redirect(Url.EmployerFinanceAction($"finance/transfer/details{Request?.Url?.Query}")));
 }
Ejemplo n.º 6
0
        public void Assign()
        {
            _db = new Mock <EmployerFinanceDbContext>();

            _periodEnd = new PeriodEnd
            {
                Id                    = 1,
                PeriodEndId           = PeriodEnd,
                AccountDataValidAt    = DateTime.Now.AddDays(-2),
                CalendarPeriodMonth   = 2,
                CalendarPeriodYear    = 2018,
                CommitmentDataValidAt = DateTime.Now.AddDays(-1),
                CompletionDateTime    = DateTime.Now,
                PaymentsForPeriod     = "Test"
            };

            _senderTranferTransaction = new TransactionLineEntity
            {
                AccountId = SenderAccountId,
                TransferSenderAccountId   = SenderAccountId,
                TransferReceiverAccountId = ReceiverAccountId,
                PeriodEnd       = PeriodEnd,
                DateCreated     = DateTime.Now.AddDays(-2),
                TransactionType = TransactionItemType.Transfer
            };

            _recieverTranferTransaction = new TransactionLineEntity
            {
                AccountId = ReceiverAccountId,
                PeriodEnd = PeriodEnd,
                TransferSenderAccountId   = SenderAccountId,
                TransferReceiverAccountId = ReceiverAccountId,
                DateCreated     = DateTime.Now.AddDays(-1),
                TransactionType = TransactionItemType.Transfer
            };

            _publicHashingService = new Mock <IPublicHashingService>();

            _query = new GetTransferTransactionDetailsQuery
            {
                AccountId = ReceiverAccountId,
                TargetAccountPublicHashedId = SenderPublicHashedId,
                PeriodEnd = PeriodEnd
            };

            _response = new GetTransferTransactionDetailsResponse();

            _handler = new GetTransferTransactionDetailsQueryHandler(_db.Object, _publicHashingService.Object);

            _transfers = new List <AccountTransfer>
            {
                new AccountTransfer
                {
                    SenderAccountId     = SenderAccountId,
                    SenderAccountName   = SenderAccountName,
                    ReceiverAccountId   = ReceiverAccountId,
                    ReceiverAccountName = ReceiverAccountName,
                    ApprenticeshipId    = 1,
                    CourseName          = FirstCourseName,
                    Amount    = 123.4567M,
                    PeriodEnd = PeriodEnd
                },
                new AccountTransfer
                {
                    SenderAccountId     = SenderAccountId,
                    SenderAccountName   = SenderAccountName,
                    ReceiverAccountId   = ReceiverAccountId,
                    ReceiverAccountName = ReceiverAccountName,
                    ApprenticeshipId    = 2,
                    CourseName          = SecondCourseName,
                    Amount    = 346.789M,
                    PeriodEnd = PeriodEnd
                },
                new AccountTransfer
                {
                    SenderAccountId     = SenderAccountId,
                    SenderAccountName   = SenderAccountName,
                    ReceiverAccountId   = ReceiverAccountId,
                    ReceiverAccountName = ReceiverAccountName,
                    ApprenticeshipId    = 3,
                    CourseName          = SecondCourseName,
                    Amount    = 234.56M,
                    PeriodEnd = PeriodEnd
                }
            };

            _db.Setup(d => d.SqlQueryAsync <AccountTransfer>(
                          It.IsAny <string>(), SenderAccountId, ReceiverAccountId, PeriodEnd))
            .ReturnsAsync(_transfers);

            _db.Setup(d => d.SqlQueryAsync <AccountTransfer>(
                          It.IsAny <string>(), ReceiverAccountId, SenderAccountId, PeriodEnd))
            .ReturnsAsync(_transfers);

            _db.Setup(x => x.PeriodEnds).Returns(() => new DbSetStub <PeriodEnd>(_periodEnd));

            _db.Setup(x => x.Transactions).Returns(() => new DbSetStub <TransactionLineEntity>(
                                                       _senderTranferTransaction,
                                                       _recieverTranferTransaction));

            _publicHashingService.Setup(x => x.DecodeValue(SenderPublicHashedId))
            .Returns(SenderAccountId);

            _publicHashingService.Setup(x => x.DecodeValue(ReceiverPublicHashedId))
            .Returns(ReceiverAccountId);

            _publicHashingService.Setup(x => x.HashValue(SenderAccountId))
            .Returns(SenderPublicHashedId);

            _publicHashingService.Setup(x => x.HashValue(ReceiverAccountId))
            .Returns(ReceiverPublicHashedId);
        }