Skip to content

FinTechTonic/openbankproject-node-js-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenBankProject API Node.js Client

A comprehensive Node.js client for the OpenBankProject API v5.1.0, providing access to all API endpoints with robust authentication and error handling.

Features

  • Complete API Coverage: Access to all 44 endpoint categories from the OpenBankProject API v5.1.0
  • Authentication: Support for both DirectLogin and GatewayLogin authentication methods
  • Error Handling: Comprehensive error handling with specific exception types
  • Promise-based API: Modern JavaScript with Promise-based methods for all operations
  • TypeScript-friendly: JSDoc comments for better IDE integration
  • Modular Design: Logically organized endpoint groups for better developer experience

Installation

npm install openbankproject-client

Quick Start

import { OpenBankProjectClient } from 'openbankproject-client';

// Initialize the client
const client = new OpenBankProjectClient({
  baseUrl: 'https://api.openbankproject.com',
  apiVersion: 'v5.1.0',
  username: 'your_username',
  password: 'your_password',
  consumerKey: 'your_consumer_key'
});

// Authenticate and use the API
async function main() {
  try {
    // Authenticate (automatically called when needed)
    await client.authenticate();
    
    // Get all banks
    const banks = await client.extendedBank.getBanks();
    console.log('Banks:', banks);
    
    // Get accounts for a specific bank
    const accounts = await client.extendedAccount.getPrivateAccountsAtBank('your_bank_id');
    console.log('Accounts:', accounts);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

main();

Authentication

The client supports two authentication methods:

DirectLogin

const client = new OpenBankProjectClient({
  baseUrl: 'https://api.openbankproject.com',
  apiVersion: 'v5.1.0',
  username: 'your_username',
  password: 'your_password',
  consumerKey: 'your_consumer_key'
});

GatewayLogin

const client = new OpenBankProjectClient({
  baseUrl: 'https://api.openbankproject.com',
  apiVersion: 'v5.1.0',
  gatewayLoginToken: 'your_gateway_login_token'
});

Pre-generated Token

const client = new OpenBankProjectClient({
  baseUrl: 'https://api.openbankproject.com',
  apiVersion: 'v5.1.0',
  directLoginToken: 'your_direct_login_token'
});

Available Endpoint Groups

The client provides access to all OpenBankProject API endpoints through logically organized endpoint groups:

  • accountAccess: Account access management
  • accountApplication: Account application operations
  • accountHolder: Account holder management
  • accountMetadata: Account metadata operations
  • accountPublic: Public account information
  • apiCollection: API collection management
  • apiConfiguration: API configuration operations
  • apiFavorite: API favorite management
  • apiManagement: API management operations
  • atm: ATM management and operations
  • branch: Branch management and operations
  • card: Card operations
  • connectorMethod: Connector method management
  • consent: Consent management
  • counterparty: Counterparty operations
  • counterpartyLimits: Counterparty limits management
  • counterpartyMetadata: Counterparty metadata operations
  • customer: Customer management
  • customerMeeting: Customer meeting operations
  • customerMessage: Customer message operations
  • directDebit: Direct debit operations
  • dynamicEndpoint: Dynamic endpoint management
  • dynamicEntity: Dynamic entity operations
  • dynamicMessageDoc: Dynamic message doc management
  • dynamicResourceDoc: Dynamic resource doc management
  • extendedAccount: Extended account operations
  • extendedBank: Extended bank operations
  • fx: Foreign exchange operations
  • kyc: KYC (Know Your Customer) operations
  • metric: Metrics and analytics
  • product: Product management
  • role: Role management
  • scheduledEvent: Scheduled event operations
  • scope: Scope management
  • standingOrder: Standing order operations
  • transaction: Transaction operations
  • transactionMetadata: Transaction metadata operations
  • transactionRequest: Transaction request operations
  • user: User management
  • userInvitation: User invitation operations
  • viewCustom: Custom view management
  • viewSystem: System view operations
  • webhook: Webhook management
  • webuiProps: WebUI properties management

Examples

Get Banks

const banks = await client.extendedBank.getBanks();
console.log('Banks:', banks);

Get Accounts

const accounts = await client.extendedAccount.getPrivateAccountsAtBank('your_bank_id');
console.log('Accounts:', accounts);

Create a Transaction Request

const transactionRequest = await client.transactionRequest.createTransactionRequest(
  'your_bank_id',
  'your_account_id',
  'owner',
  {
    to: {
      bank_id: 'destination_bank_id',
      account_id: 'destination_account_id'
    },
    value: {
      currency: 'USD',
      amount: '100.00'
    },
    description: 'Payment for services'
  }
);
console.log('Transaction request created:', transactionRequest);

Get Customer Information

const customer = await client.customer.getCustomer('your_bank_id', 'your_customer_id');
console.log('Customer details:', customer);

Error Handling

The client provides specific error types for different error scenarios:

import { 
  ApiError, 
  AuthenticationError, 
  ResourceNotFoundError,
  ValidationError, 
  PermissionError,
  ServerError 
} from 'openbankproject-client';

try {
  const accounts = await client.extendedAccount.getPrivateAccountsAtBank('your_bank_id');
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Authentication failed:', error.message);
  } else if (error instanceof ResourceNotFoundError) {
    console.error('Resource not found:', error.message);
  } else if (error instanceof ValidationError) {
    console.error('Validation error:', error.message);
  } else if (error instanceof PermissionError) {
    console.error('Permission denied:', error.message);
  } else if (error instanceof ServerError) {
    console.error('Server error:', error.message);
  } else {
    console.error('Unknown error:', error.message);
  }
}

License

Other/Proprietary License

About

A comprehensive Node.js client for the OpenBankProject API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors