Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standard and 'double alternate' methods #2

Merged
merged 5 commits into from
Mar 9, 2016

Conversation

franciscocardoso
Copy link
Contributor

Currently we are using a fork of modcheck which is a very poor implementation of the modulus checking algorithm as described here.

This PR adds a implementation of modulus-checking, inspired on bazerk/uk-modulus-checking, which will help us to avoid some issues regarding correct account configuration being flagged as invalid.

NOTE: All the test cases described in the documentation are covered by unit tests.

}

return this.pickPosition(number, 'h') === (10 - remainder);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for else keyword.

*/

loadScsubtab() {
const reader = new LineReader(`${__dirname}/data/scsubtab.txt`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change LineReader to a simple require?

@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch from 227db9c to f96b662 Compare March 8, 2016 12:47

const accounts = {
invalid: [
{ number: '15763217', sortCode: '938063' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change number to accountNumber?

@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch from f96b662 to 9b8c02b Compare March 8, 2016 12:49
describe('UkModulusChecking', () => {
describe('isValid()', () => {
accounts.invalid.forEach(function(account) {
it(`should return false if sortCode is ${account.sortCode} and number is ${account.number}`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… and account number is …

@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch 8 times, most recently from ff6ac3a to 04a9e5c Compare March 8, 2016 17:16
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:0.10
FROM seegno/node:latest

RUN adduser -S node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The seegno/node Dockerfile already adds this user.

@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch 2 times, most recently from 02556a8 to 09d3be4 Compare March 9, 2016 14:40
@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch from 09d3be4 to 703bb08 Compare March 9, 2016 15:05
Francisco Cardoso added 3 commits March 9, 2016 18:05
This commit adds both 'modulus weight' and 'sorting code substitution'
tables along side with the validation account numbers documentation.
@franciscocardoso franciscocardoso force-pushed the feature/standard-and-double-alternate branch from 703bb08 to d847a5e Compare March 9, 2016 18:05
nunofgs added a commit that referenced this pull request Mar 9, 2016
Add standard and 'double alternate' methods
@nunofgs nunofgs merged commit a0ff3ed into master Mar 9, 2016
@nunofgs nunofgs deleted the feature/standard-and-double-alternate branch March 9, 2016 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants