Updated on 2026-08-14
This commit is contained in:
commit
d7d7b3f301
3 changed files with 21 additions and 11 deletions
|
|
@ -10,7 +10,8 @@ import retrofit2.http.Query
|
|||
/**
|
||||
* Api for referral feature
|
||||
*/
|
||||
interface ReferralApi {
|
||||
interface
|
||||
ReferralApi {
|
||||
|
||||
/** Returns referral status by [walletId] */
|
||||
@GET("referral/{walletId}")
|
||||
|
|
|
|||
|
|
@ -14,17 +14,26 @@ data class ReferralResponse(
|
|||
|
||||
data class Conditions(
|
||||
@Json(name = "award") val award: Int,
|
||||
@Json(name = "discount") val discount: Int,
|
||||
@Json(name = "discountType") val discountType: DiscountType,
|
||||
@Json(name = "discount") val discount: Discount,
|
||||
@Json(name = "awards") val awards: List<Award>,
|
||||
@Json(name = "tosLink") val tosLink: String,
|
||||
@Json(name = "tokens") val tokens: List<Token>,
|
||||
)
|
||||
|
||||
data class Discount(
|
||||
@Json(name = "amount") val amount: Int,
|
||||
@Json(name = "discountType") val discountType: DiscountType,
|
||||
)
|
||||
|
||||
data class Award(
|
||||
@Json(name = "amount") val amount: Int,
|
||||
@Json(name = "token") val token: Token,
|
||||
)
|
||||
|
||||
data class Token(
|
||||
@Json(name = "id") val id: String,
|
||||
@Json(name = "name") val name: String,
|
||||
@Json(name = "symbol") val symbol: String,
|
||||
@Json(name = "networkId") val networkId: String?,
|
||||
@Json(name = "networkId") val networkId: String,
|
||||
@Json(name = "contractAddress") val contractAddress: String?,
|
||||
@Json(name = "decimalCount") val decimalCount: Int?,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ class ReferralConverter @Inject constructor() : Converter<ReferralResponse, Refe
|
|||
return if (referral != null) {
|
||||
ReferralData.ParticipantData(
|
||||
award = conditions.award,
|
||||
discount = conditions.discount,
|
||||
discountType = DiscountType.valueOf(conditions.discountType.name),
|
||||
discount = conditions.discount.amount,
|
||||
discountType = DiscountType.valueOf(conditions.discount.discountType.name),
|
||||
tosLink = conditions.tosLink,
|
||||
tokens = tokenConverter.convertList(conditions.tokens),
|
||||
tokens = tokenConverter.convertList(conditions.awards.map { it.token }),
|
||||
referral = ReferralInfo(
|
||||
shareLink = referral.shareLink,
|
||||
address = referral.address,
|
||||
|
|
@ -33,10 +33,10 @@ class ReferralConverter @Inject constructor() : Converter<ReferralResponse, Refe
|
|||
} else {
|
||||
ReferralData.NonParticipantData(
|
||||
award = conditions.award,
|
||||
discount = conditions.discount,
|
||||
discountType = DiscountType.valueOf(conditions.discountType.name),
|
||||
discount = conditions.discount.amount,
|
||||
discountType = DiscountType.valueOf(conditions.discount.discountType.name),
|
||||
tosLink = conditions.tosLink,
|
||||
tokens = tokenConverter.convertList(conditions.tokens),
|
||||
tokens = tokenConverter.convertList(conditions.awards.map { it.token }),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue