SudoVirtualCardsClient

Interface encapsulating a library for interacting with the Sudo Platform Virtual Cards service.

Samples

import android.content.Context
import com.sudoplatform.sudouser.SudoUserClient
import com.sudoplatform.sudovirtualcards.BaseTests
import com.sudoplatform.sudovirtualcards.SudoVirtualCardsClient
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
import org.robolectric.RobolectricTestRunner

fun main() { 
   //sampleStart 
   val virtualCardsClient = SudoVirtualCardsClient.builder()
    .setContext(context)
    .setSudoUserClient(sudoUserClient)
    .build() 
   //sampleEnd
}

Types

Link copied to clipboard
class Builder

Builder used to construct the SudoVirtualCardsClient.

Link copied to clipboard
object Companion
Link copied to clipboard

Defines the exceptions for the funding source based methods.

Link copied to clipboard
data class FundingSourceInteractionData(val provisioningData: String)

Returned with a FundingSourceRequiresUserInteraction error to provide feedback to the client.

Link copied to clipboard

Defines the exceptions for the virtual payment transaction based methods.

Link copied to clipboard

Defines the exceptions for the virtual card cryptographic keys based methods.

Link copied to clipboard

Defines the exceptions for the virtual payment card based methods.

Functions

Link copied to clipboard
abstract suspend fun cancelFundingSource(id: String): FundingSource

Cancel a FundingSource using the id parameter.

Link copied to clipboard

Cancel a ProvisionalFundingSource using the id parameter.

Link copied to clipboard

Cancel a VirtualCard using the id parameter.

Link copied to clipboard
abstract fun close()
Link copied to clipboard

Complete the creation of a FundingSource.

Link copied to clipboard

Create key pair and secret key for use by the virtual cards client if they have not already been created.

Link copied to clipboard
abstract suspend fun exportKeys(): ByteArray

Export the cryptographic keys to a key archive.

Link copied to clipboard
abstract suspend fun getFundingSource(id: String): FundingSource?

Get a FundingSource using the id parameter.

Link copied to clipboard

Get a ProvisionalVirtualCard using the id parameter.

Link copied to clipboard
abstract suspend fun getTransaction(id: String): Transaction?

Get a Transaction using the id parameter.

Link copied to clipboard
abstract suspend fun getVirtualCard(id: String): VirtualCard?

Get a VirtualCard using the id parameter.

Link copied to clipboard
abstract suspend fun getVirtualCardsConfig(): VirtualCardsConfig?

Get the current VirtualCardsConfig.

Link copied to clipboard
abstract suspend fun importKeys(archiveData: ByteArray)

Import cryptographic keys from a key archive.

Link copied to clipboard
abstract suspend fun listFundingSources(filter: FundingSourceFilterInput? = null, sortOrder: SortOrder? = null, limit: Int = DEFAULT_FUNDING_SOURCE_LIMIT, nextToken: String? = null): ListOutput<FundingSource>
Link copied to clipboard
abstract suspend fun listProvisionalFundingSources(filter: ProvisionalFundingSourceFilterInput? = null, sortOrder: SortOrder? = null, limit: Int = DEFAULT_FUNDING_SOURCE_LIMIT, nextToken: String? = null): ListOutput<ProvisionalFundingSource>

Get a ListOutput of ProvisionalFundingSources. If no ProvisionalFundingSources can be found, the ListOutput will contain null for the ListOutput.nextToken field and contain an empty ListOutput.items list.

Link copied to clipboard
abstract suspend fun listTransactions(limit: Int = DEFAULT_TRANSACTION_LIMIT, nextToken: String? = null, dateRange: DateRange? = null, sortOrder: SortOrder = SortOrder.DESC): ListAPIResult<Transaction, PartialTransaction>

Get a list of all Transactions across all virtual cards.

Link copied to clipboard
abstract suspend fun listTransactionsByCardId(cardId: String, limit: Int = DEFAULT_TRANSACTION_LIMIT, nextToken: String? = null, dateRange: DateRange? = null, sortOrder: SortOrder = SortOrder.DESC): ListAPIResult<Transaction, PartialTransaction>

Get a list of all Transactions related to a virtual card.

Link copied to clipboard
abstract suspend fun listTransactionsByCardIdAndType(cardId: String, transactionType: TransactionType, limit: Int = DEFAULT_TRANSACTION_LIMIT, nextToken: String? = null): ListAPIResult<Transaction, PartialTransaction>

Get a list of all Transactions for a certain type related to a virtual card.

Link copied to clipboard
abstract suspend fun listVirtualCards(filter: VirtualCardFilterInput? = null, sortOrder: SortOrder? = SortOrder.DESC, limit: Int = DEFAULT_CARD_LIMIT, nextToken: String? = null): ListAPIResult<VirtualCard, PartialVirtualCard>

Get a list of VirtualCards.

Link copied to clipboard
Link copied to clipboard

Refresh a FundingSource with the REFRESH flag set.

Link copied to clipboard
abstract fun reset()

Reset any internal state and cached content.

Link copied to clipboard

Review an unfunded FundingSource using the id parameter.

Link copied to clipboard
abstract suspend fun sandboxGetPlaidData(institutionId: String, plaidUsername: String): SandboxPlaidData

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

Link copied to clipboard
abstract suspend fun sandboxSetFundingSourceToRequireRefresh(fundingSourceId: String): FundingSource

Sandbox API to set a funding source to refresh state to facilitate testing.

Link copied to clipboard
Link copied to clipboard
abstract suspend fun subscribeToFundingSources(id: String, subscriber: FundingSourceSubscriber)

Subscribes to be notified of modified FundingSources. Subscribing multiple times with the same subscriber id will cause the previous subscriber to be unsubscribed.

Link copied to clipboard
suspend fun SudoVirtualCardsClient.subscribeToFundingSources(id: String, onConnectionChange: (status: Subscriber.ConnectionState) -> Unit = {}, onFundingSourceChanged: (fundingSource: FundingSource) -> Unit)

Subscribes to be notified of modified FundingSources.

Link copied to clipboard
abstract suspend fun subscribeToTransactions(id: String, subscriber: TransactionSubscriber)

Subscribes to be notified of new, updated and deleted Transactions. Subscribing multiple times with the same subscriber id will cause the previous subscriber to be unsubscribed.

Link copied to clipboard
suspend fun SudoVirtualCardsClient.subscribeToTransactions(id: String, onConnectionChange: (status: TransactionSubscriber.ConnectionState) -> Unit = {}, onTransactionChange: (transaction: Transaction) -> Unit)

Subscribes to be notified of new, updated and deleted Transactions.

Link copied to clipboard
abstract suspend fun unsubscribeAllFromFundingSources()

Unsubscribe all subscribers from receiving notifications about modifications to FundingSources.

Link copied to clipboard
abstract suspend fun unsubscribeAllFromTransactions()

Unsubscribe all subscribers from receiving notifications about new, updated or deleted Transactions.

Link copied to clipboard
abstract suspend fun unsubscribeFromFundingSources(id: String)

Unsubscribe the specified subscriber so that it no longer receives notifications about modified FundingSources.

Link copied to clipboard
abstract suspend fun unsubscribeFromTransactions(id: String)

Unsubscribe the specified subscriber so that it no longer receives notifications about new, updated or deleted Transactions.

Link copied to clipboard