Giter Site home page Giter Site logo

openiban.js's Introduction

openiban.js

Service Shutdown Notice

The openiban API will cease operation on the 24th of May, 10 p.m. GMT.

You can read more about it at https://openiban.com.

Important: I will continue to maintain the goiban-service repository.

Build Status npm version

Official openiban.com API client for node and the browser. TypeScript typings are included in the repository.

Getting it

You can install openiban.js through npm or yarn.

npm i -S openiban

or

yarn add openiban

Or you can include it on your page through a CDN (e.g. unpkg):

<script type="text/javascript" src="//unpkg.com/[email protected]/dist/openiban.browser.js"></script>

Using it

openiban.js provides a Promise API to the openiban.com IBAN validation webservice.

Node.js

const Openiban = require('openiban');

openiban
  .validate('DE89370400440532013000')
  .then((result) => {
    // result.valid should be true
  })
  .catch((err) => {
    // some http error has occurred
  });

Typescript

openiban.js also publishes Typescript declarations.

import * as Openiban from 'openiban';

Openiban.validate('DE89370400440532013000')
  .then((r: ValidationResult) => {
    console.log(r);
    // {
    //   "valid": true,
    //   "messages": [
    //     "Bank code valid: 37040044"
    //   ],
    //   "iban": "DE89370400440532013000",
    //   "bankData": {
    //     "bankCode": "37040044",
    //     "name": "Commerzbank",
    //     "zip": "50447",
    //     "city": "Köln",
    //     "bic": "COBADEFFXXX"
    //   },
    //   "checkResults": {
    //     "bankCode": true
    //   }
    // }
  })
  .catch((e) => {
    // some http error has occurred
    console.error(e);
  })

Browser

When openiban.js is loaded inside your browser, it will be available through the global variable Openiban.

<html>
  <head>
    <script type="text/javascript" src="//unpkg.com/[email protected]/dist/openiban.browser.js"></script>
  </head>
  
  <body>
    <!-- ... -->

    <script type="text/javascript">
      Openiban
        .validate('DE89370400440532013000')
        .then((result) => {
          // result.valid should be true
        })
        .catch((err) => {
          // some http error has occurred
        });
    </script>
  </body>
</html>

openiban.js's People

Contributors

fourcube avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.