obp-typescript
TypeScript icon, indicating that this package has built-in type declarations

1.0.36 • Public • Published

OBP-TypeScript

Install

yarn
  yarn add obp-typescript
npm
  npm install obp-typescript

Example

import {
  API,
  APIClientConfig,
  DirectLoginAuthentication,
  Version,
  get,
  create,
  Bank,
  Account,
  Transaction,
  GetTransactionsForAccountFull,
  TransactionRequestAccountBody,
  CreateTransactionRequestAccount,
} from "obp-typescript";

(async () => {
  const directLogin: DirectLoginAuthentication = {
    username: process.env.OBP_USERNAME || "",
    password: process.env.OBP_PASSWORD || "",
    consumerKey: process.env.OBP_CONSUMER_KEY || "",
  };
  const clientConfig: APIClientConfig = {
    baseUri: "https://apisandbox.openbankproject.com",
    version: Version.v500,
    authentication: directLogin,
  };
  const banks = await get<API.Bank>(clientConfig, Bank);
  const account = await get<API.Account>(clientConfig, Account);

  const transactionFn = get<API.Transaction>(clientConfig, Transaction);
  // Get transaction for account full.
  const transactionsForAccountFull = await transactionFn(
    GetTransactionsForAccountFull
  )("bankId", "accountId", "viewId");

  // New transaction body.
  const body: TransactionRequestAccountBody = {
    description: "Dummy transaction full data",
    to: {
      bank_id: "bankId",
      account_id: "accountId",
    },
    value: {
      currency: "EUR",
      amount: 1.0,
    },
  };
  // Create transaction request account.
  await create<API.Transaction>(
    clientConfig,
    Transaction
  )(CreateTransactionRequestAccount)(
    "bankId",
    "accountId",
    "viewId"
  )(body);
})();

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.366latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.366
1.0.351
1.0.341
1.0.331
1.0.321
1.0.311
1.0.301
1.0.291
1.0.281
1.0.271
1.0.261
1.0.251
1.0.241
1.0.232
1.0.221
1.0.211
1.0.201
1.0.191
1.0.181
1.0.171
1.0.162
1.0.151
1.0.141
1.0.131
1.0.121
1.0.111
1.0.101
1.0.91
1.0.81
1.0.71
1.0.61
1.0.51
1.0.41
1.0.31
1.0.21
1.0.11

Package Sidebar

Install

npm i obp-typescript

Weekly Downloads

43

Version

1.0.36

License

Apache-2.0

Unpacked Size

94.4 kB

Total Files

27

Last publish

Collaborators

  • tesobe.mark