public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Fail Fast Validations

            // Verificar se Documento já esta cadastrado
            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            // Verificar se E-mail já esta cadastrado
            if (_studentRepository.EmailExists(command.Email))
            {
                AddNotification("email", "Este E-mail já está em uso");
            }

            //Criar Pagamento
            var payment = new PayPalPayment(command.TransactionCode,
                                            command.PaidDate,
                                            command.ExpireDate,
                                            command.Total,
                                            command.TotalPaid,
                                            command.Payer,
                                            new Address(command.Street,
                                                        command.Number,
                                                        command.Nighborhood,
                                                        command.City,
                                                        command.State,
                                                        command.Country,
                                                        command.ZipCode),
                                            new Document(command.PayerDocument, command.PayerDocumentType),
                                            new Email(command.Email));

            // Gerar os VOs
            var student = CrateStudentFactory(command, payment);

            //Agrupar as Validações
            AddNotifications(student.Name,
                             student.Document,
                             student.Email,
                             student.Address,
                             student,
                             student.Subscriptions.First(),
                             payment);

            // Checar as notificações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar a sua assinatura"));
            }

            // Salvar as Informações
            _studentRepository.CreateSubscription(student);

            // Enviar E-mail de boas vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao andre.io", "sua assinatura foi criada");

            // Retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 2
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Verificar se o documento já está cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso.");
            }

            //Verificar se o email já está cadastrado
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este email já está em uso.");
            }

            //Gerar os VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //Gerar as entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));

            //Só muda a implementação do pagamento
            var payment = new PayPalPayment
                          (
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PaymentDocumentType),
                address,
                email
                          );

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Agrupar as validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            //Checar as notificações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar a assinatura"));
            }

            //Salvar as informações
            _repository.CreateSubscription(student);

            //Enviar email de boas vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem Vindo ao balta.io", "Sua assinatura foi criada.");

            //Retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso!"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // Fail Fast
            command.Validate();
            if (command.Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }

            AddNotifications(command);
            // Verificar se documento já está cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Documeto já está em uso");
            }

            // Verificar se email já está cadastrado
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Email já está em uso");
            }

            // Gerar os VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State,
                                       command.Country, command.ZipCode);
            // Gerar as Entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.PaidDate,
                command.ExpireDate,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                command.Total,
                command.TotalPaid,
                address,
                email,
                command.TransactionCode
                );

            // Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);
            // Aplicar as Validações
            AddNotifications(name, document, email, address, student, subscription, payment);
            // Checar as notificações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }
            // Salvar as Informações
            _repository.CreateSubscription(student);
            // Enviar email de boas vindas
            _emailService.Send(command.Email, "*****@*****.**", "Bem vindo ao MDR", "Parabéns, agora você faz parte do Time!");
            // Retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 4
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            if (_studentRepository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este e-mail já está em uso");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Addres(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            var student       = new Student(name, document, email);
            var subscription  = new Subscription(DateTime.Now.AddMonths(1));
            var payerDocument = new Document(command.PayerDocument, command.PayerDocumentType);
            var payment       = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, payerDocument, command.Payer, address, email);

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            _studentRepository.CreateSubscription(student);

            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo", "Sua assinatura foi criada");

            return(new CommandResult(true, "Assinatura Realizada com Sucesso"));
        }
Ejemplo n.º 5
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Fail fast validations
            // command.Validate();
            // if(command.Invalid)
            // {
            //     AddNotifications(command);
            //     return new CommandResult(false, "Não foi possível realizar sua assinatura!");
            // }

            //Verificar se Documento já está cadastrado
            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está cadastrado!");
            }

            //Verificar se Email já está cadastrado
            if (_studentRepository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este E-mail já está em usi");
            }

            //Gerar VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //Gerar Entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                address,
                email
                );

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Aplicar as Validações
            AddNotifications(document, email, address, student, subscription, payment);

            //Salvar as Informações
            _studentRepository.CreateSubscription(student);

            //Enviar E-mail de boas Vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao balta.io!", "Sua assinatura foi criada!");

            //Retornar as informações
            return(new CommandResult(true, "Assinatura realizada com sucesso!"));
        }
        public ICommandResult Handler(CreatePayPalSubscriptionCommand command)
        {
            //Fail Fast Validation
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }

            //Verifica se o documento já esta cadastrado!
            if (studentyRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            if (studentyRepository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este email já está em uso");
            }

            //Entities e V.O.
            var name         = new Name(command.FirstName, command.LastName);
            var email        = new Email(command.Email);
            var address      = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Contry, command.ZipCode);
            var document     = new Document(command.Document, EDocumentType.CPF);
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));

            var payment = new PayPalPayment(command.TransactionCode,
                                            command.PaidDate,
                                            command.ExpireDate,
                                            command.Total,
                                            command.TotalPaid,
                                            command.Payer, new Document(command.PayerDocument, command.PayerDocumentType),
                                            address, email);

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Agrupa as validações
            AddNotifications(name, document, address, student, subscription, payment);

            //Valida
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }

            //Salva as informacoes
            studentyRepository.CreateSubscription(student);

            //Envia e-mail de boas vindas
            emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo", "Sua assinatura foi criada!");

            //retorna as informações
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 7
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //CREATE FAIL FAST VALIDATIONS

            //Verify if document has been saved
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF ja esta em uso");
            }

            //verifify if e-mail has been saved
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("E-mail", "Este E-mail ja esta em uso");
            }

            //Create VO's
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //Create Entities
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode,
                                                 command.PaidDate,
                                                 command.ExpireDate,
                                                 command.Total,
                                                 command.TotalPaid,
                                                 command.Payer,
                                                 new Document(command.Document, EDocumentType.CPF),
                                                 address,
                                                 email
                                                 );

            // Relationships
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Group validations
            AddNotifications(name, document, email, address, student, subscription, payment);

            //Check notifications
            if (Invalid)
            {
                return(new CommandResult(false, "It was not possible to subscribe"));
            }

            //Save information
            _repository.CreateSubscriprion(student);

            //Send welcome e-mail
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Welcome", "Your subscription has been created");

            //return information
            return(new CommandResult(true, "Subscription success"));
        }
Ejemplo n.º 8
0
        public void ShouldReturnErrorWhenNameIsInvalid()
        {
            var command = new CreatePayPalSubscriptionCommand();

            command.FirstName = "";

            command.Validate();
            Assert.AreEqual(false, command.Valid);
        }
Ejemplo n.º 9
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // Check if document exists
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Document already exists");
            }

            // Check if email exists
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Email already exists");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, Domain.Enums.EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(
                command.Street,
                command.Number,
                command.Neighborhood,
                command.City,
                command.State,
                command.County,
                command.ZipCode
                );

            var student      = new Student(name, document, email, address);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                new Document(command.PayerDocument, command.PayerDocumentType),
                command.Payer,
                address,
                email
                );

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "Unable to finish the subscription"));
            }

            _repository.CreateSubscription(student);

            _emailService.Send(student.Name.ToString(), student.Email.Address, "Welcome", "Your subscription was created");

            return(new CommandResult(true, "Successful Subscription"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // verificar se documento já está cadastrado
            if (_repository.DocucumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            // verificar se email ja esta cadastrado
            if (_repository.EmailExists(command.Document))
            {
                AddNotification("Email", "Este e-mail já está em uso");
            }

            // gerar VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Contry, command.ZipCode);


            // gerar entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                address,
                email);

            // relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            // agrupar as validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            // salvar informações
            _repository.CreateSubscription(student);

            // enviar email de boas vindas
            _emailService.Send(
                student.Name.ToString(),
                student.Email.Address,
                "Bem vindo ao balta.io",
                "Sua assiantura foi criada"
                );

            // retornar informações
            return(new CommandResult(true, "Asssinatura realizada com sucesso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // Fail fast validations
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Subscription were not created"));
            }

            // Validates if Document exists
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "This CPF is already in use");
            }

            // Validates if Email exists
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "This E-mail is already in use");
            }

            // Create VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            // Create Entities
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid,
                                                 command.Payer, new Document(command.PayerDocument, command.PayerDocumentType), address, new Email(command.PayerEmail));

            // Relationships
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            // Aggregate notifications
            AddNotifications(name, document, email, address, subscription, student, payment);

            // Check notifications
            if (Invalid)
            {
                return(new CommandResult(false, "It was not possible to create your subscription"));
            }

            // Save information
            _repository.CreateSubscription(student);

            // Send email
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Welcome to this site", "Subscription created successfully");

            // Returns
            return(new CommandResult(true, "Subscription created successfully"));
        }
