starkbank
Version:
SDK to facilitate Node integrations with Stark Bank
96 lines (88 loc) • 4.86 kB
TypeScript
declare module 'starkbank' {
export class VerifiedTransfer {
/**
*
* VerifiedTransfer object
*
* @description When you initialize a VerifiedTransfer, the entity will not be automatically
* created in the Stark Bank API. The 'create' function sends the objects
* to the Stark Bank API and returns the list of created objects.
*
* Parameters (required):
* @param amount [integer]: transfer value in cents. ex: 1234 (= R$ 12.34)
* @param accountId [string]: receiver's VerifiedAccount ID. ex: '5656565656565656'
*
* Parameters (optional):
* @param accountType [string, default 'checking']: receiver bank account type. This parameter only has effect on Pix Transfers. ex: 'checking', 'savings', 'salary' or 'payment'
* @param externalId [string, default null]: url safe string that must be unique among all your transfers. Duplicated externalIds will cause failures. ex: 'my-internal-id-123456'
* @param scheduled [string, default now]: date or datetime when the transfer will be processed. May be pushed to next business day if necessary. ex: '2020-11-12T00:14:22.806+00:00' or '2020-11-30'
* @param description [string, default null]: optional description to override default description to be shown in the bank statement. ex: 'Payment for service #1234'
* @param displayDescription [string, default null]: optional description to be shown in the receiver bank interface. ex: 'Payment for service #1234'
* @param tags [list of strings, default []]: list of strings for reference when searching for verified transfers. ex: ['employees', 'monthly']
* @param rules [list of Transfer.Rules, default []]: list of Transfer.Rule objects for modifying transfer behaviour. ex: [Transfer.Rule(key="resendingLimit", value=5)]
*
* Attributes (return-only):
* @param id [string]: unique id returned when the VerifiedTransfer is created. ex: '5656565656565656'
* @param fee [integer]: fee charged when the transfer is created. ex: 200 (= R$ 2.00)
* @param status [string]: current verified transfer status. ex: 'created', 'processing', 'success' or 'failed'
* @param transactionIds [list of strings]: ledger transaction ids linked to this transfer (if there are two, second is the chargeback). ex: ['19827356981273']
* @param metadata [dictionary object]: dictionary object used to store additional information about the VerifiedTransfer object.
* @param created [string]: creation datetime for the verified transfer. ex: '2020-03-10 10:30:00.000'
* @param updated [string]: update datetime for the verified transfer. ex: '2020-03-10 10:30:00.000'
*
*/
amount: number
accountId: string
accountType: string | null
externalId: string | null
scheduled: string | null
description: string | null
displayDescription: string | null
tags: string[] | null
rules: transfer.Rule[] | null
readonly id: string
readonly fee: number
readonly status: string
readonly transactionIds: string[]
readonly metadata: {}
readonly created: string
readonly updated: string
constructor(params: {
amount: number,
accountId: string,
accountType?: string | null,
externalId?: string | null,
scheduled?: string | null,
description?: string | null,
displayDescription?: string | null,
tags?: string[] | null,
rules?: transfer.Rule[] | null,
id?: string | null,
fee?: number | null,
status?: string | null,
transactionIds?: string[] | null,
metadata?: {} | null,
created?: string | null,
updated?: string | null,
})
}
export namespace verifiedTransfer {
/**
*
* Create VerifiedTransfers
*
* @description Send a list of VerifiedTransfer objects for creation in the Stark Bank API
*
* Parameters (required):
* @param verifiedTransfers [list of VerifiedTransfer objects]: list of VerifiedTransfer objects to be created in the API
*
* Parameters (optional):
* @param user [Organization/Project object]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns list of VerifiedTransfer objects with updated attributes
*
*/
export function create(verifiedTransfers: VerifiedTransfer[], params?: { user?: Project | Organization | null }): Promise<VerifiedTransfer[]>;
}
}