mirror of
https://github.com/KevinMidboe/planetposen-mail.git
synced 2025-10-29 17:50:32 +00:00
Feat: Redesigner mail template (#2)
* Updated example env with SITE * Updated mail page title * Updated preview payload to match template * Updated mail template with new design
This commit is contained in:
@@ -7,12 +7,13 @@ import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Product struct {
|
||||
ProductNo int
|
||||
Name string
|
||||
Image string
|
||||
Description string
|
||||
Quantity int
|
||||
Price float32
|
||||
Currency string
|
||||
@@ -24,16 +25,44 @@ type ReceiptPageData struct {
|
||||
Products []Product
|
||||
}
|
||||
|
||||
type EmailTemplateData struct {
|
||||
PageTitle string
|
||||
Site string
|
||||
Date string
|
||||
OrderId string
|
||||
Customer Customer
|
||||
Products []Product
|
||||
Sum float32
|
||||
}
|
||||
|
||||
type Customer struct {
|
||||
FirstName string
|
||||
LastName string
|
||||
StreetAddress string
|
||||
ZipCode string
|
||||
City string
|
||||
}
|
||||
|
||||
func serveTemplate(response http.ResponseWriter, request *http.Request) {
|
||||
tmpl := template.Must(template.ParseFiles("mail-templates/order-confirmation.html"))
|
||||
// tmpl := template.Must(w)
|
||||
data := ReceiptPageData{
|
||||
PageTitle: "Ordrebekreftelse planetposen",
|
||||
OrderId: "k6z6wq2J_pFMBY78Sp0=",
|
||||
data := EmailTemplateData{
|
||||
PageTitle: "Takk for din bestilling!",
|
||||
Site: "https://planet.schleppe.cloud",
|
||||
Date: time.Now().Format("2006-01-02"),
|
||||
Sum: 266.43,
|
||||
OrderId: "0upJLUYPEYaOCeQMxPc=",
|
||||
Products: []Product{
|
||||
{Name: "Forrest", Image: "https://storage.googleapis.com/planetposen-images/838074447f08f03c4b75ac2030dcd01201c0656c.jpg", Description: "Sneaker Maker", Quantity: 4, Price: 49.99, Currency: "NOK"},
|
||||
{Name: "Cookie-Man Forrest", Image: "https://storage.googleapis.com/planetposen-images/2c47ed96b5e061d85f688849b998aa5e76c55c2a.jpg", Description: "Boots Brothers", Quantity: 3, Price: 99, Currency: "NOK"},
|
||||
{Name: "Floral", Image: "https://planet.schleppe.cloud/email/items/item-3.jpg", Description: "Swiss Made", Quantity: 1, Price: 129, Currency: "NOK"},
|
||||
{ProductNo: 1, Name: "Forrest", Image: "https://storage.googleapis.com/planetposen-images/838074447f08f03c4b75ac2030dcd01201c0656c.jpg", Quantity: 4, Price: 49.99, Currency: "NOK"},
|
||||
{ProductNo: 2, Name: "Cookie-Man Forrest", Image: "https://storage.googleapis.com/planetposen-images/2c47ed96b5e061d85f688849b998aa5e76c55c2a.jpg", Quantity: 3, Price: 99, Currency: "NOK"},
|
||||
{ProductNo: 3, Name: "Floral", Image: "https://planet.schleppe.cloud/email/items/item-3.jpg", Quantity: 1, Price: 129, Currency: "NOK"},
|
||||
},
|
||||
Customer: Customer{
|
||||
FirstName: "kevin",
|
||||
LastName: "Midbøe",
|
||||
StreetAddress: "Schleppegrells gate 18",
|
||||
ZipCode: "0001",
|
||||
City: "Oslo",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user