https://github.com/anjulapaulus/iban-api
This api ifor validating IBAN numbers.
https://github.com/anjulapaulus/iban-api
clean-architecture go golang iban iban-validator rest-api restful-api
Last synced: 5 months ago
JSON representation
This api ifor validating IBAN numbers.
- Host: GitHub
- URL: https://github.com/anjulapaulus/iban-api
- Owner: anjulapaulus
- Created: 2022-05-27T07:32:25.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-29T07:25:36.000Z (about 4 years ago)
- Last Synced: 2024-06-20T00:27:10.822Z (about 2 years ago)
- Topics: clean-architecture, go, golang, iban, iban-validator, rest-api, restful-api
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/anjulapaulus/iban-api/actions/workflows/go.yml)
[](https://codecov.io/gh/anjulapaulus/iban-api)
[](https://goreportcard.com/report/github.com/anjulapaulus/iban-api)
# IBAN API
This api is responsible in validating IBAN numbers.
## Algorithm
1. Check that the total IBAN length is correct as per the country. If not, the IBAN is invalid.
2. Move the four initial characters to the end of the string.
3. Replace each letter in the string with two digits, thereby expanding the string, where A = 10, B = 11, ..., Z = 35.
4. Interpret the string as a decimal integer and compute the remainder of that number on division by 97
If the remainder is 1, the check digit test is passed and the IBAN might be valid.
Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Structure
## Build
### Makefile
Build binary for specific OS.
```
# Build for Windows
make build_windows
# Build for Linux
make build_linux
# Build for Darwin (macOS)
make build_darwin
```
Build binary based on local OS.
```
make build
# Could build and run binary
make build_and_run
```
Remove binaaries built
```
make clean
```
### Docker
Creating a container and running the API.
```
make docker_run
```
Stop and remove container.
```
make docker_rm
```
## Tests
Run the unit tests using make.
```
make test
```
## Usage
```
POST 127.0.0.1:3000/valid/iban
```
Header
```
Content-Type: application/json
```
Request Body
```
{
"iban":"VG96VPVG00000L2345678901"
}
```
Success Response - 200
```
{
"valid": false
}
```
Error Response - 400
```
{
"type": "",
"code": "",
"message": ""
}
```