alex-therapeutics / diga-api-client

Production-ready java library for DiGA (Digital Health Application) manufacturers to integrate with DiGA API endpoints for code validation and billing.
https://github.com/alex-therapeutics/diga-api-client
Apache License 2.0
32 stars 13 forks source link

Calculate check character on diga code before validating against the API #24

Closed fongie closed 3 years ago

fongie commented 3 years ago

Problem

In the documentation at gkv and bitmarck's FAQ there is some mention of the manufacturer having to check the code is valid before sending it to the api (?). They are likely referring to the check character (last character) of the code. This does not seem urgent to implement as the API will respond if this is incorrect anyway, but it would be a nice to have feature.

Solution

In DigaCodeDefaultParser class there is a method for validating the code

It seems bitmarck is referring to https://base32check.org/ for doing this. Try to implement that (with the check character specification at gkv) and add it to the code validation method.

fongie commented 3 years ago

bitmarck has a repo that does this I think at https://github.com/bitmarck-service/base32check-java