Ejemplo n.º 12
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //verificar se documento está cadastrado, sem precisar do Banco
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Esse CPF já esta em uso");
            }

            //verificar se email já está cadastrdo, sem precisar do Banco
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Esse Email já esta em uso");
            }

            //Gerar os VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            // Gerar as entidades, esa regiao muda de boleto para ca
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                address,
                email);

            //relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //agrupar as validacoes
            AddNotifications(name, document, email, address, student, subscription, payment);

            //checar as notificacoes
            if (Invalid)
            {
                return(new CommandResult(false, "Desculpe, Não foi possivel realizar sua assinatura"));
            }

            //salvar as informações
            _repository.CreateSubscription(student);

            //enviar e-mail de boas vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo", "Sua assinatura foi criada");

            //retornar informações
            return(new CommandResult(true, "Assinatura realizada com suceso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Fail Fast Validation
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Não foi possível realizar a assinatura."));
            }

            //Verificar se documento já está cadastrado
            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já existe.");
            }


            //Varificar se E-mail já está cadastrado
            if (_studentRepository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este email já existe.");
            }

            //Gerar VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.City, command.State, command.Country, command.ZipCode);

            //Gerar Entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, new Document(command.PayerDocument, command.PayerDocumentType), command.Payer, address, email);

            //Relacionamentos
            subscription.AddPayments(payment);
            student.AddSubscription(subscription);

            //Aplicar validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            //Check notificações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar a assinatura."));
            }

            //Salvar as informações
            _studentRepository.CreateSubscription(student);

            //Enviar email de boas vindas
            _emailService.Send(name.ToString(), student.Email.Address, "Assinatura realizada com sucesso", "");

            return(new CommandResult(true, "Assinatura realizada com sucesso."));
        }
Ejemplo n.º 14
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Fail Fast Validations
            //command.Validate();

            // if (command.Invalid)
            // {
            //     return new CommandResult(false, "Não foi possível realizar o seu cadastro.");
            // }

            // Verify if Document already exists
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso.");
            }

            // Verify if Email already exists
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este Email já está em uso.");
            }

            // Generate the Value Objects
            var name         = new Name(command.FirstName, command.LastName);
            var document     = new Document(command.Document, EDocumentType.CPF);
            var email        = new Email(command.Email);
            var address      = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                document,
                address,
                email);

            //Relationship
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Group of Validations
            AddNotifications(name, document, email, address, student, subscription, payment);

            //Save the info
            _repository.CreateSubscription(student);

            //Send a "Welcome" e-mail
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Batman Test", "Sua assinatura foi criada.");

            return(new CommandResult(true, "Assinatura realizada com sucesso."));
        }
Ejemplo n.º 15
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // Fast validation
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Invalid paramters"));
            }

            // Verificar documentos cadastrados
            if (_repository.DocumentExists(command.PayerDocument))
            {
                AddNotification("Document", "Current document already exists");
            }

            // Verificar se email está cadastrados
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Current email already exists");
            }

            // Gerar os VDs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.PayerDocument, command.PayerDocumentType);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            // Gerar as entidades
            var studant      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddDays(30));
            var payment      = new PayPalPayment(command.TransactinCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.PayerDocument, document, address, email);

            // Relacionamentos
            subscription.AddPayment(payment);
            studant.AddSubscription(subscription);

            // agrupar as validações
            AddNotifications(document, email, address, address, studant, subscription, payment);

            // Checar as validações
            if (Invalid)
            {
                return(new CommandResult(false, "Invalid parameters"));
            }

            // Salvar as informações
            _repository.CreateSubscription(studant);

            // Enviar email de boas vindas
            _emailService.Send(studant.Name.ToString(), studant.Email.Address, "Bem-vindo", "Body");

            // Retornar informações
            return(new CommandResult(true, "Success in signature"));
        }
Ejemplo n.º 16
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand cmd)
        {
            // Verificar se documento já está cadastrado
            if (_repository.DocumentExists(cmd.Document))
            {
                AddNotification("Document", "This CPF is already in use");
            }

            // Verificar se E-mail já está cadastrado
            if (_repository.EmailExists(cmd.Email))
            {
                AddNotification("Document", "This CPF is already in use");
            }

            // Gerar os VOs
            Name     name     = new Name(cmd.FirstName, cmd.LastName);
            Document document = new Document(cmd.Document, EDocumentType.CPF);
            Email    email    = new Email(cmd.Email);
            Address  address  = new Address(cmd.Street, cmd.Number, cmd.Neighborhood, cmd.City, cmd.State, cmd.Country, cmd.ZipCode);

            // Gerar as entidades
            Student       student      = new Student(name, document, email);
            Subscription  subscription = new Subscription(DateTime.Now.AddMonths(1));
            PayPalPayment payment      = new PayPalPayment(
                cmd.TransactionCode,
                cmd.PaidDate,
                cmd.ExpireDate,
                cmd.Total,
                cmd.Payer,
                new Document(cmd.PayerDocument, cmd.PayerDocumentType),
                cmd.TotalPaid,
                address,
                email
                );

            // Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            // Agrupar as Validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            // Salvar as informações
            _repository.CreateSubscription(student);

            // Enviar E-mail de boas vindas
            _emailService.Send(
                student.Name.ToString(),
                student.Email.Address,
                "Welcome to the rrsantos.com.br",
                "Your subscription has been created"
                );

            return(new CommandResult(true, "Subscription successful!"));
        }
Ejemplo n.º 17
0
        public ICommandResult Handler(CreatePayPalSubscriptionCommand command)
        {
            // Verificar se documento já está cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso.");
            }

            // Verificar se e-mail já está cadastrado
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este e-mail já está em uso");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            //var address = new Address(command.Address);

            // Gerar as Entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPid,
                command.Payer,
                new Document(command.PayerDocument,
                             command.PayerDocumentType),
                command.Address, email);

            // Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            // Agrupar as validaçoes
            AddNotifications(name, document, email, student, subscription, payment);

            // Checar as validações
            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura."));
            }

            // Salvar as Informações
            _repository.CreateSubscription(student);

            // Enviar e-mail de boas vindas
            _emailServicer.Send(student.Name.ToString(), student.Email.Address, "Bem vindo.", "Sua assinatura foi criada");

            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            /*command.Validate();
             * if(command.Invalid)
             * {
             *  AddNotifications(command);
             *  return new CommandResult(false, "Não foi possivel realizar sua assinatura");
             * }*/

            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            if (_studentRepository.DocumentExists(command.EnderecoEmail))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            var _name         = new Name(command.FirstName, command.LastName);
            var _document     = new Document(command.Document, Domain.Enum.EDocumentType.CPF);
            var _email        = new Email(command.EnderecoEmail);
            var _address      = new Address(command.Rua, command.Bairro, command.Cidade, command.Estado, command.Pais, command.Complemento, command.Numero, command.CEP);
            var _student      = new Student(_name, _document, _email);
            var _subscription = new Subscription(DateTime.Now.AddMonths(1));

            var paypalPayment = new PaypalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Owner,
                new Document(command.PayerDocument.Number, command.PayerDocumentType),
                _address,
                _email
                );

            _subscription.AddPayments(paypalPayment);
            _student.AddSubscription(_subscription);
            AddNotifications(_name, _document, _email, _address, _student, _subscription, paypalPayment);

            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possivel realizar sua assinatura"));
            }

            _studentRepository.CreateSubscription(_student);
            _emailService.Send(_student.Name.ToString(), _student.Email.EnderecoEmail, "Bem vindo", "Sua assinatura foi criada");
            AddNotifications(new Contract());
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "não foi possível realizar seu cadastro"));
            }

            //verificar se o documento já existe
            if (_repository.DocumentExists(command.Document))
            {
                AddNotifications(command);
                return(new CommandResult(false, "já existe um cadastro com o documento informado"));
            }

            //verificar se email já existe
            if (_repository.EmailExists(command.Email))
            {
                AddNotifications(command);
                return(new CommandResult(false, "já existe um cadastro com o e-mail informado"));
            }

            //gerar vo's
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //gerar entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, address,
                                                 new Document(command.PayerDocument, command.PayerDocumentType), command.Payer, email);

            //relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //aplicar validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            //salvar informações
            _repository.CreateSubscription(student);

            //Enviar email de boas vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "bem vindo ao serviceName", "Sua assinatura foi criada!");

            //retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso!"));
        }
