@sudoplatform/sudo-virtual-cards
    Preparing search index...

    Interface SudoVirtualCardsClient

    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<CreditCardFundingSource>;
        cancelProvisionalFundingSource(
            id: string,
        ): Promise<ProvisionalFundingSource>;
        cancelVirtualCard(
            input: CancelVirtualCardInput,
        ): Promise<APIResult<VirtualCard, VirtualCardSealedAttributes>>;
        completeFundingSource(
            input: CompleteFundingSourceInput,
        ): Promise<CreditCardFundingSource>;
        createKeysIfAbsent(): Promise<CreateKeysIfAbsentResult>;
        exportKeys(): Promise<ArrayBuffer>;
        getFundingSource(
            input: GetFundingSourceInput,
        ): Promise<CreditCardFundingSource | undefined>;
        getFundingSourceClientConfiguration(): Promise<
            FundingSourceClientConfiguration[],
        >;
        getProvisionalCard(
            input: GetProvisionalCardInput,
        ): Promise<ProvisionalVirtualCard | undefined>;
        getTransaction(
            input: GetTransactionInput,
        ): Promise<Transaction | undefined>;
        getVirtualCard(
            input: GetVirtualCardInput,
        ): Promise<VirtualCard | undefined>;
        getVirtualCardsConfig(): Promise<VirtualCardsConfig>;
        importKeys(archiveData: ArrayBuffer): Promise<void>;
        listFundingSources(
            input?: ListFundingSourcesInput,
        ): Promise<ListOutput<CreditCardFundingSource>>;
        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>;
        reset(): Promise<void>;
        setSignInCallback(callback?: SudoPlatformSignInCallback): void;
        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

    Index

    Methods

    • Cancel a single funding source identified by id.

      Parameters

      • id: string

        The identifier of the funding source to cancel.

      Returns Promise<CreditCardFundingSource>

      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>

    • Returns Promise<ArrayBuffer>

    • 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<Transaction | undefined>

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

    • Get a virtual card.

      Parameters

      Returns Promise<VirtualCard | undefined>

      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<CreditCardFundingSource>>

      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>

    • Sets an optional callback to handle sign-in when operations are attempted while not signed in.

      When set, all operations (exception subscriptions and initialization/reset) will check sign-in status before performing their normal behavior. If the client is not signed in, the callback will be invoked to allow the host app to perform sign-in. Once the callback completes, then the client will attempt the original operation that triggered the callback. If the callback throws an error, then the error will be propagated to the caller and the original operation will not be attempted. To clear the callback, call this method with no arguments or undefined.

      Parameters

      • Optionalcallback: SudoPlatformSignInCallback

      Returns void

    • 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