All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.revenuemonster.sdk.module.MerchantWalletModule.kt Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
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"
        )
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy