Sudo Platform Virtual Cards client API

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

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

AccountLockedError Account has been locked. Contact support.

ServiceError Transient error at the service. Try the operation again

interface SudoVirtualCardsClient {
    cancelFundingSource(id: string): Promise<FundingSource>;
    cancelProvisionalFundingSource(
        id: string,
    ): Promise<ProvisionalFundingSource>;
    cancelVirtualCard(
        input: CancelVirtualCardInput,
    ): Promise<APIResult<VirtualCard, VirtualCardSealedAttributes>>;
    completeFundingSource(
        input: CompleteFundingSourceInput,
    ): Promise<FundingSource>;
    createKeysIfAbsent(): Promise<CreateKeysIfAbsentResult>;
    exportKeys(): Promise<ArrayBuffer>;
    getFundingSource(
        input: GetFundingSourceInput,
    ): Promise<undefined | FundingSource>;
    getFundingSourceClientConfiguration(): Promise<
        FundingSourceClientConfiguration[],
    >;
    getProvisionalCard(
        input: GetProvisionalCardInput,
    ): Promise<undefined | ProvisionalVirtualCard>;
    getTransaction(
        input: GetTransactionInput,
    ): Promise<undefined | Transaction>;
    getVirtualCard(
        input: GetVirtualCardInput,
    ): Promise<undefined | VirtualCard>;
    getVirtualCardsConfig(): Promise<VirtualCardsConfig>;
    importKeys(archiveData: ArrayBuffer): Promise<void>;
    listFundingSources(
        input?: ListFundingSourcesInput,
    ): Promise<ListOutput<FundingSource>>;
    listProvisionalCards(
        input?: ListProvisionalCardsInput,
    ): Promise<ListProvisionalCardsResults>;
    listProvisionalFundingSources(
        input: ListProvisionalFundingSourcesInput,
    ): Promise<ListOutput<ProvisionalFundingSource>>;
    listTransactions(
        input: ListTransactionsInput,
    ): Promise<ListTransactionsResults>;
    listTransactionsByCardId(
        input: ListTransactionsByCardIdInput,
    ): Promise<ListTransactionsResults>;
    listTransactionsByCardIdAndType(
        input: ListTransactionsByCardIdAndTypeInput,
    ): Promise<ListTransactionsResults>;
    listVirtualCards(
        input?: ListVirtualCardsInput,
    ): Promise<ListVirtualCardsResults>;
    provisionVirtualCard(
        input: ProvisionVirtualCardInput,
    ): Promise<ProvisionalVirtualCard>;
    refreshFundingSource(
        input: RefreshFundingSourceInput,
    ): Promise<FundingSource>;
    reset(): Promise<void>;
    reviewUnfundedFundingSource(id: string): Promise<FundingSource>;
    sandboxGetPlaidData(
        input: SandboxGetPlaidDataInput,
    ): Promise<SandboxPlaidData>;
    sandboxSetFundingSourceToRequireRefresh(
        input: SandboxSetFundingSourceToRequireRefreshInput,
    ): Promise<FundingSource>;
    setupFundingSource(
        input: SetupFundingSourceInput,
    ): Promise<ProvisionalFundingSource>;
    subscribeToFundingSourceChanges(
        id: string,
        subscriber: FundingSourceChangeSubscriber,
    ): Promise<void>;
    unsubscribeFromFundingSourceChanges(id: string): void;
    updateVirtualCard(
        input: UpdateVirtualCardInput,
    ): 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.

    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.

    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.

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

  • Returns Promise<FundingSourceClientConfiguration[]>

    The configuration of the client funding source data.

    Use getVirtualCardsConfig instead to retrieve the FundingSourceClientConfiguration.

    Get the funding source client configuration.

  • 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.

  • 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.

    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.

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

    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