Predicate function - Financial

The financial functions are used for validating financial identifiers, account numbers, amounts, and financial calculations.

  • Financial predicate functions validate defined formats, structures, and calculations only; they do not confirm real‑world existence unless explicitly stated.

  • Identifier validations (such as IBAN, SWIFT/BIC, VAT, and currency codes) apply format and checksum rules, not registry or bank verification.

  • Amount validations are culture‑aware, support currency symbols and separators, and reject non‑finite values (NaN, Infinity).

Function

Description

Example

IsValidIBAN(value) Returns true if the value is a valid International Bank Account Number (2-letter country code + 2 check digits + up to 30 alphanumeric characters).

  • "GB82WEST12345698765432" is true

  • "INVALID" is false

IsValidSWIFT(value) Returns true if the value is a valid SWIFT code (4-letter bank code + 2-letter country code + 2-character location code + optional 3-character branch code).

  • "DEUTDEFF" is true

  • "ABC" is false

IsValidBIC(value) Returns true if the value is a valid Bank Identifier Code (4-letter bank code + 2-letter country code + 2-character location code + optional 3-character branch code).

  • "DEUTDEFF500" is true

  • 123456789 is false (number)

IsValidVAT(value) Returns true if the value is a valid VAT number format (2-letter country code followed by 2-13 alphanumeric characters).

  • "GB123456789" is true

  • "GB1" is false

IsValidAccountNumber(value) Returns true if the value is a valid account number (8 to 17 digits).

  • "12345678901234567" is true

  • "1234_5678_9012" is true

  • "12345/678" is false

IsValidRoutingNumber(value) Returns true if the value is a valid routing number (must be exactly 9 digits and pass the routing number checksum algorithm: (3*(d0+d3+d6) + 7*(d1+d4+d7) + (d2+d5+d8)) mod 10 = 0).

  • "021000021" is true

  • "02100002A" is false

IsValidSortCode(value) Returns true if the value is a valid sort code (6 digits).

  • "12 34 56" is true

  • "12-34-5A" is false

IsCreditCardNumber(value) Returns true if the value is a valid credit card number (13-19 digits).

  • "4111111111111111" is true

  • "123456" is false

IsCurrencyCode(value) Returns true if the value is a valid ISO 4217 currency code format (exactly 3 uppercase letters).

  • "USD" is true

  • "US" is false

IsAmountPositive(value) Returns true if the amount is positive (greater than zero).

  • 100 is true

  • 0 is false

IsAmountNegative(value) Returns true if the amount is negative (less than zero).

  • -50 is true

  • 10 is false

IsAmountBetween(value, min, max) Returns true if the amount is between minimum and maximum values (inclusive by default).

  • (7500, 5000, 10000) is true

  • (12000, 5000, 10000) is false

IsTaxCalculationValid(net, taxRate, gross) Returns true if net + (net * taxRate) equals gross.

  • (100, 0.1, 110) is true

  • (100, 0.1, 115) is false

IsLineItemTotalValid(itemPrice, quantity, totalPrice) Returns true if itemPrice * quantity equals totalPrice.

  • (25, 4, 100) is true

  • (25, 4, 110) is false

IsDiscountValid(originalPrice, discountAmount, finalPrice) Returns true if originalPrice - discountAmount equals finalPrice.

  • (200, 50, 150) is true

  • (200, 30, 150) is false