Ejemplo n.º 20
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            if (_studentRepository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Document already in use");
            }

            if (_studentRepository.EmailExists(command.Email))
            {
                AddNotification("Email", "E-mail already in use");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);

            var address = new Address(command.Street, command.Number, command.Neighborhood,
                                      command.City, command.State, command.Country, command.ZipCode);

            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.PaidDate,
                                                 command.ExpireDate,
                                                 command.Total,
                                                 command.TotalPaid,
                                                 command.Payer,
                                                 new Document(command.PayerDocument, command.PayerDocumentType = EDocumentType.CPF),
                                                 address,
                                                 email,
                                                 command.TransactionCode);

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "An error occurred creating your subscription"));
            }

            _studentRepository.CreateSubscription(student);

            _emailService.Send(student.Name.ToString(),
                               student.Email.Address,
                               $"Welcome {student.Name.ToString()}!",
                               "Your subscription has been approved. Go ahead and create your study plan.");

            return(new CommandResult(true, "Subscription successful added"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Verificar se Documento já está cadastrado
            if (_repository.DocumentExists(command.PayerDocument))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }


            //Verificar se E-mail já está cadastrados
            if (_repository.EmailExists(command.PayerEmail))
            {
                AddNotification("Email", "Este E-mail já está em uso");
            }


            //Gerar os values Objects (VOs)
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.PayerDocument, EDocumentType.CPF);
            var email    = new Email(command.PayerEmail);
            var address  = new Address(command.Stret, command.Number, command.Neighborhood, command.City, command.State, command.Contry, command.zipCode);

            //Gerar as entidades
            var student       = new Entities.Student(name, email, document);
            var subscription  = new Entities.Subscription(DateTime.Now.AddMonths(1));
            var PayPalpayment = new Entities.PayPalPayment(command.TransactionCode, command.Number,
                                                           command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer,
                                                           new Document(command.Payer, command.PayerDocumentType), address, email);

            // Adiciona os Relacionamentos
            subscription.AddPayment(PayPalpayment);
            student.AddSubscription(subscription);

            // Agrupa as validações
            AddNotifications(name, document, address, student, subscription, PayPalpayment);

            //checar as notes
            if (Invalid)
            {
                new CommandResult(false, "Assinatura realizada com suesso");
            }
            // Salvar as validações
            _repository.CreateSubscription(student);

            //Enviar E-mail de boas vindas
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao Beludo", "Sua assinatura foi criada");

            //Retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 22
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            // Verificar se documento está cadastrado
            if (_repository.DocumentExists(command.PayerDocument))
            {
                AddNotifications(new Contract());
                return(new CommandResult(false, "Esse CPF já está em uso"));
            }
            //Verificar se E-mail já está cadastrado
            if (_repository.EmailExists(command.PayerEmail))
            {
                AddNotifications(new Contract());
                return(new CommandResult(false, "Esse E-mail já está em uso"));
            }
            //Gerar os VOs
            var name    = new Name(command.FirstName, command.LastName);
            var doc     = new Document(command.PayerDocument, EDocumentType.CPF);
            var email   = new Email(command.PayerEmail);
            var address = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //Gerar as Entidades
            var student      = new Student(name, doc, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                new Document(command.PayerDocument, command.PayerDocumentType),
                command.Payer,
                address,
                email);

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Agrupar as Validações
            AddNotifications(name, doc, email, address, student, subscription, payment);

            //Salvar as Informações
            _repository.CreateSubscription(student);

            //Enviar E-mail de boas vindas
            _emailService.Send(student.Name.FirstName, student.Email.Address, "Bem vindo", "Sua assinatura foi criada");

            //Retornar informações
            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Verificar se documento já esta cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Documents", "Este CPF já se encontra cadastrado");
            }
            //Verificar se email já esta cadastrado
            if (_repository.DocumentExists(command.Email))
            {
                AddNotification("Documents", "Este E-mail já se encontra cadastrado");
            }
            //Gerar VO
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.State, command.Country, command.ZipCode);

            //Gerar entidades
            var student      = new Student(name, document, email, address);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.LastTrasnsactionCode,
                                                 command.PaidDate,
                                                 command.ExipreDate,
                                                 command.Total,
                                                 command.TotalPaid,
                                                 new Document(command.OwnerDocument, command.OwnerType),
                                                 command.Owner,
                                                 address,
                                                 email);

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscritpion(subscription);
            //Aplicar Validações
            AddNotifications(name, document, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }
            //Salvar Informações
            _repository.CreateSubscrption(student);
            //Enviar E-mail
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao Site", "Sua Assinatura foi criada");

            return(new CommandResult(true, "Assinatura Realizada com sucesso"));
        }
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            command.Validate();

            if (!command.IsValid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Não foi possível realizar o seu cadastro"));
            }

            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Document already exists.");
            }


            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "E-mail already exists");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.PayerDocument, command.PayerDocumentType);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer, document, address, email);

            subscription.AddPayment(payment);

            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            if (!IsValid)
            {
                return(new CommandResult(false, "It is not possible to complete the subscription"));
            }

            _repository.CreateSubscription(student);

            _emailService.Send(student.Name.ToString(), student.Email.Address, "Welcome to the network.", "Your registered had been completed successfully.");

            return(new CommandResult(true, "Subscription registered successfully."));
        }
