Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 70x 14x 8x 8x 8x 8x 8x | /**
* Minimum Reserve BPS Validation Module
*
* Centralized validation schemas for minimum reserve bps forms.
*
* @module validation/merchant/minimumReserveBPS
*/
import * as Yup from "yup";
import { VALIDATION_MESSAGES } from "@validation/messages";
/**
* Minimum Reserve BPS and Rolling Reserve BPS schema for merchant
*/
export const createReserveSchema = (
reserveKey: "minimumReserveBPS" | "rollingReserveBPS",
) =>
Yup.object({
[reserveKey]: Yup.string()
.transform((value) => {
Iif (!value || value.trim() === "") return null;
return value.replace(/,/g, "");
})
.test(
"is-number-greater-than-zero",
VALIDATION_MESSAGES.MIN_MAX_RESERVE_BPS,
function (value) {
Iif (value === null || value === undefined || value === "")
return true;
const num = Number(value);
return num >= 1 && num <= 10000;
},
)
.nullable()
.required(VALIDATION_MESSAGES.REQUIRED),
});
|