Sudo Platform Virtual Cards client API

All methods should be expected to be able to throw the following errors defined in @sudoplatform/sudo-common:

Throws

NotSignedInError User not signed in. Sign in before performing the operation.

Throws

AccountLockedError Account has been locked. Contact support.

Throws

ServiceError Transient error at the service. Try the operation again

interface SudoVirtualCardsClient {
    cancelFundingSource(id): Promise<FundingSource>;
    cancelProvisionalFundingSource(id): Promise<ProvisionalFundingSource>;
    cancelVirtualCard(input): Promise<APIResult<VirtualCard, VirtualCardSealedAttributes>>;
    completeFundingSource(input): Promise<FundingSource>;
    createKeysIfAbsent(): Promise<CreateKeysIfAbsentResult>;
    exportKeys(): Promise<ArrayBuffer>;
    getFundingSource(input): Promise<undefined | FundingSource>;
    getFundingSourceClientConfiguration(): Promise<FundingSourceClientConfiguration[]>;
    getProvisionalCard(input): Promise<undefined | ProvisionalVirtualCard>;
    getTransaction(input): Promise<undefined | Transaction>;
    getVirtualCard(input): Promise<undefined | VirtualCard>;
    getVirtualCardsConfig(): Promise<VirtualCardsConfig>;
    importKeys(archiveData): Promise<void>;
    listFundingSources(input?): Promise<ListOutput<FundingSource>>;
    listProvisionalCards(input?): Promise<ListProvisionalCardsResults>;
    listProvisionalFundingSources(input): Promise<ListOutput<ProvisionalFundingSource>>;
    listTransactions(input): Promise<ListTransactionsResults>;
    listTransactionsByCardId(input): Promise<ListTransactionsResults>;
    listTransactionsByCardIdAndType(input): Promise<ListTransactionsResults>;
    listVirtualCards(input?): Promise<ListVirtualCardsResults>;
    provisionVirtualCard(input): Promise<ProvisionalVirtualCard>;
    refreshFundingSource(input): Promise<FundingSource>;
    reset(): Promise<void>;
    reviewUnfundedFundingSource(id): Promise<FundingSource>;
    sandboxGetPlaidData(input): Promise<SandboxPlaidData>;
    sandboxSetFundingSourceToRequireRefresh(input): Promise<FundingSource>;
    setupFundingSource(input): Promise<ProvisionalFundingSource>;
    subscribeToFundingSourceChanges(id, subscriber): Promise<void>;
    unsubscribeFromFundingSourceChanges(id): void;
    updateVirtualCard(input): Promise<APIResult<VirtualCard, VirtualCardSealedAttributes>>;
}

Implemented by

Methods

  • Cancel a single funding source identified by id.

    Parameters

    • id: string

      The identifier of the funding source to cancel.

    Returns Promise<FundingSource>

    The funding source that was cancelled.

    Throws

    FundingSourceNotFoundError No funding source matching the specified ID could be found.

  • Cancel a single provisional funding source identified by id.

    Parameters

    • id: string

      The identifier of the provisional funding source to cancel.

    Returns Promise<ProvisionalFundingSource>

    The provisional funding source that was cancelled and is in a failed state.

    Throws

    FundingSourceNotFoundError No provisional funding source matching the specified ID could be found.

  • Create key pair and secret key for use by the Virtual Cards Client if they have not already been created.

    The key pair is used to register a public key with the service for the encryption of virtual card and transaction details.

    The secret key is used for client side encryption of user specific card metadata.

    Returns Promise<CreateKeysIfAbsentResult>

  • Export the cryptographic keys to a key archive.

    Returns Promise<ArrayBuffer>

    Key archive data.

  • Get a funding source identified by id.

    Parameters

    Returns Promise<undefined | FundingSource>

    The funding source identified by id or undefined if the funding source cannot be found.

    Throws

    FundingSourceNotFoundError No funding source matching the specified ID could be found.

  • Returns Promise<FundingSourceClientConfiguration[]>

    The configuration of the client funding source data.

    Deprecated

    Use getVirtualCardsConfig instead to retrieve the FundingSourceClientConfiguration.

    Get the funding source client configuration.

  • Get a provisional card.

    Parameters

    Returns Promise<undefined | ProvisionalVirtualCard>

    The card that is being queried, or undefined if not found.

  • Get a transaction.

    Parameters

    Returns Promise<undefined | Transaction>

    The transaction that is being queried, or undefined if not found.

  • Get a virtual card.

    Parameters

    Returns Promise<undefined | VirtualCard>

    The card that is being queried, or undefined if not found.

  • Get the configuration data for the virtual cards service.

    Returns Promise<VirtualCardsConfig>

    The configuration data for the virtual cards service.

  • Imports cryptographic keys from a key archive.

    Parameters

    • archiveData: ArrayBuffer

      Key archive data to import the keys from.

    Returns Promise<void>

  • Get a list of all created funding sources for the signed in user.

    Parameters

    Returns Promise<ListOutput<FundingSource>>

    An array of funding sources or an empty array if no matching funding sources can be found.

  • Get a list of provisional funding sources. If no provisional funding sources can be found, an empty list will be returned.

    Parameters

    Returns Promise<ListOutput<ProvisionalFundingSource>>

  • Provision a virtual card.

    Parameters

    Returns Promise<ProvisionalVirtualCard>

    The card that is being provisioned. Please poll the card via the list methods to access the card.

    Throws

    FundingSourceNotFoundError No funding source matching the specified ID could be found.

    Throws

    FundingSourceNotActiveError The funding source matching the specified ID is not active.

    Throws

    InsufficientEntitlementsError User has insufficient entitlements to setup a new virtual card.

    Throws

    VelocityExceededError Configured maximum rate of attempts to add a virtual card has been exceeded. Wait before retrying.

  • Removes any cached data maintained by this client.

    Returns Promise<void>

  • Request a review of an unfunded funding source, identified by id. Note that reviewing a funding source which is not unfunded will be a no-op but is not an error.

    Parameters

    • id: string

      The identifier of the funding source to review.

    Returns Promise<FundingSource>

    The funding source that was reviewed.

    Throws

    FundingSourceNotFoundError No funding source matching the specified ID could be found.

  • Sandbox API to obtain data normally returned by full Plaid Link flow. Useful for testing ahead of full Plaid Link integration during application development.

    Parameters

    Returns Promise<SandboxPlaidData>

    Sandbox Plaid data for provisioning new funding source at requested institution and user

  • Initiate provisioning of a new funding source.

    Parameters

    Returns Promise<ProvisionalFundingSource>

    The provisional funding source.

    Throws

    InsufficientEntitlementsError User has insufficient entitlements to setup a new funding source.

    Throws

    VelocityExceededError Configured maximum rate of attempts to add a funding source has been exceeded or too many failed attempts have recently been made. Wait before retrying.

  • Subscribe to changes to funding sources

    Parameters

    • id: string

      unique identifier to differentiate subscriptions; note that specifying a duplicate subscription id will replace the previous subscription.

    • subscriber: FundingSourceChangeSubscriber

      implementation of callback to be invoked when funding source change occurs

    Returns Promise<void>

  • Unsubscribe from changes to funding sources

    Parameters

    • id: string

      unique identifier to differentiate subscription

    Returns void