Ejemplo n.º 25
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Verify whether document is already registred
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF ja esta em uso");
            }

            //Verify whether eamil is already registred
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este Email ja esta em uso");
            }

            //Generate VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            //Generate Entities
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PaypalPayment(command.TransactionCode,
                                                 command.PaidDate, command.ExpireDate, command.Total,
                                                 command.TotalPaid, command.Payer,
                                                 new Document(command.PaymentNumber, command.PayerDocumentType),
                                                 address, email);

            //Apply Relationship
            subscription.AddPayment(payment);
            student.AddSubcription(subscription);

            //Group Validation
            AddNotifications(name, document, email, address, student, subscription, payment);

            //Save information
            _repository.CreateSubscription(student);

            //Send Welcome E-mail
            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao guilherme.io", "Sua assinatura foi criada");

            //Return information
            return(new CommandResult(true, "Assinatura realizada com sucesso."));
        }
Ejemplo n.º 26
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "CPF em uso");
            }

            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Email em uso");
            }

            var name    = new Name(command.FirstName, command.LastName);
            var doc     = new Document(command.Document, EDocumentType.CPF);
            var email   = new Email(command.Email);
            var address = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            var student      = new Student(name, doc, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                address,
                email);

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, doc, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura"));
            }

            _repository.CreateSubscription(student);
            _emailService.Send(student.Name.ToString(), student.Email.Address, "bem vindo ao mad.io", "all you base are belong to us");

            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 27
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Não foi possível realizar sua assinatura!"));
            }

            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Document", "Este email já está em uso");
            }

            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City,
                                       command.State, command.Country, command.ZipCode);

            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate,
                                                 command.ExpireDate, command.Total, command.TotalPaid, command.Payer,
                                                 new Document(command.PayerDocument, command.PayerDocumentType), address, email);

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar sua assinatura!"));
            }

            _repository.CreateSubscription(student);

            return(new CommandResult(true, "Assinatura realizada com sucesso!"));
        }
