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): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/BcAuthorizeResponse>>

Initiates a backchannel (CIBA) authorization request.

Link copied to clipboard
fun cancelInvoice(apiVersion: String, referenceId: String, externalId: String, uuid: String, productSubscriptionKey: 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): 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): 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): 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 createPayment(apiVersion: String, payment: Payment, uuid: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Creates a Collection payment (V2). Poll getPaymentStatus with the same uuid as the reference ID to check the outcome.

Link copied to clipboard
fun createPreApproval(apiVersion: String, preApproval: PreApproval, uuid: String, productSubscriptionKey: 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
fun deposit(deposit: Deposit, apiVersion: String, productSubscriptionKey: String, uuid: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Initiates a deposit via the Disbursements service, sending funds to the payee.

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): 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 getApprovedPreApprovals(apiVersion: String, accountHolderIdType: String, accountHolderId: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/ApprovedPreApprovals>>

Retrieves the list of approved pre-approvals for a given account holder.

Link copied to clipboard
fun getBasicUserInfo(productType: String, apiVersion: String, accountHolder: String, productSubscriptionKey: 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): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/CashTransferStatus>>

Retrieves the status of a previously initiated Remittance cash transfer.

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

Retrieves the status of a previously initiated deposit transaction.

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

Retrieves the current status of a previously created Collection invoice.

Link copied to clipboard
fun getOauthAccessToken(productType: String, productSubscriptionKey: 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 getPaymentStatus(apiVersion: String, referenceId: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/PaymentStatus>>

Retrieves the current status of a previously created Collection payment.

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

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

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

Retrieves the status of a previously initiated refund transaction.

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

Retrieves the status of a previously initiated fund transfer.

Link copied to clipboard
fun getUserInfoWithConsent(productType: String, apiVersion: String, productSubscriptionKey: 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
fun refund(refund: Refund, apiVersion: String, productSubscriptionKey: String, uuid: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<kotlin/Unit>>

Initiates a refund via the Disbursements service, reversing a previous transaction.

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

Initiates a request-to-pay via the Collection service, prompting the payer to approve a debit.

Link copied to clipboard
fun requestToPayDeliveryNotification(productType: String, apiVersion: String, referenceId: String, notifications: Notifications, productSubscriptionKey: 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
fun requestToPayTransactionStatus(referenceId: String, apiVersion: String, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/RequestToPayStatus>>

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

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

Initiates a request-to-withdraw via the Collection service, prompting the payer to approve a debit.

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

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, transfer: Transfer, uuid: String, productSubscriptionKey: 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, party: Party, productSubscriptionKey: String): ERROR CLASS: Symbol not found for Flow<io/rekast/sdk/repository/data/NetworkResult<io/rekast/sdk/model/AccountHolderStatus>>

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