https://github.com/uphold/uk-modulus-checking
Validate a UK bank account number against a sort code using the VocaLink modulus check.
https://github.com/uphold/uk-modulus-checking
Last synced: 6 months ago
JSON representation
Validate a UK bank account number against a sort code using the VocaLink modulus check.
- Host: GitHub
- URL: https://github.com/uphold/uk-modulus-checking
- Owner: uphold
- License: mit
- Created: 2016-03-07T23:05:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T21:30:44.000Z (about 2 years ago)
- Last Synced: 2024-11-09T13:47:41.871Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 10.8 MB
- Stars: 29
- Watchers: 65
- Forks: 18
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# uk-modulus-checking
Modulus checking allows payment originators to confirm that customer codes and account numbers are compatible before submitting a Bacs Direct Credit of Direct Debit.## Status
[![npm version][npm-image]][npm-url] [![build status][travis-image]][travis-url]## Installation
Install the package via `npm`:```sh
npm install uk-modulus-checking --save
```## Usage
### `new UkModulusChecking({ accountNumber, sortCode }).isValid()`
This method validates if the given accountNumber and sortCode represent a valid `Faster Payment Account`.
#### Arguments
1. `accountNumber` *(string)*: The account number to validate.
2. `sortCode` *(string)*: The sort code to validate.#### Returns
*(boolean)*: Returns `true` if the account is valid.#### Example
```js
new UkModulusChecking({ accountNumber: '15764273', sortCode: '938063' }).isValid();
// => falsenew UkModulusChecking({ accountNumber: '66374958', sortCode: '089999' }).isValid();
// => truenew UkModulusChecking({ accountNumber: '66374958', sortCode: '08-99-99' }).isValid();
// => truenew UkModulusChecking({ accountNumber: '66374958', sortCode: '08-9999' }).isValid();
// => true
```## Tests
```sh
npm test
```## Release
```sh
npm version [ | major | minor | patch] -m "Release %s"
```## License
MIT## Credits
Many thanks to [bazerk/uk-modulus-checking](https://github.com/bazerk/uk-modulus-checking) for the original inspiration.[npm-image]: https://img.shields.io/npm/v/uk-modulus-checking.svg?style=flat-square
[npm-url]: https://npmjs.org/package/uk-modulus-checking
[travis-image]: https://img.shields.io/travis/uphold/uk-modulus-checking.svg?style=flat-square
[travis-url]: https://img.shields.io/travis/uphold/uk-modulus-checking.svg?style=flat-square