Home Reference Source
import TransferTokenBuilder from 'token-io/src/main/TransferTokenBuilder.js'
public class | source

TransferTokenBuilder

Constructor Summary

Public Constructor
public

constructor(client: Object, member: Object, lifetimeAmount: number, currency: string)

Represents a Builder for a transfer token.

Member Summary

Private Members
private
private

_client: *

private

_member: *

private

_payload: {"version": *, "refId": *, "transfer": *}

private

Method Summary

Public Methods
public

Adds an attachment to the token.

public

addAttachmentData(ownerId: string, type: string, name: string, data: Buffer): TransferTokenBuilder

Adds an attachment to the token, with the data.

public

Add a transfer destination to the token.

public

Builds the token payload.

public

async execute(): Promise

Executes the createToken API call to the server, and returns a promise with the token.

public

Sets the source accountId of the token.

public

Sets acting as on the token.

public

Sets the maximum charge amount of the token.

public

Sets the source custom authorization.

public

Sets the description of the token.

public

Sets the effective date of the token.

public

Sets the endorse token timeout.

public

Sets the expiration date of the token.

public

Sets the fromId of the token

public

Sets the pricing (fees/fx) of the token.

public

Sets the purpose of payment of the token.

public

Sets the flag indicating whether a receipt is requested.

public
this method was deprecated. - use setToAlias

Sets the alias of the redeemer.

public
this method was deprecated. - use setToMemberId

Sets the memberId of the redeemer.

public

Sets the refId on the token.

public

Sets the alias of the payee.

public

Sets the memberId of the payee.

public

Sets the token request ID.

Public Constructors

public constructor(client: Object, member: Object, lifetimeAmount: number, currency: string) source

Represents a Builder for a transfer token.

Params:

NameTypeAttributeDescription
client Object

The http client to use for the API call

member Object

member performing the request

lifetimeAmount number

the lifetime amount of the token

currency string

currency of the token

Private Members

private _blobPayloads: *[] source

private _client: * source

private _member: * source

private _payload: {"version": *, "refId": *, "transfer": *} source

private _tokenRequestId: string source

Public Methods

public addAttachment(attachment: Object): TransferTokenBuilder source

Adds an attachment to the token.

Params:

NameTypeAttributeDescription
attachment Object

attachment (metadata).

Return:

TransferTokenBuilder

builder - returns back the builder object

public addAttachmentData(ownerId: string, type: string, name: string, data: Buffer): TransferTokenBuilder source

Adds an attachment to the token, with the data.

Params:

NameTypeAttributeDescription
ownerId string

memberId of the owner of the file

type string

MIME type of the file

name string

name of the file

data Buffer

byte array of the data of the file

Return:

TransferTokenBuilder

builder - returns back the builder object

public addDestination(endpoint: object): TransferTokenBuilder source

Add a transfer destination to the token.

Params:

NameTypeAttributeDescription
endpoint object

transfer endpoint

Return:

TransferTokenBuilder

builder - returns back the builder object

public build(): Object source

Builds the token payload.

Return:

Object

tokenPayload - token payload

public async execute(): Promise source

Executes the createToken API call to the server, and returns a promise with the token.

Return:

Promise

token - the created and filled transfer token

public setAccountId(accountId: string): TransferTokenBuilder source

Sets the source accountId of the token.

Params:

NameTypeAttributeDescription
accountId string

source accountId

Return:

TransferTokenBuilder

builder - returns back the builder object

public setActingAs(actingAs: Object): TransferTokenBuilder source

Sets acting as on the token.

Params:

NameTypeAttributeDescription
actingAs Object

entity the redeemer is acting on behalf of

Return:

TransferTokenBuilder

builder - returns back the builder object

public setChargeAmount(chargeAmount: number): TransferTokenBuilder source

Sets the maximum charge amount of the token.

Params:

NameTypeAttributeDescription
chargeAmount number

maximum charge amount.

Return:

TransferTokenBuilder

builder - returns back the builder object

