Skip to content

Commit

Permalink
Merge pull request #503 from GemeenteNijmegen/acceptance
Browse files Browse the repository at this point in the history
feat: Allow BSN's which include non-numeric chars
  • Loading branch information
joostvanderborg authored Jun 14, 2024
2 parents da1eb0a + 8b534c3 commit 96037ed
Show file tree
Hide file tree
Showing 7 changed files with 863 additions and 885 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 17 additions & 14 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions src/app/home/Response.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/app/home/homeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export class Home {

if (this.params.method == 'POST') {
try {
const bsnValidationResult = Bsn.validate(this.params.body.bsn);
const providedBsnString = this.params.body.bsn.replace(/\D/g, ''); //strip all nonnumeric characters
const bsnValidationResult = Bsn.validate(providedBsnString);
if (!bsnValidationResult.success) {
data.error = `Geen geldig bsn opgegeven: ${bsnValidationResult.message}`;
} else {
const bsn = new Bsn(this.params.body.bsn);
const bsn = new Bsn(providedBsnString);
data.controle_data = await this.brpData(bsn);
data.bsn = bsn.bsn;
}
Expand Down
5 changes: 3 additions & 2 deletions src/app/home/templates/home.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
<legend>Controleer op BSN</legend>
<div class="input">
<label>Wat is uw BSN</label>
<input type="number" name="bsn" value="{{bsn}}" data-copy />
<input name="bsn" value="{{bsn}}" data-copy />
</div>
<div><strong>Nieuw:</strong> BSN's met punten of koppeltekens (123.456.789) worden nu ook herkend.</div>
</fieldset>
<div class="actions">
<input type="submit" value="Controleren" />
</div>
</form>
{{>controle_form}}
{{/error}}
</main>
</main>
2 changes: 1 addition & 1 deletion src/app/home/tests/home.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('Requests to home route', () => {
method: 'POST',
cookies: 'session=12345',
contact_id: 'test',
body: { bsn: '900222670', xsrf_token: xsrf_token },
body: { bsn: '900.222.670', xsrf_token: xsrf_token }, //test with bsn including chars
}, apiClient, dynamoDBClient, mockedOidcClient());
const result = await home.handleRequest();
expect(result.body).toMatch('Geboortedatum');
Expand Down
Loading

0 comments on commit 96037ed

Please sign in to comment.