示例#1
0
        public async Task SendPurchaseConfirmationAsync(ConfirmationEmailParameters confirmationParameters, int accountId)
        {
            var applicationUser = await accountRepository_.Value.FindUserByAccountIdAsync(accountId);

            var userProfileInfo = await creyRestClient_.GetUserProfileAsync(accountId);

            var templateParameters = new Dictionary <string, string>()
            {
                { "USER_NAME", userProfileInfo.DisplayName },
                { "CLIENT_ID", accountId.ToString() },
                { "CLIENT_COUNTRY", confirmationParameters.OrderLocation },
                { "INVOICE_NO", confirmationParameters.InvoiceId.ToString() },
                { "PAYMENT_DATE", $"{confirmationParameters.PaymentDate.UtcDateTime.ToLongDateString()}" },
                { "CURRENCY", confirmationParameters.Currency },
                { "PAYMENT_METHOD", confirmationParameters.PaymentMethod },
                { "ITEM_DESCRIPTION", confirmationParameters.ItemDescription },
                { "VAT_PERCENTAGE", confirmationParameters.VatPercentage.ToString() },
                { "VAT_AMOUNT", confirmationParameters.VatAmount.ToString() },
                { "TOTAL_AMOUNT", confirmationParameters.TotalAmount.ToString() }
            };

            await SendEmailTemplateAsync(applicationUser.Email, "invoice", templateParameters);

            var internalInvoiceParameters = templateParameters;

            internalInvoiceParameters.Add("USER_EMAIL", applicationUser.Email);
            internalInvoiceParameters.Add("ITEM_PRICE", confirmationParameters.ItemPrice.ToString());

            await SendEmailTemplateAsync(internalInvoiceEmailAddress_, "internal-invoice", internalInvoiceParameters);
        }
示例#2
0
        public async Task <ActionResult> SendPurchaseConfirmation(ConfirmationEmailParameters confirmationParameters, int accountId)
        {
            await emailSender_.Value.SendPurchaseConfirmationAsync(confirmationParameters, accountId);

            return(Ok());
        }
示例#3
0
        public async Task <ActionResult> SendPurchaseConfirmation(ConfirmationEmailParameters confirmationParameters)
        {
            await emailSender_.Value.SendPurchaseConfirmationAsync(confirmationParameters, User.IntoSessionInfo().AccountId);

            return(Ok());
        }