npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

alpha-dapi

v0.1.8

Published

##Introduction

Readme

Alpha-DaPi

##Introduction

The alpha-dapi is a NestJS wrapper for @dapi-co/dapi-node (https://www.npmjs.com/package/@dapi-co/dapi-node) library that runs as part of your backend and handles communication between your backend and the Dapi API (https://api.dapi.co).

Usage

import { Module } from '@nestjs/common';
import { DapiModule } from 'alpha-dapi';

@Module({
  imports: [
    DapiModule.registerAsync({
      useFactory: () => {
        return {
          appSecret: '',
          ddToken: '', // optional
        };
      },
    }),
    DapiModule.register({
      appSecret: '',
      ddToken: '', // optional
    }),
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}

Now you can inject services like following:

import { Inject, Injectable } from '@nestjs/common';
import {
  DapiDataService,
  DapiPaymentService,
  DapiService,
  DapiConstants,
} from 'alpha-dapi';

@Injectable()
export class AppService {
  constructor(
    @Inject(DapiConstants.DAPI_PAYMENT_SERVICE_INSTANCE_TOKEN)
    private readonly dapiPaymentService: DapiPaymentService,
    @Inject(DapiConstants.DAPI_DATA_SERVICE_INSTANCE_TOKEN)
    private readonly dapiDataService: DapiDataService,
    @Inject(DapiConstants.DAPI_CORE_SERVICE_INSTANCE_TOKEN)
    private readonly dapiService: DapiService,
  ) {}
}

Note: Dapi splits its services through three different categories

Dapi APIs Types:

1- Dapi Core/Authentication APIs

2- Dapi Payment APIs

3- Dapi Data APIs

Let's dive into each part on its own:


Core/Authentication APIs

1- Exchanging token

2- De-link User

3- Handle SDK requests

4- Verify WebHook Signature


  • To exchange token
/**
*
* @param exchangeTokenDto
* @returns Promise<IExchangeTokenResponse>
* @description: Method is used to obtain user's permanent access token by exchanging it with access code received during the user authentication.
*/
exchangeToken(exchangeTokenDto: ExchangeTokenDto): Promise<IExchangeTokenResponse>;

class ExchangeTokenDto {
  /*
    Where accessCode & connectionID are obtained after logging in to DaPi dashboard via Connector layer
    See the following for better understanding
    https://dapi-api.readme.io/docs/quickstart-4
  */
  accessCode: string;
  connectionID: string;
}
  • To de-link user
/***
*
* @param deLinkUserDto
* @description: Method is used to disconnect a user in your application from the Dapi by invalidating their access token.
* @returns: Promise<void>
*/
deLinkUser(deLinkUserDto: DeLinkUserDto): Promise<void>;

// DTO
class DeLinkUserDto {
  userSecret: string;
}
  • to get operation status
/***
*
* @param getOperationStatusDto
* @description:
* The endpoint can be used to retrieve current status of any operation (not just payment) performed on the API.
* The endpoint receives operationID of the request performed earlier and returns its status.
* Operation can have one of the following statuses:
*  - done
*  - initialized
*  - user_input_required
* - failed
*
* @returns: Promise<IJobResumeResponse>
*/
getOperationStatus(getOperationStatusDto: GetOperationStatusDto): Promise<IJobResumeResponse>;


class GetOperationStatusDto {
  operationID: string;
}
  • to get account metadata
/***
*
* @param getAccountMetaDataDto
* @description:
* Method is used to obtain configuration information of users bank.
* If using Create Transfer this information is required to identify flow and processing logic of the transaction.
* Configuration returned by the endpoint includes:
* - 'beneficiaryCoolDownPeriod' - How much time must pass before being able to use newly registered beneficiary
* - 'isCreateBeneficiaryEndpointRequired' - Whether bank required registration of the beneficiary to perform a transaction
* - 'transferBounds' - Transaction limits supported by the bank
* - 'transactionRange' - Date range of transactions available for banks users
*
*
* @returns: Promise<IGetAccountsMetadataResponse>
*/
getAccountMetaData(getAccountMetaDataDto: GetAccountMetaDataDto): Promise<IGetAccountsMetadataResponse>;


class GetAccountMetaDataDto {
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to handle sdk requests:
/**
*
* @param sdkDapiRequestsDto
* @returns: Promise<void>
*/
handleSDKDapiRequests(sdkDapiRequestsDto: SdkDapiRequestsDto): Promise<void>;

class SdkDapiRequestsDto {
  body: any;
  headers: any;
}
  • to verify web hook signature
/**
*
* @param verifyWebHookSignatureDto
* @returns: boolean
*/
verifyWebhookSignature(verifyWebHookSignatureDto: VerifyWebHookSignatureDto): boolean;

class VerifyWebHookSignatureDto {
  body: any;
  headers: any;
  webhookSecret: string;
}

Payment APIs

1- Transfer Auto Flow

2- Get Beneficiaries

3- Create Beneficiary

4- Create Transfer


  • to use transfer auto flow
/**
* @param: transferAutoFlowDto
* @description: Method is used to initiate a new payment from one account to another account.
* It is identical to Create Transfer endpoint but in this case all the bank required validations and custom processes are handled on the API side.
* The result of successfully performed operation is a new transaction registered on users bank account.
* */
transferAutoFlow(transferAutoFlowDto: TransferAutoFlowDto): Promise<ICreateTransferResponse>;
class TransferAutoFlowDto {
  transfer: ITransferAutoflow;
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to get beneficiaries

/***
*
* @param getBeneficiariesDto
* @description: Method is used to retrieve list of all the beneficiaries available for the user within a financial institution.
* @note:
* Please note that this endpoint is only required if you use Create Transfer instead of AutoFlow endpoint and sender bank requires beneficiary.
* If you are still using Create Transfer endpoint, we recommend you switch to Auto Flow
*/
getBeneficiaries(getBeneficiariesDto: GetBeneficiariesDto): Promise<IGetBeneficiariesResponse>;

class GetBeneficiariesDto {
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to create beneficiary

/***
*
* @param createBeneficiaryDto
* @description: Method is used to add a new beneficiary for the user.
* For some of the banks this is required to transfer funds from the user's account to the beneficiary's.
*
* @note:
* Please note that this endpoint is only required if you use Create Transfer instead of AutoFlow endpoint and sender bank requires beneficiary.
* If you are still using Create Transfer endpoint, we recommend you switch to Auto Flow
*/
createBeneficiary(createBeneficiaryDto: CreateBeneficiaryDto): Promise<IBaseResponse>;

class CreateBeneficiaryDto {
  beneficiary: ICBBeneficiary;
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to create transfer
/***
*
* @param createTransferDto
* @description: Method is used to initiate a new payment from one account to another account.
* @note: We suggest you use Transfer Auto Flow endpoint to initiate a payment.
* Auto Flow abstracts all the validations and processing logic, required to initiate a transaction using CreateTransfer endpoint.
*/
createTransfer(createTransferDto: CreateTransferDto): Promise<ICreateTransferResponse>;

class CreateTransferDto {
  transfer: ITransfer;
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}

Data APIs

1- getIdentity

2- get accounts

3- get account balance

4- get account transactions

5- get cards

6- get card balance

7- get card transactions


  • To retrieve personal data

/***
*
* @param getIdentityDto
* @description: Method is used to retrieve personal details about the user.
*
* It can be used to retrieve following information:
*  User Address
*  Contact Information
*  - Telephone Numbers
*  - Email Address
*  Legal Documentation (Proof Of User Identity)
*  User Details
*  - Nationality
*  - Date of Birth
*  - Full Name
*
*
*  @note: Information returned differs for each bank.
*  The document describes all the information that can possibly be returned by the service, but depending on the bank, not all of this data may be provided.
*
*  @returns: Promise<IGetIdentityResponse>
*/
async getIdentity(getIdentityDto: GetIdentityDto): Promise<IGetIdentityResponse>

export class GetIdentityDto {
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to get accounts
/***
*
* @param: getAccountsDto
* @description: Method is used to retrieve list of all the bank accounts registered on the user.
* The list will contain all types of bank accounts, including:
*  - Savings
*  - Credit
*  - Current....
*
*  @returns: Promise<IGetAccountsResponse>
*/
getAccounts(getAccountsDto: GetAccountsDto): Promise<IGetAccountsResponse>;


class GetAccountsDto {
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to get account balance
/***
* @param getAccountBalanceDto
* @description: Method is used to retrieve balance on specific bank account of the user
* @returns: Promise<IGetAccountBalanceResponse>
*/
getAccountBalance(getAccountBalanceDto: GetAccountBalanceDto): Promise<IGetAccountBalanceResponse>;



export class GetAccountBalanceDto {
  accessToken: string;
  userSecret: string;
  accountID: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}

  • to get account transactions


/***
*
* @param: getAccountTransactionsDto
* @description: Method is used to retrieve transactions that user has performed over a specific period of time from their bank account.
* The transaction list is unfiltered,
* meaning the response will contain all the transactions performed by the user (not just the transactions performed using your app).
* Date range of the transactions that can be retrieved varies for each bank. The range supported by the users bank is shown in the response parameter transactionRange of Get Accounts Metadata endpoint.
* @returns: Promise<IGetTransactionsResponse>
*/
getAccountTransactions(getAccountTransactionsDto: GetAccountTransactionsDto): Promise<IGetTransactionsResponse>;


export class GetAccountTransactionsDto {
  accessToken: string;
  userSecret: string;
  accountID: string;
  fromDate: Date;
  toDate: Date;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to get cards
/***
* @param: getCardsDto
* @description: Method is used to retrieve list of all the credit cards registered on the user. The list will contain all credit cards
* @returns: Promise<IGetCardsResponse>
*/
getCards(getCardsDto: GetCardsDto): Promise<IGetCardsResponse>;


class GetCardsDto {
  accessToken: string;
  userSecret: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}

to get card balance

/***
*
* @param getCardBalanceDto
* @description: Method is used to retrieve balance on specific bank account of the user
* @returns: Promise<IGetCardBalanceResponse>
*/
getCardBalance(getCardBalanceDto: GetCardBalanceDto): Promise<IGetCardBalanceResponse>;


class GetCardBalanceDto {
  accessToken: string;
  userSecret: string;
  cardID: string;
  operationID?: string;
  userInputs?: IUserInputs[];
}
  • to get card transactions

/***
*
* @param: getCardTransactionsDto
* @description: Method is used to retrieve credit card transactions that user has performed over a specific period of time from their bank account.
* The transaction list is unfiltered, meaning the response will contain all the transactions performed
* by the user (not just the transactions performed using your app).
* Date range of the transactions that can be retrieved varies for each bank.
* The range supported by the users bank is shown in the response parameter transactionRange of Get Accounts Metadata endpoint.
*
* @returns: Promise<IGetTransactionsResponse>
*/
getCardTransactions(getCardTransactionsDto: GetCardTransactionsDto): Promise<IGetTransactionsResponse>;


class GetCardTransactionsDto {
  accessToken: string;
  userSecret: string;
  cardID: string;
  fromDate: Date;
  toDate: Date;
  operationID?: string;
  userInputs?: IUserInputs[];
}

Reference

IBaseResponse