uk-modulo-scala


License

License

MIT
Categories

Categories

Scala Languages
GroupId

GroupId

com.github.mpetruska
ArtifactId

ArtifactId

uk-modulo-scala_2.11
Last Version

Last Version

6.12.0
Release Date

Release Date

Type

Type

jar
Description

Description

uk-modulo-scala
uk-modulo-scala
Project URL

Project URL

https://github.com/mpetruska/uk-modulo-scala
Project Organization

Project Organization

com.github.mpetruska
Source Code Management

Source Code Management

https://github.com/mpetruska/uk-modulo-scala

Download uk-modulo-scala_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mpetruska/uk-modulo-scala_2.11/ -->
<dependency>
    <groupId>com.github.mpetruska</groupId>
    <artifactId>uk-modulo-scala_2.11</artifactId>
    <version>6.12.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mpetruska/uk-modulo-scala_2.11/
implementation 'com.github.mpetruska:uk-modulo-scala_2.11:6.12.0'
// https://jarcasting.com/artifacts/com.github.mpetruska/uk-modulo-scala_2.11/
implementation ("com.github.mpetruska:uk-modulo-scala_2.11:6.12.0")
'com.github.mpetruska:uk-modulo-scala_2.11:jar:6.12.0'
<dependency org="com.github.mpetruska" name="uk-modulo-scala_2.11" rev="6.12.0">
  <artifact name="uk-modulo-scala_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mpetruska', module='uk-modulo-scala_2.11', version='6.12.0')
)
libraryDependencies += "com.github.mpetruska" % "uk-modulo-scala_2.11" % "6.12.0"
[com.github.mpetruska/uk-modulo-scala_2.11 "6.12.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
org.scala-lang.modules : scala-parser-combinators_2.11 jar 1.0.5

test (2)

Group / Artifact Type Version
org.scalatest : scalatest_2.11 jar 3.0.1
org.scalacheck : scalacheck_2.11 jar 1.13.4

Project Modules

There are no modules declared in this project.

Build Status Known Vulnerabilities

UK modulo - Scala

This is an implementation of the VocaLink UK Bank account number modulus checking version 6.12 (and previous versions), written in Scala.

Modulus checking is a procedure used to determine whether a bank account number can be valid. If the account number check is negative then the account cannot exist, but the opposite is not true (meaning that if the check succeeds that does not guarantee the existence of the account).

Modulus checking can be used to help detect some input errors, but unfortunately there can be user errors that remain undetected.

License: MIT

Notes on validating sort codes

The "Industry Sorting Code Directory" (ISCD) should be used to validate UK sort codes.

Getting started

Sbt:

libraryDependencies += "com.github.mpetruska" %% "uk-modulo-scala" % "6.12.0"

pom.xml:

<dependency>
  <groupId>com.github.mpetruska</groupId>
  <artifactId>uk-modulo-scala_2.12</artifactId>
  <version>6.12.0</version>
</dependency>

Usage

Scala:

import com.github.mpetruska.ukmodulo.ModulusCheck

// valid account number
ModulusCheck.check(sortCode = "089999", accountNumber = "66374958") === Right(true)

// invalid account number
ModulusCheck.check(sortCode = "089999", accountNumber = "66374959") === Right(false)

// invalid format
ModulusCheck.check(sortCode = "089999", accountNumber = "xxxx") === Left("Account number format is not valid")

Java:

import com.github.mpetruska.ukmodulo.java.ModulusCheck;
import com.github.mpetruska.ukmodulo.java.ModulusCheckResult;

// valid account number
new ModulusCheck().check("089999", "66374958").isValidAccountNumber() == true;

// invalid account number
ModulusCheckResult result = new ModulusCheck().check("089999", "66374959");
result.isValidAccountNumber() == false;
result.isError() == false;

// invalid format
ModulusCheckResult result2 = new ModulusCheck().check("089999", "xxxx");
result2.isError() == true;
result2.error() == "Account number format is not valid";

Issues

Please report issues and feature requests here.

Version history

Versions

Version
6.12.0
6.1.0
6.00.1
6.00.0
5.90.0
5.80.0
5.70.0
5.50.0
5.40.0
5.30.0
5.20.0
5.10.0
5.0.0
1.9.0
1.8.0
1.7.0
1.6.0
1.5.0
1.4.0
1.3.0
1.2.0
1.1.0
1.0.2
1.0.1
1.0.0