fix: padding kontrolní číslice IBAN
CI / Generate TypeScript types (push) Successful in 35s
CI / Build server (push) Successful in 47s
CI / Build client (push) Successful in 51s
CI / Playwright E2E tests (push) Successful in 1m18s
CI / Server unit tests (push) Successful in 4m0s
CI / Build and push Docker image (push) Successful in 5m16s
CI / Notify (push) Successful in 45s
CI / Generate TypeScript types (push) Successful in 35s
CI / Build server (push) Successful in 47s
CI / Build client (push) Successful in 51s
CI / Playwright E2E tests (push) Successful in 1m18s
CI / Server unit tests (push) Successful in 4m0s
CI / Build and push Docker image (push) Successful in 5m16s
CI / Notify (push) Successful in 45s
This commit is contained in:
+2
-2
@@ -31,8 +31,8 @@ export function convertBbanToIban(bankAccountNumber: string): string {
|
|||||||
// Zatím napevno, nemá smysl řešit nic jiného než CZ
|
// Zatím napevno, nemá smysl řešit nic jiného než CZ
|
||||||
iban = iban.replace('C', '12').replace('Z', '35');
|
iban = iban.replace('C', '12').replace('Z', '35');
|
||||||
const remainder = BigInt(iban) % BigInt(97);
|
const remainder = BigInt(iban) % BigInt(97);
|
||||||
const checkDigits = BigInt(98) - remainder;
|
const checkDigits = (BigInt(98) - remainder).toString().padStart(2, '0');
|
||||||
iban = `${COUNTRY_CODE}${checkDigits.toString()}${bankCode}${prefix}${accountNumber}`;
|
iban = `${COUNTRY_CODE}${checkDigits}${bankCode}${prefix}${accountNumber}`;
|
||||||
if (iban.length !== 24) {
|
if (iban.length !== 24) {
|
||||||
throw Error("Neplatná délka sestaveného IBAN: " + iban.length + ", očekáváno 24");
|
throw Error("Neplatná délka sestaveného IBAN: " + iban.length + ", očekáváno 24");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user