Skip to content

Commit

Permalink
Auto prepend reference number with 00 if no standard models are used …
Browse files Browse the repository at this point in the history
…(97,11,22)
  • Loading branch information
ArtBIT committed May 15, 2023
1 parent 93065f1 commit 4549479
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/schema.js
Expand Up @@ -86,6 +86,15 @@ module.exports = yup.object({
.string()
.min(0)
.max(35)
.transform((value) => {
// IPS QR code requires 97, 22, 11 as model, if no model is used it needs to be indicated by prepending it with 00
// https://web.archive.org/web/20220109065457/https://nbs.rs/QRcode/info.html
const model = value.slice(0, 2);
if (["97", "22", "11"].contains(model)) {
return value;
}
return `00${value}`;
})
.test(
"poziv-na-broj",
"Model i poziv na broj moraju da prate sledeci format: MMKKBBB...B (MM-model, KK-kontrolni broj, BBB...B broj)",
Expand Down

0 comments on commit 4549479

Please sign in to comment.