From 696a985bb966eff79a75303fbb9b166755fbb6b6 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Wed, 26 Jun 2024 10:51:16 -0700 Subject: [PATCH] fix(dashspend): fix getting discount info and displaying addresses --- .../data/ctxspend/model/GetMerchantResponse.kt | 4 ++-- .../exploredash/data/explore/model/SearchResult.kt | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/ctxspend/model/GetMerchantResponse.kt b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/ctxspend/model/GetMerchantResponse.kt index 827223d1b8..aec350fa3b 100644 --- a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/ctxspend/model/GetMerchantResponse.kt +++ b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/ctxspend/model/GetMerchantResponse.kt @@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName data class GetMerchantResponse( val id: String, val denominations: List, - val denominationType: String, + val denominationsType: String, val savingsPercentage: Int = 0, val redeemType: String = "" ) { @@ -38,7 +38,7 @@ data class GetMerchantResponse( } val maximumCardPurchase: Double get() { - return when (denominationType) { + return when (denominationsType) { "min-max" -> { require(denominations.size == 2) denominations[1].toDouble() diff --git a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/model/SearchResult.kt b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/model/SearchResult.kt index 8acd3cee69..272bf35765 100644 --- a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/model/SearchResult.kt +++ b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/model/SearchResult.kt @@ -20,6 +20,7 @@ package org.dash.wallet.features.exploredash.data.explore.model import androidx.room.ColumnInfo import androidx.room.Ignore import androidx.room.PrimaryKey +import org.dash.wallet.common.data.ServiceName import org.dash.wallet.features.exploredash.ui.extensions.Const open class SearchResult( @@ -60,6 +61,15 @@ open class SearchResult( addressBuilder.append("${separator}$address4") } + // CTX records do not use address2, address3, address4 + if (source?.lowercase() == ServiceName.CTXSpend.lowercase()) { + addressBuilder.append("${separator}$city") + territory?.let { + addressBuilder.append(", ") + addressBuilder.append(territory) + } + } + return addressBuilder.toString() }