question

darrank avatar image
darrank asked darrank edited

How to determine if Cash Tender is available?

We are developing a custom tender and would like to disable some capabilities if the user has disabled cash as a tender type on their device.


How can you determine if the user has disabled cash tender on their Clover Station 2018?

PaymentsCustom Tenders
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image
Jacob Abrams answered

You can use the TenderConnector in the clover-android-sdk.

Docs are here: https://github.com/clover/clover-android-sdk/blob/master/clover-android-sdk/src/main/aidl/com/clover/sdk/v1/tender/ITenderService.aidl

The TenderConnector is here: https://github.com/clover/clover-android-sdk/blob/master/clover-android-sdk/src/main/java/com/clover/sdk/v1/tender/TenderConnector.java

Note that the returned Tender object has a getEnabled() method which returns false if the tender is disabled.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

darrank avatar image
darrank answered darrank edited

Thank you - I wrote something like this in kotlin - this uses label, but I saw in another example you could use labelkey


t.getLabelKey().equals("com.clover.tender.cash")


fun checkTenderStatus(tenderConnector: TenderConnector, tenderLabel: String): TenderStatus {
    val success = tenderConnector.connect()
    var result: TenderStatus = TenderStatus.Fail(Exception("Check Status Failed."))
    if (success) {
        val tenders = tenderConnector.tenders
        val tender = tenders.find { it.label == tenderLabel }
        if (tender != null) {
            result = if (tender.enabled) {
                TenderStatus.Enabled
            } else {
                TenderStatus.NotEnabled
            }
        } else {
            result = TenderStatus.NotRun
        }
    }
    tenderConnector.disconnect()
    return result
}


10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community