mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[server] Send a notification email on BF deal purchase
This commit is contained in:
parent
70b90e8123
commit
f5549d4458
@ -11,3 +11,8 @@ type BlackFridayOffer struct {
|
||||
}
|
||||
|
||||
type BlackFridayOfferPerCountry map[string][]BlackFridayOffer
|
||||
|
||||
const (
|
||||
BF2024EmailTemplate = "bf_2024.html"
|
||||
BF2024EmailSubject = "Black Friday deal confirmation"
|
||||
)
|
||||
|
138
server/mail-templates/bf_2024.html
Normal file
138
server/mail-templates/bf_2024.html
Normal file
@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1,
|
||||
minimum-scale=1" />
|
||||
<style>
|
||||
body {
|
||||
background-color: #f0f1f3;
|
||||
font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 27px;
|
||||
margin: 0;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #f4f4f4f4;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
table td {
|
||||
border-color: #ddd;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
background-color: #fff;
|
||||
padding: 30px;
|
||||
max-width: 525px;
|
||||
margin: 0 auto;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.button {
|
||||
background: #0055d4;
|
||||
border-radius: 3px;
|
||||
text-decoration: none !important;
|
||||
color: #fff !important;
|
||||
font-weight: bold;
|
||||
padding: 10px 30px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background: #111;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #888;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.gutter {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0055d4;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.wrap {
|
||||
max-width: auto;
|
||||
}
|
||||
|
||||
.gutter {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-icons {
|
||||
padding: 4px !important;
|
||||
width: 24px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="gutter" style="padding: 4px"> </div>
|
||||
<div class="wrap" style=" background-color: rgb(255, 255, 255); padding: 2px
|
||||
30px 30px 30px; max-width: 525px; margin: 0 auto; border-radius: 5px;
|
||||
font-size: 16px; " >
|
||||
<p>Congratulations on claiming a deal on Ente's last Black Friday sale!</p>
|
||||
|
||||
<p>Your account has been credited with <strong>{{.Storage}}</strong> of storage. Please note that you can share this with your family.</p>
|
||||
|
||||
<p>If you need help with anything, please write back!</p>
|
||||
</div>
|
||||
<br />
|
||||
<div class="footer" style="text-align: center; font-size: 12px; color:
|
||||
rgb(136, 136, 136)" >
|
||||
<div>
|
||||
<a href="https://ente.io" target="_blank" ><img
|
||||
src="https://email-assets.ente.io/ente-green.png" style="width: 100px;
|
||||
padding: 24px" title="Ente" alt="Ente" /></a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://fosstodon.org/@ente" target="_blank" ><img
|
||||
src="https://email-assets.ente.io/mastodon-icon.png"
|
||||
class="footer-icons" style="width: 24px; padding: 4px" title="Mastodon"
|
||||
alt="Mastodon" /></a>
|
||||
<a href="https://twitter.com/enteio" target="_blank" ><img
|
||||
src="https://email-assets.ente.io/twitter-icon.png" class="footer-icons"
|
||||
style="width: 24px; padding: 4px" title="Twitter" alt="Twitter" /></a>
|
||||
<a href="https://discord.ente.io" target="_blank" ><img
|
||||
src="https://email-assets.ente.io/discord-icon.png" class="footer-icons"
|
||||
style="width: 24px; padding: 4px" title="Discord" alt="Discord" /></a>
|
||||
<a href="https://github.com/ente-io" target="_blank" ><img
|
||||
src="https://email-assets.ente.io/github-icon.png" class="footer-icons"
|
||||
style="width: 24px; padding: 4px" title="GitHub" alt="GitHub" /></a>
|
||||
</div>
|
||||
<p>
|
||||
Ente Technologies, Inc.
|
||||
<br /> 1111B S Governors Ave 6032 Dover, DE 19904
|
||||
</p>
|
||||
<br />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -5,6 +5,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/ente-io/museum/pkg/controller/usercache"
|
||||
@ -17,6 +18,7 @@ import (
|
||||
"github.com/ente-io/museum/pkg/utils/array"
|
||||
"github.com/ente-io/museum/pkg/utils/billing"
|
||||
"github.com/ente-io/museum/pkg/utils/config"
|
||||
emailUtil "github.com/ente-io/museum/pkg/utils/email"
|
||||
"github.com/ente-io/museum/pkg/utils/time"
|
||||
"github.com/ente-io/stacktrace"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -112,6 +114,15 @@ func (c *OfferController) ApplyOffer(email string, productID string) error {
|
||||
return stacktrace.Propagate(err, "")
|
||||
}
|
||||
go c.UserCacheCtrl.GetActiveStorageBonus(context.Background(), userID)
|
||||
go emailUtil.SendTemplatedEmail([]string{email}, "Ente", "team@ente.io",
|
||||
ente.BF2024EmailSubject,
|
||||
ente.BF2024EmailTemplate, map[string]interface{}{
|
||||
"Storage": c.readableStorage(offerToBeApplied.Storage),
|
||||
}, nil)
|
||||
c.DiscordController.NotifyBlackFridayUser(userID, offerToBeApplied.Price)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *OfferController) readableStorage(storage int64) string {
|
||||
return fmt.Sprintf("%d GB", storage/(1<<30))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user