Here are some helpers for the Accounts & Balances APIs from Corporate Banking
import { AccountDetail, AccountType, AccountStatement } from '@finastra/api_corporate-accounts/interfaces';
When the importing the interfaces from a frontend only application, be sure to preprend by /interfaces
.
configs/graphql-config.service.ts
import { GqlOptionsFactory, GqlModuleOptions } from '@nestjs/graphql';
import { Injectable } from '@nestjs/common';
import { CorporateAccountsModule } from '@finastra/api_corporate-accounts';
@Injectable()
export class GqlConfigService implements GqlOptionsFactory {
createGqlOptions(): GqlModuleOptions {
const playgroundDevOptions = {
settings: {
'request.credentials': 'include',
},
};
return {
typePaths: ['./node_modules/@finastra/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 '@finastra/api_corporate-accounts';
import { GqlConfigService } from './configs/graphql-config.service';
@Module({
imports: [
CorporateAccountsModule.forRoot({}),
GraphQLModule.forRootAsync({
useClass: GqlConfigService,
}),
],
})
export class AppModule {}
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
}
}
}
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
}
}
}
query($accountId: ID!) {
account(id: $accountId) {
id
currency
cutomerReference
}
}
query($accountId: ID!) {
accountBalance(id: $accountId) {
id
currency
availableBalance
}
}
query($accountId: ID!) {
accountStatement(id: $accountId, fromDate: "2018-01-03", toDate: "2020-03-05") {
items {
currency
balance
amount
postingDate
valueDate
transactionType
}
_meta {
itemCount
}
}
}