Christmas gifts and timed gift e-mails
- Gifts bought 15 Nov - 6 Jan get a Christmas card ("Boldog karácsonyt és
csillagos 2027-et!", snowflakes) and a Christmas e-mail subject.
- The buyer can time the gift e-mail (e.g. Christmas morning); "Küldés most"
replaces a waiting one, a refund takes it back.
- Admin: timed e-mails by hour (waiting / sent / failed), e-mail state per gift.
- /karacsony landing page; seasonal hints on /csomagok and /ajandek.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -327,6 +327,7 @@ async fn confirm_by_email(
|
||||
"promo_code": gift.code,
|
||||
"recipient_name": gift.recipient_name,
|
||||
"recipient_email": gift.recipient_email,
|
||||
"send_at": gift.send_at_local,
|
||||
});
|
||||
// Handed over by the buyer: the card comes with the confirmation.
|
||||
if gift.recipient_email.is_none() {
|
||||
@@ -375,13 +376,16 @@ pub async fn checkout_status(
|
||||
}
|
||||
let gift = match gift_id {
|
||||
Some(id) => {
|
||||
let (name, to): (Option<String>, Option<String>) =
|
||||
sqlx::query_as("SELECT recipient_name, recipient_email FROM gifts WHERE id = $1")
|
||||
let (name, to, send_at): (Option<String>, Option<String>, Option<OffsetDateTime>) =
|
||||
sqlx::query_as("SELECT recipient_name, recipient_email, send_at FROM gifts WHERE id = $1")
|
||||
.bind(id)
|
||||
.fetch_optional(&state.db)
|
||||
.await?
|
||||
.unwrap_or_default();
|
||||
Some(json!({ "id": id, "recipient_name": name, "recipient_email": to }))
|
||||
Some(json!({
|
||||
"id": id, "recipient_name": name, "recipient_email": to,
|
||||
"send_at": crate::views::rfc3339_opt(send_at.filter(|t| *t > OffsetDateTime::now_utc())),
|
||||
}))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user