Exemplo n.º 1
0
        public void AttachCompanyDocuments(AttachCompanyDocumentsCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            Image contratoSocialPicture          = new Image(command.ContratoSocialPicture.ToBytes());
            Image alteracaoContratoSocialPicture = new Image(command.AlteracaoContratoSocialPicture.ToBytes());
            Image ownerDocumentPicture           = new Image(command.OwnerDocumentPicture.ToBytes());
            Image extraDocumentPicture           = new Image(command.ExtraDocument.ToBytes());

            Activation activation = _repository.GetById(command.ActivationId);

            if (NotifyNullActivation(activation) || NotifyDifferentUser(activation))
            {
                return;
            }

            activation.AttachCompanyDocuments(contratoSocialPicture,
                                              alteracaoContratoSocialPicture,
                                              ownerDocumentPicture,
                                              extraDocumentPicture);

            if (AddNotifications(activation))
            {
                return;
            }

            _repository.Update(activation);

            Commit();
        }
Exemplo n.º 2
0
        public void ShouldAttachDocumentsAndReturn()
        {
            PopulateRepository();

            string owner                   = "bHVjYXM=";
            string extra                   = "bHVjYXM=";
            string contratoSocial          = "bHVjYXM=";
            string alteracaoContratoSocial = "bHVjYXM=";

            AttachCompanyDocumentsCommand command = new AttachCompanyDocumentsCommand
            {
                ActivationId                   = companyId,
                OwnerDocumentPicture           = owner,
                ContratoSocialPicture          = contratoSocial,
                AlteracaoContratoSocialPicture = alteracaoContratoSocial,
                ExtraDocument                  = extra
            };

            service.AttachCompanyDocuments(command);

            Activation activation = GetActivation();

            Assert.IsNotNull(activation.GetCompanyDocuments());
            Assert.AreEqual(4, activation.GetCompanyDocuments().Count);
        }
Exemplo n.º 3
0
        public IActionResult AttachCompanyDocuments(Guid id, [FromBody] AttachCompanyDocumentsCommand command)
        {
            command.ActivationId = id;

            _activationAppService.AttachCompanyDocuments(command);

            return(CreateResponse());
        }