Ejemplo n.º 28
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Verificar se Documento ja está cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF ja existe");
            }
            //Verificar se email já esta cadastrado
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Email", "Este Email ja existe");
            }
            //Gerar os VOs
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);
            var address  = new Address(command.Street, command.Number, command.City, command.State, command.Country, command.ZipCode);

            //Gerar as entidades
            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer, new Document(command.PayerDocument, command.PayerDocumentType), address, email);

            //Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //Agrupar  as validações
            AddNotifications(name, document, email, student);

            //Salvar as informações
            _repository.CreateSubscription(student);

            //Enviar email de boas vindas
            _emailService.Send(student.Name.ToString(), email.Adress, "Bem vindo", "sua assinatura esta tudo ok");

            //retornar as informacoes
            return(new CommandResult(true, "Assinatura com sucesso"));
        }
Ejemplo n.º 29
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este cpf já está em uso.");
            }

            if (_repository.DocumentExists(command.Email))
            {
                AddNotification("Email", "Este e-mail já está em uso.");
            }


            var name     = new Name("Bruce", "Wayne");
            var document = new Domain.ValueObjects.Document("58941728029", EDocumentType.CPF);
            var email    = new Email("*****@*****.**");
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode);

            var student      = new Student(name, document, email);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(command.TransactionCode, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid,
                                                 address, new Document(command.PayerDocument, command.PayerDocumentType), command.Owner, email);

            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            AddNotifications(name, document, email, address, student, subscription, payment);

            if (Invalid)
            {
                return(new CommandResult(false, "Não foi possível realizar a sua assinatura"));
            }

            _repository.CreateSubscription(student);

            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo", "Sua assinatura foi criada.");

            return(new CommandResult(true, "Assinatura realizada com sucesso"));
        }
Ejemplo n.º 30
0
        public ICommandResult Handle(CreatePayPalSubscriptionCommand command)
        {
            //Fail fast Validations

            /*command.Validate();
             * if (command.Invalid)
             * {
             *  AddNotifications(command);
             *  return new CommandResult(false, "não foi possivel realizar sua assinatura.");
             * }*/

            //verificar se o documento ja esta cadastrado.
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso");
            }

            //Verificar se o email ja esta cadastrado
            if (_repository.EmailExists(command.Email))
            {
                AddNotification("Email", "Este email já está em uso");
            }

            //gerar os VOS
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var email    = new Email(command.Email);

            var address = new Address(command.Street, command.Number, command.Neighborhood
                                      , command.City, command.State, command.Country, command.ZipCode);


            //gerar as entidades
            var student = new Student(name, document, email);
            //assumindo q seja um boleto mensal.
            var subscription = new Subscription(DateTime.Now.AddMonths(1));

            var payment = new PayPalPayment(
                command.TransactionCode,

                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                new Document(command.PayerDocument, command.PayerDocumentType),
                address,
                email);

            //Relacionamentos.
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);

            //agrupar as validacoes
            AddNotifications(name, document, email, address, student, subscription, payment);

            //salvar as informações
            _repository.CreateSubscription(student);

            //enviar email de boas vindas.

            _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem vindo ao balta.io", "Sua assinatura foi criada");
            //retornar informacos

            return(new CommandResult(true, "Assinatura realizada com sucesso."));
        }