Ejemplo n.º 1
0
        protected ArtistRecordOfSalesViewModelTests()
        {
            this.emailService = new Mock <IEmailService>();

            var claims    = new[] { new Claim(ClaimTypes.Name, ArtistRecordOfSalesViewModelTests.CurrentUserName) };
            var identity  = new ClaimsIdentity(claims, "MandarinTestIdentity");
            var principal = new ClaimsPrincipal(identity);

            this.authenticationStateProvider = new Mock <AuthenticationStateProvider>();
            this.authenticationStateProvider.Setup(x => x.GetAuthenticationStateAsync()).ReturnsAsync(new AuthenticationState(principal));
            this.recordOfSales = TestData.Create <RecordOfSales>();
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public async Task <EmailResponse> SendRecordOfSalesEmailAsync(RecordOfSales recordOfSales)
        {
            var request = new SendRecordOfSalesEmailRequest
            {
                RecordOfSales = this.mapper.Map <Api.Commissions.RecordOfSales>(recordOfSales),
            };
            var response = await this.emailsClient.SendRecordOfSalesEmailAsync(request);

            return(new EmailResponse {
                IsSuccess = response.IsSuccess, Message = response.Message
            });
        }
Ejemplo n.º 3
0
        private SendGridMessage BuildRecordOfSalesEmail(RecordOfSales recordOfSales)
        {
            var email         = new SendGridMessage();
            var configuration = this.sendGridConfigurationOption.Value;

            email.From = new EmailAddress(configuration.ServiceEmail);
            email.AddTo(new EmailAddress(recordOfSales.EmailAddress));
            email.TemplateId = configuration.RecordOfSalesTemplateId;
            email.SetTemplateData(recordOfSales);

            if (!string.Equals(recordOfSales.EmailAddress, configuration.RealContactEmail, StringComparison.OrdinalIgnoreCase))
            {
                email.ReplyTo = new EmailAddress(configuration.RealContactEmail);
                email.AddBcc(configuration.RealContactEmail);
            }

            return(email);
        }
Ejemplo n.º 4
0
 /// <inheritdoc/>
 public IArtistRecordOfSalesViewModel CreateArtistRecordOfSalesViewModel(RecordOfSales recordOfSales)
 {
     return(new ArtistRecordOfSalesViewModel(this.emailService, this.authenticationStateProvider, recordOfSales));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArtistRecordOfSalesViewModel"/> class.
 /// </summary>
 /// <param name="emailService">The application service for sending emails.</param>
 /// <param name="authenticationStateProvider">The service which provides access to the current authentication state..</param>
 /// <param name="recordOfSales">The artist commission breakdown.</param>
 public ArtistRecordOfSalesViewModel(IEmailService emailService, AuthenticationStateProvider authenticationStateProvider, RecordOfSales recordOfSales)
 {
     this.emailService = emailService;
     this.authenticationStateProvider = authenticationStateProvider;
     this.RecordOfSales = recordOfSales;
 }
Ejemplo n.º 6
0
 /// <inheritdoc/>
 public Task <EmailResponse> SendRecordOfSalesEmailAsync(RecordOfSales recordOfSales)
 {
     return(this.SendEmail(this.BuildRecordOfSalesEmail(recordOfSales)));
 }