iban-service

module
v0.0.0-...-9fad143 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: MIT

README

Microservice for IBAN validation

This microservice is written in Go, without any dependencies. It supports SWIFT rules updates mechanism.

IBAN validation consists of two steps:

  1. checking IBAN structure, based on SWIFT rules: https://www.swift.com/standards/data-standards/iban-international-bank-account-number
  2. validating IBAN by converting it into an integer and performing a basic mod-97 operation

For more information: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN

API

Makes a basic GET request with iban parameter

curl http://127.0.0.1:8080/?iban=DK5000400440116243

Response will be returned with application/json content type:

{
  "iban": "DK5000400440116243",
  "valid": true
}

, where

  • iban (string) - your IBAN
  • valid (bool) - valid or not

API returns 400 BadRequest if no iban parameter provided:

{
  "error": "iban param required"
}

Makefile

make build

Build service binary

make run

Run microservice locally

make test

Run all tests

make generate-rules

Generate new iban/validator/rules.go file from SWIFT rules iban/assets/swift_iban.txt

make update-rules

Download new SWIFT rules file to iban/assets/swift_iban.txt and generate iban/validator/rules.go

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL