UNPKG

privacy.com

Version:

Wrapper for the Privacy.com API using Axios and TypeScript

96 lines (95 loc) 5.13 kB
import { Endpoint, Response } from "./endpoints"; import { HostedCardUiParams, HostedCardUiResponse } from "./endpoints/get/HostedCardUi"; import { ListCardsParams, ListCardsResponse } from "./endpoints/get/ListCards"; import { ListFundingAccountsParams, ListFundingAccountsResponse } from "./endpoints/get/ListFundingAccounts"; import { ListTransactionsParams, ListTransactionsResponse } from "./endpoints/get/ListTransactions"; import { AddBankParams, AddBankResponse } from "./endpoints/post/AddBank"; import { CreateCardParams, CreateCardResponse } from "./endpoints/post/CreateCard"; import { SimulateAuthorizationParams, SimulateAuthorizationResponse } from "./endpoints/post/simulations/Authorization"; import { SimulateClearingParams, SimulateClearingResponse } from "./endpoints/post/simulations/Clearing"; import { SimulateReturnParams, SimulateReturnResponse } from "./endpoints/post/simulations/Return"; import { SimulateVoidParams, SimulateVoidResponse } from "./endpoints/post/simulations/Void"; import { UpdateCardParams, UpdateCardResponse } from "./endpoints/put/UpdateCard"; export { Card, EmbedRequest, Event, Merchant, FundingAccount, Transaction } from "./objects"; export { TokenData } from "./endpoints/post"; export { HostedCardUiResponse, ListCardsResponse, ListFundingAccountsResponse, ListTransactionsResponse, UpdateCardResponse, CreateCardResponse, AddBankResponse, SimulateAuthorizationResponse, SimulateVoidResponse, SimulateClearingResponse, SimulateReturnResponse, }; export { HostedCardUiParams, ListCardsParams, ListFundingAccountsParams, ListTransactionsParams, UpdateCardParams, CreateCardParams, AddBankParams, SimulateAuthorizationParams, SimulateVoidParams, SimulateClearingParams, SimulateReturnParams, }; declare class PrivacyApi { apiKey: string; sandbox: boolean; version: string; baseUrl: string; headers: object; /** * * @param apiKey API Key to use for requests * @param sandbox Execute requests in sandbox mode or not @defaultValue true * @param version API version to use for requests @defaultValue "v1" */ constructor(apiKey: string, sandbox?: boolean, version?: string); execute(request: Endpoint): Promise<Response<any>>; /** * Create a new card for the privacy account */ createCard(params: CreateCardParams): Promise<CreateCardResponse>; /** * Adds a bank account as a funding source using routing and account numbers. Returns a FundingAccount object containing the bank information. */ addBank(params: AddBankParams): Promise<AddBankResponse>; /** * List cards associated with the privacy account */ listCards(params?: ListCardsParams): Promise<ListCardsResponse>; /** * List all the funding accounts associated with the privacy account */ listFundingAccounts(params?: ListFundingAccountsParams): Promise<ListFundingAccountsResponse>; /** * List transactions associated with the privacy account or a specific card */ listTransactions(params?: ListTransactionsParams): Promise<ListTransactionsResponse>; /** * Get iframe data to display card details * @remarks The iframe body will provide consistent markup of the following form. * It is up to the API client to provide css styles for these elements in the EmbedRequest. * ```html * <div id="card"> * <div id="pan">{PAN}</div> * <div id="expiry"> * <span id="month">{expMonth}</span> * <span id="separator">/</span> * <span id="year">{expYear}</span> * </div> * <div id="cvv">{CVV}</div> * </div> * ``` */ hostedCardUi(params: HostedCardUiParams): Promise<HostedCardUiResponse>; /** * Update a card by its token for the privacy account */ updateCard(params: UpdateCardParams): Promise<UpdateCardResponse>; /** * Simulates an authorization request from the payment network as if it came from a merchant acquirer. * @remarks The API sends an event for all approvals. Decline events are available with API Issuing accounts and cannot be simulated. * @link https://developer.privacy.com/docs#transaction-webhooks */ simulateAuthorization(params: SimulateAuthorizationParams): Promise<SimulateAuthorizationResponse>; /** * Voids an existing, uncleared (aka pending) authorization. * @remarks Previous pending authorization is voided */ simulateVoid(params: SimulateVoidParams): Promise<SimulateVoidResponse>; /** * Clears an existing authorization. After this event, the transaction is no longer pending. * @remarks Clearing for an existing, pending authorization */ simulateClearing(params: SimulateClearingParams): Promise<SimulateClearingResponse>; /** * Returns (aka refunds) an amount back to a card. Returns are cleared immediately and do not spend time in a "pending" state. * @remarks Refund — value is pushed onto card */ simulateReturn(params: SimulateReturnParams): Promise<SimulateReturnResponse>; private getBaseUrl; } export { PrivacyApi };