An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

[![Pipeline](https://github.com/anjulapaulus/iban-api/actions/workflows/go.yml/badge.svg)](https://github.com/anjulapaulus/iban-api/actions/workflows/go.yml)
[![codecov](https://codecov.io/gh/anjulapaulus/iban-api/branch/main/graph/badge.svg?token=gpb1RqnMrx)](https://codecov.io/gh/anjulapaulus/iban-api)
[![Go Report Card](https://goreportcard.com/badge/github.com/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": ""
}
```