feat(donation): increase minimum custom donation amount to R$ 5.00
- Updated customAmountSchema min value from 0.01 to 5 - Adjusted validation logic and error messages to reflect new minimum - Modified DONATION_PRODUCTS minAmount for custom tier to 5 - Ensures donations meet the new minimum threshold for processing
This commit is contained in:
1 parent
e30d9493ff
commit
8b5817e8ca
2 files changed
+4
-4
No files matched your search
@@ -75,7 +75,7 @@ export const donationTierSchema = z.enum(
|
|||||||
// Schema para valor customizado
|
// Schema para valor customizado
|
||||||
export const customAmountSchema = z
|
export const customAmountSchema = z
|
||||||
.number()
|
.number()
|
||||||
.min(0.01, "Valor mínimo é R$ 0,01")
|
.min(5, "Valor mínimo é R$ 5,00")
|
||||||
.max(100000, "Valor máximo é R$ 100.000,00");
|
.max(100000, "Valor máximo é R$ 100.000,00");
|
||||||
|
|
||||||
// Schema completo para criação de doação
|
// Schema completo para criação de doação
|
||||||
@@ -116,12 +116,12 @@ export const createDonationSchema = z
|
|||||||
(data) => {
|
(data) => {
|
||||||
// Se tier for custom, customAmount deve estar no range válido
|
// Se tier for custom, customAmount deve estar no range válido
|
||||||
if (data.tier === "custom" && data.customAmount) {
|
if (data.tier === "custom" && data.customAmount) {
|
||||||
return data.customAmount >= 0.01 && data.customAmount <= 100000;
|
return data.customAmount >= 5 && data.customAmount <= 100000;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "Valor deve estar entre R$ 0,01 e R$ 100.000,00",
|
message: "Valor deve estar entre R$ 5,00 e R$ 100.000,00",
|
||||||
path: ["customAmount"],
|
path: ["customAmount"],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ export const DONATION_PRODUCTS = {
|
|||||||
name: "Valor Personalizado",
|
name: "Valor Personalizado",
|
||||||
amount: 0,
|
amount: 0,
|
||||||
price: 0,
|
price: 0,
|
||||||
minAmount: 0.01, // R$ 0,01
|
minAmount: 5, // R$ 5,00
|
||||||
maxAmount: 100000, // R$ 100.000,00
|
maxAmount: 100000, // R$ 100.000,00
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
Reference in new issue
Block a user