#8 Implement new banks

Merged Svante swantzter Pseudo commit used to compare (afcb635...c1a04ab)
Missing base report.

Unable to compare commits because the base of the pull request did not upload a coverage report.

Changes found in between afcb635...c1a04ab (pseudo...base) which prevent comparing this pull request.

Showing 3 of 7 files from the diff.
Newly tracked file
src/format.ts changed.
Newly tracked file
src/validate.ts changed.
Newly tracked file
src/banks.ts changed.
Other files ignored by Codecov
package.json has changed.
CHANGELOG.md has changed.
package-lock.json has changed.
README.md has changed.

@@ -75,6 +75,8 @@
Loading
75 75
      return formatter(sortingCode, accountNumber, 'SSSS, AAA AAA AAA')
76 76
    } else if (bankName === 'Nordea Plusgirot') {
77 77
      return formatter(sortingCode, accountNumber, 'SSSS, AAA AA AA-A')
78 +
    } else if (bankName === 'Nordea') {
79 +
      return formatter(sortingCode, accountNumber, 'SSSS, AAAAAA-AAAA')
78 80
    } else {
79 81
      return formatter(sortingCode, accountNumber, 'SSSS-S, AA AAAA AAAA')
80 82
    }

@@ -2,7 +2,7 @@
Loading
2 2
type modFunction = (number: string | number) => boolean
3 3
4 4
export const mod10: modFunction = (number) => {
5 -
  number = `${number}`.substr(-10).padStart(10, '0') // pad not strictly neccesary here, but makes it clear and means we get O(n) operations
5 +
  number = `${number}`
6 6
7 7
  let len = number.length
8 8
  let bit = 1
@@ -20,7 +20,7 @@
Loading
20 20
}
21 21
22 22
export const mod11: modFunction = (number) => {
23 -
  number = `${number}`.substr(-10).padStart(10, '0') // pad not strictly neccesary here, but makes it clear and means we get O(n) operations
23 +
  number = `${number}`
24 24
25 25
  let len = number.length
26 26
  let sum = 0
@@ -37,7 +37,7 @@
Loading
37 37
}
38 38
39 39
export default (type: SortingCodeInfo['type'], comment: SortingCodeInfo['comment'], sortingCode: string, accountNumber: string) => {
40 -
  // 1:1 => mod11 on 3 last of clearng + whole account number
40 +
  // 1:1 => mod11 on 3 last of clearing + whole account number
41 41
  if (type === 1 && comment === 1) return mod11(`${sortingCode.substring(1)}${accountNumber.padStart(7, '0')}`)
42 42
  // 1:2 => mod 11 on whole clearing + whole account number
43 43
  if (type === 1 && comment === 2) return mod11(`${sortingCode}${accountNumber.padStart(7, '0')}`)

@@ -23,10 +23,10 @@
Loading
23 23
  'Forex Bank' | 'Handelsbanken' | 'ICA Banken' | 'IKANO Bank' |
24 24
  'JAK Medlemsbank' | 'Klarna Bank' | 'Lån & Spar Bank Sverige' | 'Landshypotek' |
25 25
  'Länsförsäkringar Bank' | 'Marginalen Bank' | 'MedMera Bank' | 'Nordax Bank' |
26 -
  'Nordea' | 'Nordea Plusgirot' | 'Nordnet Bank' | 'Resurs Bank' |
27 -
  'Riksgälden' | 'Santander Consumer Bank' | 'SBAB' | 'SEB' |
28 -
  'Skandiabanken' | 'Sparbanken Syd' | 'Svea Bank' | 'Swedbank' |
29 -
  'Ålandsbanken'
26 +
  'Nordea' | 'Nordea Plusgirot' | 'Nordnet Bank' | 'Northmill Bank' |
27 +
  'Resurs Bank' | 'Riksgälden' | 'Santander Consumer Bank' | 'SBAB' |
28 +
  'SEB' | 'Skandiabanken' | 'Sparbanken Syd' | 'Svea Bank' |
29 +
  'Swedbank' | 'Ålandsbanken'
30 30
31 31
export const banks: SortingCodeInfo[] = [
32 32
  // Type 1 accounts. Always 11 digits long sortingCode included.
@@ -169,6 +169,12 @@
Loading
169 169
    comment: 2,
170 170
    ranges: [[9100, 9109]]
171 171
  },
172 +
  {
173 +
    bankName: 'Northmill Bank',
174 +
    type: 1,
175 +
    comment: 2,
176 +
    ranges: [[9750, 9759]]
177 +
  },
172 178
  {
173 179
    bankName: 'Resurs Bank',
174 180
    type: 1,
@@ -238,7 +244,7 @@
Loading
238 244
    type: 2,
239 245
    comment: 2,
240 246
    ranges: [[6000, 6999]],
241 -
    accountMinLength: 9, // TODO: Check this, I have an account number from SHB that's 8 digits
247 +
    accountMinLength: 8,
242 248
    accountMaxLength: 9
243 249
  },
244 250
  {
@@ -277,7 +283,6 @@
Loading
277 283
    bankName: 'Swedbank',
278 284
    type: 2,
279 285
    comment: 3,
280 -
    // TODO: only use 4 digits for lookup
281 286
    ranges: [[8000, 8999]], // adding an extra 5-digit case to catch their 5 digit sorting codes
282 287
    accountMinLength: 10, // source: https://www.swedbank.se/privat/kort-och-betala/konton-for-in-och-utbetalningar/clearingnummer.html
283 288
    accountMaxLength: 11 // Allowing 11 here in case clearingnumber is sent as the first four instead of the first five

Unable to process changes.

No base report to compare against.

Files Coverage
src 74.63%
Project Totals (5 files) 74.63%
Loading