diff --git a/apps/web/lib/finalize-purchase.ts b/apps/web/lib/finalize-purchase.ts index a7703d8a..96a0e32e 100644 --- a/apps/web/lib/finalize-purchase.ts +++ b/apps/web/lib/finalize-purchase.ts @@ -11,6 +11,7 @@ import { send } from "@/services/mail"; import { formattedLocaleDate } from "@ui-lib/utils"; import { error } from "@/services/logger"; import { responses } from "@/config/strings"; +import getSymbolFromCurrency from "currency-symbol-map"; const finalizePurchase = async ( userId: string, @@ -103,10 +104,13 @@ async function sendSaleNotificationToAdmins({ (x) => x.email, ); + const currencySymbol = getSymbolFromCurrency( + domain?.settings?.currencyISOCode, + ); const emailBody = pug.render(saleEmailTemplate, { order: purchase?.orderId, courseName: course.title, - coursePrice: course.cost, + coursePrice: `${currencySymbol}${course.cost}`, date: formattedLocaleDate(purchase!.purchasedOn), email: user?.email, hideCourseLitBranding: domain?.settings.hideCourseLitBranding, diff --git a/apps/web/services/logger.ts b/apps/web/services/logger.ts index b15b2352..ed40d3a5 100644 --- a/apps/web/services/logger.ts +++ b/apps/web/services/logger.ts @@ -14,7 +14,7 @@ export const info = async ( metadata, }); } else { - console.error(severityError, message, metadata); + console.error(severityInfo, message, metadata); } }; diff --git a/apps/web/templates/sale-email.ts b/apps/web/templates/sale-email.ts index 9c8ad22a..dc4bd585 100644 --- a/apps/web/templates/sale-email.ts +++ b/apps/web/templates/sale-email.ts @@ -3,6 +3,9 @@ doctype html html head style(type='text/css'). + .email-container { + max-width: 960px; + } .cta-container { margin: 32px 0px; text-align: center; @@ -31,26 +34,40 @@ html border-radius: 6px; text-align: center; } - .signature { - padding-top: 20px; + .sale-notification-heading { + padding-bottom: 5px; + } + .sale-details { + padding-bottom: 10px; + } + .course-name-and-price { + display: flex; + justify-content: space-between; + align-items: center; + font-weight: bold; + padding-bottom: 20px; } body - p Yay! You have made a sale! - p Order: #{order} - p Date: #{date} - p Email: #{email} - p Course Title: #{courseName} - p Course Price: #{coursePrice} + div(class="email-container") + div(class="sale-notification-heading") + p Yay! You have made a sale! + div(class="sale-details") + p Order: #{order} + p Date: #{date} + p Email: #{email} + div(class="course-name-and-price") + span #{courseName} + span #{coursePrice} p(class="signature") - | Best, - p #[a(href="https://x.com/courselit") @CourseLit] + | Best, + p #[a(href="https://x.com/courselit") @CourseLit] if !hideCourseLitBranding div(class="courselit-branding-container") a( href="https://courselit.app" target="_blank" class="courselit-branding-cta" - ) Powered by CourseLit + ) Powered by CourseLit `; export default saleEmailTemplate;