add logic for test donat also add new flag is_test for all donats (default false)

This commit is contained in:
harold 2025-07-09 00:21:11 +05:00
parent d8182a19b7
commit 8fec0b850a
2 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,7 @@ CREATE TABLE IF NOT EXISTS donats (
order_id UUID NOT NULL,
target_id INTEGER,
paid_time TIMESTAMP,
is_test BOOLEAN DEFAULT 'false',
status VARCHAR(50) NOT NULL DEFAULT 'pending',

View File

@ -44,7 +44,14 @@ func (repoDonat *RepoDonat) CreateDonat(
"amount": amount,
"status": status,
"donat_user": donatUser,
"is_test": false,
}
if status == "test_donat" {
args["is_test"] = true
args["paid_time"] = time.Now().UTC()
}
_, err := repoDonat.db.Insert(ctx, sql.CreateDonat, args)
if err != nil {
slog.Error(err.Error())