uk-modulus-checking
Version:
Validate a UK bank account number against a sort code using the VocaLink modulus check
65 lines (44 loc) • 1.77 kB
Markdown
Modulus checking allows payment originators to confirm that customer codes and account numbers are compatible before submitting a Bacs Direct Credit of Direct Debit.
[![npm version][npm-image]][npm-url] [![build status][travis-image]][travis-url]
Install the package via `npm`:
```sh
npm install uk-modulus-checking --save
```
This method validates if the given accountNumber and sortCode represent a valid `Faster Payment Account`.
1. `accountNumber` *(string)*: The account number to validate.
2. `sortCode` *(string)*: The sort code to validate.
*(boolean)*: Returns `true` if the account is valid.
```js
new UkModulusChecking({ accountNumber: '15764273', sortCode: '938063' }).isValid();
// => false
new UkModulusChecking({ accountNumber: '66374958', sortCode: '089999' }).isValid();
// => true
new UkModulusChecking({ accountNumber: '66374958', sortCode: '08-99-99' }).isValid();
// => true
new UkModulusChecking({ accountNumber: '66374958', sortCode: '08-9999' }).isValid();
// => true
```
```sh
npm test
```
```sh
npm version [<newversion> | major | minor | patch] -m "Release %s"
```
MIT
Many thanks to [bazerk/uk-modulus-checking](https://github.com/bazerk/uk-modulus-checking) for the original inspiration.
[]: https://img.shields.io/npm/v/uk-modulus-checking.svg?style=flat-square
[]: https://npmjs.org/package/uk-modulus-checking
[]: https://img.shields.io/travis/uphold/uk-modulus-checking.svg?style=flat-square
[]: https://img.shields.io/travis/uphold/uk-modulus-checking.svg?style=flat-square