This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@ffdc/api_corporate-accounts
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Corporate Accounts Helpers

Here are some helpers for the Accounts & Balances APIs from Corporate Banking

Interfaces for frontend usage

import {
  AccountDetail,
  AccountType,
  AccountStatement,
} from '@ffdc/api_corporate-accounts/interfaces';

When the importing the interfaces from a frontend only application, be sure to preprend by /interfaces.

GraphQL setup

configs/graphql-config.service.ts

import { GqlOptionsFactory, GqlModuleOptions } from '@nestjs/graphql';
import { Injectable } from '@nestjs/common';
import { CorporateAccountsModule } from '@ffdc/api_corporate-accounts';

@Injectable()
export class GqlConfigService implements GqlOptionsFactory {
  createGqlOptions(): GqlModuleOptions {
    const playgroundDevOptions = {
      settings: {
        'request.credentials': 'include',
      },
    };
    return {
      typePaths: ['./node_modules/@ffdc/api_corporate-accounts/**/*.graphql'],
      include: [CorporateAccountsModule],
      playground:
        process.env.NODE_ENV === 'production' ? false : playgroundDevOptions,
    };
  }
}

app.module.ts

import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { CorporateAccountsModule } from '@ffdc/api_corporate-accounts';
import { GqlConfigService } from './configs/graphql-config.service';

@Module({
  imports: [
    CorporateAccountsModule.forRoot({}),
    GraphQLModule.forRootAsync({
      useClass: GqlConfigService,
    }),
  ],
})
export class AppModule {}

Example GQL queries

Get accounts

query {
  accounts(
    limit: 10
    offset: 7
    fromDate: "2018-01-03"
    toDate: "2020-03-05"
    statementLimit: 1
  ) {
    items {
      id
      number
      type
      currency
      balances {
        availableBalance
      }
      statement {
        items {
          amount
        }
      }
    }
    _meta {
      itemCount
    }
  }
}

Get accounts with details and balance

query {
  accountsBalance(
    accountType: CURRENT
    equivalentCurrency: "EUR"
    fromDate: "2018-01-03"
    toDate: "2020-03-05"
  ) {
    items {
      id
      type
      currency
      availableBalance
      availableBalanceEquivalent
      equivalentCurrency
      details {
        number
        country
        bankShortName
      }
      statement {
        items {
          amount
        }
      }
    }
    _meta {
      itemCount
    }
  }
}

Get specific account detail

query($accountId: ID!) {
  account(id: $accountId) {
    id
    currency
    cutomerReference
  }
}

Get specific account balances

query($accountId: ID!) {
  accountBalance(id: $accountId) {
    id
    currency
    availableBalance
  }
}

Get specific account statement

query($accountId: ID!) {
  accountStatement(
    id: $accountId
    fromDate: "2018-01-03"
    toDate: "2020-03-05"
  ) {
    items {
      currency
      balance
      amount
      postingDate
      valueDate
      transactionType
    }
    _meta {
      itemCount
    }
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ffdc/api_corporate-accounts

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

1.24 MB

Total Files

67

Last publish

Collaborators

  • david.bocle
  • ffdcbot
  • maciejmaciejewski
  • ttalbot