VATIdValidator
public struct VATIdValidator
Undocumented
-
Possible validation errors.
incorrectLength
- The VAT identifier should have 10 digits.checkSumNotMatch
- Checksum should be equal 10th digit of the VAT Identifier.
Declaration
Swift
public enum ValidationError : Error
-
Common constructor.
Declaration
Swift
public init(_ vatId: [Int])
Parameters
vatId
The VAT identifier as array of integers.
-
Common constructor.
Declaration
Swift
public init<T>(_ vatId: T) where T : BinaryInteger
Parameters
vatId
The VAT identifier as any integer.
-
Common constructor. Converts double to integer.
Declaration
Swift
public init(_ vatId: Double)
Parameters
vatId
The VAT identifier as double.
-
Common constructor.
Declaration
Swift
public init(_ vatId: StringLiteralType)
Parameters
vatId
The VAT identifier as string.
-
Validates VAT identifer.
Throws
ValidationError.incorrectLength
The VAT Identifier should have 10 digits.ValidationError.checkSumNotMatch
Checksum should be equal 10th digit of the VAT Identifier.
Declaration
Swift
public func validate() throws