glide-nodejs-sdk
Version:
Glide NodeJS SDK
34 lines (27 loc) • 971 B
JavaScript
const { object, string, number } = require("yup");
const createCardSchema = object().shape({
address1: string().label("Address 1").required(),
address2: string().label("Address 2").required(),
customerId: string().label("Customer").required(),
bvn: string()
.trim()
.label("Bvn")
.test("is valid", "You have provided invalid Bvn", (bvn) => {
if (!bvn) return true;
const bvnLength = bvn.length;
if (bvnLength === 11) return true;
return false;
}),
});
const activateCardSchema = object().shape({
customerId: string().label("Customer").required(),
last6: string().label("Last Six Digit").length(6).required(),
});
const fundCardSchema = object().shape({
amount: number().min(1).required(),
customerId: string().label("Customer").required(),
});
const cardBalanceSchema = object().shape({
customerId: string().label("Customer").required(),
});
module.exports = { createCardSchema, activateCardSchema, cardBalanceSchema, fundCardSchema };