NeoDay Android SDK - Coupons

The NeoDaySDK factory methods are executed asynchronously in order to fetch the data and return a NeoDayViewController.

/**
* Makes the Coupons Overview screen that shows all the Coupons available for a user.
*
* @param completion returns NeoDayViewController or an ExceptionException
*/
fun makeCouponsOverview(completion: (Result<NeoDayViewController>) -> Unit)

/**
* Makes the Coupons Overview screen that shows all the Coupons available for a user.
*
* @param couponId The id of the CouponSlip.
* @param completion returns NeoDayViewController or an ExceptionException
*/
fun makeCouponDetail(
    couponId: String,
    completion: (Result<NeoDayViewController>) -> Unit
)

Directly requesting a Coupon Overview screen

val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeCouponsOverview { result ->
    try {
        vc.value = result.getOrThrow()
    } catch (ex: Exception) {
        ex.printStackTrace()
    }
}
vc.value?.getView()?.invoke()

Directly requesting a Coupon detail screen

val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeCouponDetail(couponId = "<couponId>") { result ->
    try {
        vc.value = result.getOrThrow()
    } catch (ex: Exception) {
        ex.printStackTrace()
    }
}
vc.value?.getView()?.invoke()