commonMain.io.revenuemonster.sdk.module.MerchantWalletModule.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rm-kotlin-sdk-jvm Show documentation
Show all versions of rm-kotlin-sdk-jvm Show documentation
Revenue Monster Kotlin Multiplatform SDK
package io.revenuemonster.sdk.module
import io.ktor.http.*
import io.revenuemonster.sdk.RevenueMonsterSDK
import io.revenuemonster.sdk.model.Item
import io.revenuemonster.sdk.model.ItemList
import io.revenuemonster.sdk.model.Response
import io.revenuemonster.sdk.model.response.*
class MerchantWalletModule(private val sdk: RevenueMonsterSDK) {
suspend fun checkBalance(): Item {
return sdk.call>(
url = "/v3/wallet/credit"
)
}
suspend fun topUpWallet(redirect: String, amount : Int): Item {
val data = TopUpWalletRequest(redirect, amount)
return sdk.call(
url = "/v3/wallet/topup",
method = HttpMethod.Post,
body = data
)
}
suspend fun checkWalletHistory(cursor: String = ""): ItemList {
return sdk.call>(
url = "/v3/wallet/history?cursor=$cursor",
)
}
suspend fun topUpHistory(cursor: String = ""): ItemList {
return sdk.call>(
url = "/v3/wallet/transaction?cursor=$cursor"
)
}
}