SudoVirtualCardsClient

public protocol SudoVirtualCardsClient : AnyObject

Client used to interface with the Sudo Payment Platform service.

It is recommended to code to this interface, rather than the implementation class (DefaultSudoVirtualCardsClient) as the implementation class is only meant to be used for initializing an instance of the client.

  • Removes all keys associated with this client, resets any cached data, cleans up subscriptions, and purges any pending operations.

    It is important to note that this will clear ALL cached data related to all sudo services.

    Declaration

    Swift

    func reset() throws
  • createKeysIfAbsent() Asynchronous

    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.

    Declaration

    Swift

    func createKeysIfAbsent() async throws -> CreateKeysIfAbsentResult

Mutations

Queries

  • Get the funding source client configuration. Returns: The configuration of the client funding source data.

    Declaration

    Swift

    func getFundingSourceClientConfiguration() async throws -> [FundingSourceClientConfiguration]
  • Get a provisional card using the id parameter. If the card cannot be found, nil will be returned.

    • Parameters

      • id: ID of the card to be retrieved.
      • cachePolicy: Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Declaration

    Swift

    func getProvisionalCard(withId id: String, cachePolicy: CachePolicy) async throws -> ProvisionalCard?

    Return Value

    • Success: Card associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of provisional cards. If no cards can be found, an empty list will be returned.

    Declaration

    Swift

    func listProvisionalCards(
        withLimit limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy
    ) async throws -> ListAPIResult<ProvisionalCard, PartialProvisionalCard>

    Parameters

    limit

    Number of cards to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to listProvisionalCards. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Cards associated with user, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.
  • Get a card using the id parameter. If the card cannot be found, nil will be returned.

    • Parameters

      • id: ID of the card to be retrieved.
      • cachePolicy: Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Declaration

    Swift

    func getVirtualCard(
        withId id: String,
        cachePolicy: CachePolicy
    ) async throws -> VirtualCard?

    Return Value

    • Success: Card associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get the current VirtualCardsConfig. If the config cannot be found, nil will be returned.

    • Parameters

      • cachePolicy: Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Declaration

    Swift

    func getVirtualCardsConfig(
        cachePolicy: CachePolicy
    ) async throws -> VirtualCardsConfig?

    Return Value

    • Success: Virtual card config associated with account, or nil if the coinfig cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of cards. If no cards can be found, an empty list will be returned.

    Declaration

    Swift

    func listVirtualCards(
        withLimit limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy
    ) async throws -> ListAPIResult<VirtualCard, PartialVirtualCard>

    Parameters

    limit

    Number of cards to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getCards. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Cards associated with user, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.
  • Get a funding source using the id parameter. If the funding source cannot be found, nil will be returned.

    Declaration

    Swift

    func getFundingSource(
        withId id: String,
        cachePolicy: CachePolicy
    ) async throws -> FundingSource?

    Parameters

    id

    ID of the funding source to be retrieved.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: FundingSource associated with id, or nil if the funding source cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of funding sources. If no funding sources can be found, an empty list will be returned.

    Declaration

    Swift

    func listFundingSources(
        withLimit limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy
    ) async throws -> ListOutput<FundingSource>

    Parameters

    limit

    Number of funding sources to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getFundingSources. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: FundingSource associated with id, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.

Methods: Transactions

  • Get a transaction using the id parameter. If the transaction cannot be found, nil will be returned.

    Declaration

    Swift

    func getTransaction(
        withId id: String,
        cachePolicy: CachePolicy
    ) async throws -> Transaction?

    Parameters

    id

    ID of the transaction to be retrieved.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Transaction associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of transactions by card id. If no transactions can be found, an empty list will be returned.

    Declaration

    Swift

    func listTransactions(
        withCardId cardId: String,
        limit: Int?,
        nextToken: String?,
        dateRange: DateRangeInput?,
        sortOrder: SortOrderInput?,
        cachePolicy: CachePolicy
    ) async throws -> ListAPIResult<Transaction, PartialTransaction>

    Parameters

    cardId

    Identifier of the card to search associated transactions for.

    limit

    Number of transaction to return. If nil, the limit is up to 1MB of data returned from the service.

    nextToken

    Generated token by previous calls to getTransactions. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error.

    dateRange

    Range of upper and lower date limits for records.

    sortOrder

    Order in which records are returned (based on date).

    cachePolicy

    Determines how the data is fetched.

    Return Value

    • Success: Transactions associated with user, or empty array if no transaction can be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of transactions. If no transactions can be found, an empty list will be returned.

    Declaration

    Swift

    func listTransactions(
        withLimit limit: Int?,
        nextToken: String?,
        dateRange: DateRangeInput?,
        sortOrder: SortOrderInput?,
        cachePolicy: CachePolicy
    ) async throws -> ListAPIResult<Transaction, PartialTransaction>

    Parameters

    limit

    Number of transaction to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getTransactions. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error.

    dateRange

    Range of upper and lower date limits for records.

    sortOrder

    Order in which records are returned (based on date).

    cachePolicy

    Determines how the data is fetched.

    Return Value

    • Success: Transactions associated with user, or empty array if no transaction can be found.
    • Failure:
      • SudoPlatformError.

Subscriptions