vnpayment / com.venuenext.vnpayment.data / PaymentMethodRepository / getPaymentMethod

getPaymentMethod

suspend fun getPaymentMethod(userId: String? = null, forceRefresh: Boolean = false): PaymentMethod?

Retrieves a user's primary payment method from a cache, database, or network.

Parameters

userId - The user's UUID, required when doing a force refresh

forceRefresh - Determines if data will be refreshed with a network call.

Exceptions

IllegalArgumentException - Thrown when requesting a refresh without specifying a user UUID

DatabaseException - Thrown if an error occurs accessing the database

com.venuenext.vnpayment.service.UserNotFoundException - Network error thrown when user with given UUID is not found

com.venuenext.vnpayment.service.PaymentMethodException - Thrown when a network service error occurs