Android - yuu Redeemed Coupon page
Redeemed Reward Selection (Web View)
After a successful login, the SDK provides a web view where users can view their redeemed rewards. Once a user selects rewards, the SDK will return a list of reward IDs back to your app.
RewardType Enum
The RewardType enum is used to filter which rewards are shown on the redeemed reward list page.
| Enum Value | Type Value | Description |
|---|---|---|
ALL | "ALL" | Shows all available rewards |
CASH_VOUCHER | "CASH_VOUCHER" | Shows only cash voucher |
REWARD_OFFER | "REWARD_OFFER" | Shows only reward offers |
basketAmount
The total amount of the user's cart. If the applied voucher value exceeds this amount, a warning dialog will appear to notify the user and ask whether they want to proceed.
appliedRewardIds
A list of reward IDs previously selected by the user. This allows the app to reapply the user's chosen rewards when reopening the SDK, since reward selections are not persisted on our side.
products (Optional)
A list of BasketProduct objects representing the items currently in the user's basket. This information is passed to the SDK to provide a better user experience.
data class BasketProduct(
val id: String,
val quantity: Int
)
The id of BasketProduct is the Barcode (promotion ID) of the product, which is a unique identifier used to match with available vouchers.
Selection Callback
YuuSdk.getUserSelectedRedeemedRewardList(
activity = activity,
rewardType = RewardType.ALL,
basketAmount = 100.0f,
appliedRewardIds = listOf("reward_id_1"),
products = listOf(BasketProduct("p1", 1)),
callback = object : SelectedRedeemedRewardsCallback {
override fun selected(rewardList: List<YuuRedeemedReward>) {
// Handle success: rewardList contains YuuRedeemedReward objects
}
override fun canceled() {
// Handle cancel
}
}
)
Fetch Redeemed Reward List (Background API)
Retrieves the user's issued rewards in the background. This is useful for comparing rewards with the user's cart items to auto-apply vouchers.
YuuSdk.getUserRedeemedRewardList(
rewardType = RewardType.ALL,
rewardListener = object : ApiCallListener<RedeemedRewardListResponse> {
override fun success(data: RedeemedRewardListResponse) {
val rewards = data.redeemedRewardList // List<YuuRedeemedReward>
}
override fun fail(exception: Exception?) {
// Handle error
}
}
)
Important Model Note
The data model for rewards has been consolidated into:
data class YuuRedeemedReward(
val rewardTypeExternalReference: String,
val rewardId: Int? = null,
val rewardType: String? = null,
val rewardRetailValue: Float? = null,
val voucherCode: String? = null,
val rewardBarcode: String? = null,
val rewardExpiryDate: String? = null,
val standardBarcode: String? = null
)
// For backward compatibility
typealias SelectedRedeemedReward = YuuRedeemedReward
Field Descriptions
rewardTypeExternalReference: The unique identifier for the general reward campaign or promotion.rewardId: The unique identifier for the user's specific redeemed instance of the reward.rewardBarcode: The barcode data used to generate a QR code or barcode in the UI, enabling Point of Sale (POS) systems to scan and apply the reward.standardBarcode: The product barcode associated with the reward. This maps directly to theidproperty in theBasketProductmodel, allowing the SDK to match available vouchers against specific items in the user's basket.