diff --git a/.env.example b/.env.example
index 2a32a5d..9c1b1d5 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,4 @@
PORT=8000
+DOMAIN=
SEND_GRID_API_ENDPOINT=
SEND_GRID_API_KEY=
diff --git a/.gitignore b/.gitignore
index a546697..db7b9d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,6 @@ vendor/
# Env
.env
+
+# MacOS
+.DS_Store
diff --git a/cmd/preview/main.go b/cmd/preview/main.go
index d38e1a9..18f167a 100644
--- a/cmd/preview/main.go
+++ b/cmd/preview/main.go
@@ -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",
},
}
diff --git a/mail-templates/order-confirmation.html b/mail-templates/order-confirmation.html
index 963ca0a..29bc877 100644
--- a/mail-templates/order-confirmation.html
+++ b/mail-templates/order-confirmation.html
@@ -66,19 +66,19 @@
}
body {
- background: #f1f1f2;
margin: 0 auto;
padding: 0;
width: 100%;
height: 100%;
- background-color: #f1f1f2;
+ background: white;
+ background-color: white;
}
body > table {
- background: #f1f1f2;
border-collapse: collapse;
color: #373737;
- background-color: #f1f1f2;
+ background: white;
+ background-color: white;
}
.btn:hover tbody tr td {
@@ -88,6 +88,13 @@
.btn:hover tbody tr td a {
color: #18332F !important;
}
+
+ @media only screen
+ and (max-width : 480px) {
+ .desktop-only {
+ display: none;
+ }
+ }
@@ -102,105 +109,849 @@
- {{.PageTitle}}
-
- |
+ |
-
-
-
-
- | VARE |
- ANTALL |
- PRIS |
-
-
-
- {{ range .Products }}
-
-  |
-
-
- |
- {{.Quantity}} |
- {{.Currency}} {{.Price}} |
-
- {{ end }}
-
-
- | Frakt |
- NOK 75 |
-
-
- | Sum |
- NOK {{ .Sum }} |
-
-
-
-
-
-
-
-
-
- | leveringsadresse |
- frakt |
-
-
- |
- {{ .Customer.FirstName }} {{ .Customer.LastName }} {{ .Customer.StreetAddress }} {{ .Customer.City }}, {{ .Customer.ZipCode }}
- |
-
- Sendes med Posten BRING
- 4-8 dager
- |
-
-
-
-
-
-
+
+
- | Du vil motta en ny epost med sporingsnummer når din ordre blir sent. |
+
+ {{ .PageTitle }}
+
+ Hi {{ .Customer.FirstName }}, we're getting your order ready to be shipped. We will notify you when it has been sent. Orders for in-stock items typically ship within 2-3 Business Days. We appreciate your patience and understanding!
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ Ordre ID
+ |
+
+
+ {{.OrderId}}
+
+ |
+ |
+
+
+
+
+
+
+
+ {{ range .Products }}
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+ {{ .Name }}
+ |
+
+ {{ .Currency }} {{ .Price }}
+ |
+
+ {{ end }}
+
+
+
+
+
+ |
+
+ Subtotal
+ VAT
+ Shipping
+ Total
+ |
+
+ $239.00
+ $14.94
+ $10.00
+ NOK {{ .Sum }}
+ |
+
+
+
+
+
+ |
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Billing Address:
+
+
+ {{ .Customer.FirstName }} {{ .Customer.LastName }}
+ {{ .Customer.StreetAddress }}
+ {{ .Customer.City }}, {{ .Customer.ZipCode }}
+ Norway
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ Shipping Address:
+
+
+ {{ .Customer.FirstName }} {{ .Customer.LastName }}
+ {{ .Customer.StreetAddress }}
+ {{ .Customer.City }}, {{ .Customer.ZipCode }}
+ Norway
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ If you have any questions, reply to this email or contact us at
+ post@planetposen.no
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+ |
+
+ |
+
+
+
+ 31 W 27TH ST
+ NEW YORK
+ NY 10001
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+
diff --git a/mail/order_confirmation.go b/mail/order_confirmation.go
index 8d8af55..e59c2d5 100644
--- a/mail/order_confirmation.go
+++ b/mail/order_confirmation.go
@@ -63,7 +63,7 @@ type Record struct {
func OrderConfirmation(payload OrderConfirmationData) (*OrderConfirmationEmailData, error) {
var emailTemplate EmailTemplateData
- emailTemplate.PageTitle = "Ordrebekreftelse fra planetposen.no"
+ emailTemplate.PageTitle = "Takk for din bestilling!"
emailTemplate.Site = "https://planet.schleppe.cloud"
emailTemplate.Date = time.Now().Format("2006-01-02")
emailTemplate.Sum = payload.Sum
| |