public setCustomAuthorization(bankId: string, authorization: string): TransferTokenBuilder source

Sets the source custom authorization.

Params:

NameTypeAttributeDescription
bankId string

source bank id

authorization string

source custom authorization

Return:

TransferTokenBuilder

builder - returns back the builder object

public setDescription(description: string): TransferTokenBuilder source

Sets the description of the token.

Params:

NameTypeAttributeDescription
description string

description

Return:

TransferTokenBuilder

builder - returns back the builder object

public setEffectiveAtMs(effectiveAtMs: number): TransferTokenBuilder source

Sets the effective date of the token.

Params:

NameTypeAttributeDescription
effectiveAtMs number

effective date in milliseconds

Return:

TransferTokenBuilder

builder - returns back the builder object

public setEndorseUntilMs(endorseUntilMs: number): TransferTokenBuilder source

Sets the endorse token timeout.

Params:

NameTypeAttributeDescription
endorseUntilMs number

time at which no more endorsements can be made

Return:

TransferTokenBuilder

builder - returns back the builder object

public setExpiresAtMs(expiresAtMs: number): TransferTokenBuilder source

Sets the expiration date of the token.

Params:

NameTypeAttributeDescription
expiresAtMs number

expiration date in milliseconds

Return:

TransferTokenBuilder

builder - returns back the builder object

public setFromId(memberId: string): TransferTokenBuilder source

Sets the fromId of the token

Params:

NameTypeAttributeDescription
memberId string

from memberId

Return:

TransferTokenBuilder

builder - returns back the builder object

public setPricing(pricing: Object): TransferTokenBuilder source

Sets the pricing (fees/fx) of the token.

Params:

NameTypeAttributeDescription
pricing Object

pricing of the token

Return:

TransferTokenBuilder

builder - returns back the builder object

public setPurposeOfPayment(purposeOfPayment: string): TransferTokenBuilder source

Sets the purpose of payment of the token.

Params:

NameTypeAttributeDescription
purposeOfPayment string

purpose of payment

Return:

TransferTokenBuilder

builder - returns back the builder object

public setReceiptRequested(receiptRequested: boolean): TransferTokenBuilder source

Sets the flag indicating whether a receipt is requested.

Params:

NameTypeAttributeDescription
receiptRequested boolean

receipt requested flag

Return:

TransferTokenBuilder

builder

public setRedeemerAlias(redeemerAlias: Object): TransferTokenBuilder source

this method was deprecated. - use setToAlias

Sets the alias of the redeemer.

Params:

NameTypeAttributeDescription
redeemerAlias Object

alias of the redeemer

Return:

TransferTokenBuilder

builder - returns back the builder object

public setRedeemerMemberId(redeemerMemberId: Object): TransferTokenBuilder source

this method was deprecated. - use setToMemberId

Sets the memberId of the redeemer.

Params:

NameTypeAttributeDescription
redeemerMemberId Object

memberId of the redeemer

Return:

TransferTokenBuilder

builder - returns back the builder object

public setRefId(refId: string): TransferTokenBuilder source

Sets the refId on the token.

Params:

NameTypeAttributeDescription
refId string

client generated reference id, at most 18 characters long.

Return:

TransferTokenBuilder

builder - returns back the builder object

public setToAlias(toAlias: Object): TransferTokenBuilder source

Sets the alias of the payee.

Params:

NameTypeAttributeDescription
toAlias Object

alias of the payee

Return:

TransferTokenBuilder

builder - returns back the builder object

public setToMemberId(toMemberId: string): TransferTokenBuilder source

Sets the memberId of the payee.

Params:

NameTypeAttributeDescription
toMemberId string

memberId of the payee

Return:

TransferTokenBuilder

builder - returns back the builder object

public setTokenRequestId(tokenRequestId: string): TransferTokenBuilder source

Sets the token request ID.

Params:

NameTypeAttributeDescription
tokenRequestId string

token request id

Return:

TransferTokenBuilder

builder - returns back the builder object