Exemple #1
0
        public void Then_The_Patch_Url_Is_Correctly_Built(SignAgreementRequest data)
        {
            var actual = new PatchSignAgreementRequest {
                Data = data
            };

            actual.PatchUrl.Should().Be($"accounts/{data.AccountId}/legalentities/{data.AccountLegalEntityId}");
            actual.Data.Should().BeEquivalentTo(data);
        }
        public Task RunEvent([NServiceBusTrigger(Endpoint = QueueNames.AgreementSigned)] SignedAgreementEvent message)
        {
            var signRequest = new SignAgreementRequest
            {
                AccountId            = message.AccountId,
                AccountLegalEntityId = message.AccountLegalEntityId,
                AgreementVersion     = message.SignedAgreementVersion
            };

            return(_agreementsService.SignAgreement(signRequest));
        }
Exemple #3
0
        public async Task Then_The_Api_Is_Called_To_Sign_The_Agreement(
            SignAgreementRequest request,
            [Frozen] Mock <IEmployerIncentivesApiClient <EmployerIncentivesConfiguration> > client,
            LegalEntitiesService service)
        {
            await service.SignAgreement(request);

            client.Verify(x =>
                          x.Patch(It.Is <PatchSignAgreementRequest>(
                                      c =>
                                      c.PatchUrl.Contains(request.AccountId.ToString()) && c.PatchUrl.Contains(request.AccountLegalEntityId.ToString()) &&
                                      c.Data.IsSameOrEqualTo(request)
                                      )), Times.Once
                          );
        }
Exemple #4
0
        public async Task <Unit> Handle(SignAgreementCommand request, CancellationToken cancellationToken)
        {
            _logger.LogInformation("[SignAgreementCommandHandler] request {@request}", request);

            var signAgreementRequest = new SignAgreementRequest
            {
                AccountId            = request.AccountId,
                AccountLegalEntityId = request.AccountLegalEntityId,
                AgreementVersion     = request.AgreementVersion,
                LegalEntityId        = request.LegalEntityId,
                LegalEntityName      = request.LegalEntityName
            };
            await _legalEntitiesService.SignAgreement(signAgreementRequest);

            return(Unit.Value);
        }
        public async Task Then_Signs_Agreement_Calling_Mediator(
            long accountId,
            long accountLegalEntityId,
            SignAgreementRequest request,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] AccountController controller)
        {
            var controllerResult = await controller.SignAgreement(accountId, accountLegalEntityId, request) as NoContentResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.NoContent);
            mockMediator
            .Verify(mediator => mediator.Send(
                        It.Is <SignAgreementCommand>(c =>
                                                     c.AccountId.Equals(accountId) &&
                                                     c.AccountLegalEntityId.Equals(accountLegalEntityId) &&
                                                     c.AgreementVersion.Equals(request.AgreementVersion)),
                        It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task <IActionResult> SignAgreement([FromRoute] long accountId, [FromRoute] long accountLegalEntityId, [FromBody] SignAgreementRequest request)
        {
            await SendCommandAsync(new SignLegalEntityAgreementCommand(accountId, accountLegalEntityId, request.AgreementVersion));

            return(NoContent());
        }
        public async Task <IActionResult> SignAgreement(long accountId, long accountLegalEntityId, SignAgreementRequest request)
        {
            await _mediator.Send(new SignAgreementCommand
            {
                AccountId            = accountId,
                AccountLegalEntityId = accountLegalEntityId,
                AgreementVersion     = request.AgreementVersion
            });

            return(NoContent());
        }
 public async Task SignAgreement(long accountId, long accountLegalEntityId, SignAgreementRequest request)
 {
     await _client.Patch(new PatchSignAgreementRequest(accountId, accountLegalEntityId) { Data = request });
 }
Exemple #9
0
 public async Task SignAgreement(SignAgreementRequest request)
 {
     await _client.Patch(new PatchSignAgreementRequest { Data = request });
 }
        public async Task SignAgreement(SignAgreementRequest request)
        {
            var response = await _client.PatchAsync($"accounts/{request.AccountId}/legalEntities/{request.AccountLegalEntityId}", request.GetStringContent());

            response.EnsureSuccessStatusCode();
        }