DefaultRepository

@Singleton
class DefaultRepository @Inject constructor(defaultSource: DefaultSource, disbursementsService: DisbursementsService, collection: CollectionService, config: ApiConfig) : DataResponse

The DefaultRepository class is responsible for making network calls to the MTN MOMO APIs.

This class holds all the common API methods for various MTN MOMO products, including user management, transaction processing, and status checks.

Constructors

Link copied to clipboard
@Inject
constructor(defaultSource: DefaultSource, disbursementsService: DisbursementsService, collection: CollectionService, config: ApiConfig)

Functions

Link copied to clipboard
fun bcAuthorize(productType: String, apiVersion: String, bcAuthorizeRequest: BcAuthorizeRequest, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/BackChannelAuthorize>>

Initiates a backchannel (CIBA) authorization request.

Link copied to clipboard
fun cancelInvoice(apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Cancels a pending Collection invoice before it is paid or expires.

Link copied to clipboard
fun cancelPreApproval(apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Cancels an active Collection pre-approval, immediately revoking the merchant's ability to debit the payer's wallet without per-transaction consent.

Link copied to clipboard
fun cashTransfer(apiVersion: String, cashTransfer: CashTransfer, uuid: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Initiates a Remittance cash transfer using the V2 endpoint with optional KYC fields about the sending party. This replaces the legacy V1 transfer for cross-border remittance use cases where the sender is not a registered MTN mobile money subscriber.

Link copied to clipboard
fun checkApiUser(apiVersion: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/authentication/ApiUser>>

Checks whether the supplied API user exists.

Link copied to clipboard
fun createApiKey(apiVersion: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/authentication/ApiKey>>

Gets the API Key based on the ApiUser Id and OCP Subscription Id.

Link copied to clipboard
fun createApiUser(providerCallBackHost: ProviderCallBackHost, apiVersion: String, uuid: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/authentication/ApiUser>>

Creates a new API user.

Link copied to clipboard
fun createInvoice(apiVersion: String, invoice: Invoice, uuid: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Creates a Collection invoice, prompting the intended payer to approve payment from their wallet.

Link copied to clipboard
fun createPreApproval(apiVersion: String, preApproval: PreApproval, uuid: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Creates a Collection pre-approval, authorising the merchant to debit the payer's wallet without requiring per-transaction consent until the pre-approval expires.

Link copied to clipboard
suspend fun deposit(accessToken: String, momoTransaction: MomoTransaction, apiVersion: String, productSubscriptionKey: String, uuid: String): Response<Unit>

Initiates a deposit directly via the Disbursements service.

Link copied to clipboard
fun getAccessToken(productSubscriptionKey: String, productType: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/authentication/AccessToken>>

Gets the Access Token based on the ApiUser ID, OCP Subscription Id, and the API Key.

Link copied to clipboard
fun getAccountBalance(productType: String, apiVersion: String, currency: String?, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/AccountBalance>>

Retrieves the account balance, optionally filtered by currency.

Link copied to clipboard
fun getBasicUserInfo(productType: String, apiVersion: String, accountHolder: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/BasicUserInfo>>

Retrieves the basic user information for a specified MTN MOMO user.

Link copied to clipboard
fun getCashTransferStatus(apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Retrieves the status of a previously initiated Remittance cash transfer.

Link copied to clipboard
suspend fun getDepositStatus(referenceId: String, apiVersion: String, productSubscriptionKey: String, accessToken: String): Response<ERROR CLASS: Symbol not found for ResponseBody>

Retrieves the status of a previously initiated deposit transaction.

Link copied to clipboard
fun getInvoiceStatus(apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Retrieves the current status of a previously created Collection invoice.

Link copied to clipboard
fun getOauthAccessToken(productType: String, productSubscriptionKey: String, environment: String, backChannelAuthorizationRequestId: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/authentication/Oauth2AccessToken>>

Obtains an OAuth2 access token for use with consent-based API endpoints.

Link copied to clipboard
fun getPreApprovalStatus(apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Retrieves the current status of a previously created Collection pre-approval.

Link copied to clipboard
suspend fun getRefundStatus(referenceId: String, apiVersion: String, productSubscriptionKey: String, accessToken: String): Response<ERROR CLASS: Symbol not found for ResponseBody>

Retrieves the status of a previously initiated refund transaction.

Link copied to clipboard
fun getTransferStatus(productType: String, apiVersion: String, referenceId: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Retrieves the status of a previously initiated fund transfer.

Link copied to clipboard
fun getUserInfoWithConsent(productType: String, apiVersion: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/UserInfoWithConsent>>

Retrieves extended user information for a MTN MOMO user who has granted consent.

Link copied to clipboard
suspend fun refund(accessToken: String, momoTransaction: MomoTransaction, apiVersion: String, productSubscriptionKey: String, uuid: String): Response<Unit>

Initiates a refund directly via the Disbursements service.

Link copied to clipboard
suspend fun requestToPay(accessToken: String, momoTransaction: MomoTransaction, apiVersion: String, productSubscriptionKey: String, uuid: String): Response<Unit>

Initiates a request-to-pay directly via the Collection service.

Link copied to clipboard
fun requestToPayDeliveryNotification(productType: String, apiVersion: String, referenceId: String, momoNotification: MomoNotification, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Sends a delivery notification to the payer for an existing request-to-pay transaction.

Link copied to clipboard
suspend fun requestToPayTransactionStatus(referenceId: String, apiVersion: String, productSubscriptionKey: String, accessToken: String): Response<ERROR CLASS: Symbol not found for ResponseBody>

Retrieves the status of a previously initiated request-to-pay transaction.

Link copied to clipboard
suspend fun requestToWithdraw(accessToken: String, momoTransaction: MomoTransaction, apiVersion: String, productSubscriptionKey: String, uuid: String): Response<Unit>

Initiates a request-to-withdraw directly via the Collection service.

Link copied to clipboard
fun requestToWithdrawDeliveryNotification(apiVersion: String, referenceId: String, momoNotification: MomoNotification, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Sends a delivery notification to the payer for an existing request-to-withdraw transaction.

Link copied to clipboard
suspend fun requestToWithdrawTransactionStatus(referenceId: String, apiVersion: String, productSubscriptionKey: String, accessToken: String): Response<ERROR CLASS: Symbol not found for ResponseBody>

Retrieves the status of a previously initiated request-to-withdraw transaction.

Link copied to clipboard
suspend fun <T> safeApiCall(apiRequest: suspend () -> Response<T>): NetworkResult<T>

Safely makes an API call and returns the result.

Link copied to clipboard
fun transfer(productType: String, apiVersion: String, momoTransaction: MomoTransaction, uuid: String, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Initiates a fund transfer to a specified account.

Link copied to clipboard
fun validateAccountHolderStatus(productType: String, apiVersion: String, accountHolder: AccountHolder, productSubscriptionKey: String, environment: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<ERROR CLASS: Symbol not found for ResponseBody>>

Validates whether the specified account holder is active in the MTN MOMO system.