Skip to content

Commit 2fc7505

Browse files
committed
Updated unit and screenshot tests
1 parent 9970737 commit 2fc7505

5 files changed

Lines changed: 19 additions & 16 deletions

File tree

crypto-onramp/src/main/java/com/stripe/android/crypto/onramp/OnrampInteractor.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,5 +1171,8 @@ internal fun LinkController.PaymentMethodType.toDisplayType(): PaymentMethodDisp
11711171

11721172
LinkController.PaymentMethodType.BankAccount ->
11731173
PaymentMethodDisplayData.Type.BankAccount
1174+
1175+
LinkController.PaymentMethodType.Generic ->
1176+
PaymentMethodDisplayData.Type.Card
11741177
}
11751178
}

payments-core/src/test/java/com/stripe/android/model/ConsumerFixtures.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ object ConsumerFixtures {
264264
""".trimIndent()
265265
)
266266

267-
val CONSUMER_SINGLE_UNKNOWN_PAYMENT_DETAILS_JSON = JSONObject(
267+
val CONSUMER_SINGLE_GENERIC_PAYMENT_DETAILS_JSON = JSONObject(
268268
"""
269269
{
270270
"redacted_payment_details": [
@@ -281,14 +281,14 @@ object ConsumerFixtures {
281281
"default": "https://example.com/crypto-icon.png"
282282
}
283283
},
284-
"next_action_types": ["STRIPE_REDIRECT"]
284+
"next_action_types": ["redirect_to_url"]
285285
}
286286
]
287287
}
288288
""".trimIndent()
289289
)
290290

291-
val CONSUMER_UNKNOWN_PAYMENT_DETAILS_NO_SUBLABEL_ICON_JSON = JSONObject(
291+
val CONSUMER_GENERIC_PAYMENT_DETAILS_NO_SUBLABEL_ICON_JSON = JSONObject(
292292
"""
293293
{
294294
"redacted_payment_details": [
@@ -307,7 +307,7 @@ object ConsumerFixtures {
307307
""".trimIndent()
308308
)
309309

310-
val CONSUMER_UNKNOWN_PAYMENT_DETAILS_NO_DISPLAY_JSON = JSONObject(
310+
val CONSUMER_GENERIC_PAYMENT_DETAILS_NO_DISPLAY_JSON = JSONObject(
311311
"""
312312
{
313313
"redacted_payment_details": [

payments-core/src/test/java/com/stripe/android/model/parsers/ConsumerPaymentDetailsJsonParserTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class ConsumerPaymentDetailsJsonParserTest {
223223
}
224224

225225
@Test
226-
fun `parse unknown payment type`() {
226+
fun `parse generic payment type`() {
227227
assertEquals(
228228
ConsumerPaymentDetails(
229229
listOf(
@@ -247,12 +247,12 @@ class ConsumerPaymentDetailsJsonParserTest {
247247
)
248248
),
249249
ConsumerPaymentDetailsJsonParser
250-
.parse(ConsumerFixtures.CONSUMER_SINGLE_UNKNOWN_PAYMENT_DETAILS_JSON),
250+
.parse(ConsumerFixtures.CONSUMER_SINGLE_GENERIC_PAYMENT_DETAILS_JSON),
251251
)
252252
}
253253

254254
@Test
255-
fun `parse unknown payment type without sublabel or icon`() {
255+
fun `parse generic payment type without sublabel or icon`() {
256256
assertEquals(
257257
ConsumerPaymentDetails(
258258
listOf(
@@ -274,21 +274,21 @@ class ConsumerPaymentDetailsJsonParserTest {
274274
)
275275
),
276276
ConsumerPaymentDetailsJsonParser
277-
.parse(ConsumerFixtures.CONSUMER_UNKNOWN_PAYMENT_DETAILS_NO_SUBLABEL_ICON_JSON),
277+
.parse(ConsumerFixtures.CONSUMER_GENERIC_PAYMENT_DETAILS_NO_SUBLABEL_ICON_JSON),
278278
)
279279
}
280280

281281
@Test
282-
fun `parse unknown payment type without display is dropped`() {
282+
fun `parse generic payment type without display is dropped`() {
283283
assertEquals(
284284
ConsumerPaymentDetails(emptyList()),
285285
ConsumerPaymentDetailsJsonParser
286-
.parse(ConsumerFixtures.CONSUMER_UNKNOWN_PAYMENT_DETAILS_NO_DISPLAY_JSON),
286+
.parse(ConsumerFixtures.CONSUMER_GENERIC_PAYMENT_DETAILS_NO_DISPLAY_JSON),
287287
)
288288
}
289289

290290
@Test
291-
fun `parse card with unrecognized funding defaults to Unknown`() {
291+
fun `parse card with unrecognized funding defaults to Generic`() {
292292
val json = createCardJsonWithFunding("INVALID")
293293
val expected = createExpectedCardWithFunding(ConsumerPaymentDetails.Card.Funding.Unknown)
294294
assertEquals(expected, ConsumerPaymentDetailsJsonParser.parse(json))

paymentsheet/src/main/java/com/stripe/android/link/ui/wallet/Icon.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.stripe.android.link.ui.wallet
22

3-
import androidx.compose.foundation.layout.Box
3+
import androidx.compose.foundation.layout.BoxWithConstraints
44
import androidx.compose.foundation.layout.BoxWithConstraintsScope
55
import androidx.compose.foundation.layout.fillMaxSize
66
import androidx.compose.runtime.Composable
@@ -13,9 +13,9 @@ import com.stripe.android.uicore.image.StripeImage
1313
fun Icon(
1414
iconUrl: String?,
1515
modifier: Modifier = Modifier,
16-
errorContent: @Composable (BoxWithConstraintsScope.() -> Unit) = {},
16+
errorContent: @Composable BoxWithConstraintsScope.() -> Unit = {},
1717
) {
18-
Box(modifier = modifier) {
18+
BoxWithConstraints(modifier = modifier) {
1919
iconUrl?.let {
2020
StripeImage(
2121
url = iconUrl,
@@ -25,6 +25,6 @@ fun Icon(
2525
contentScale = ContentScale.Fit,
2626
errorContent = errorContent
2727
)
28-
} ?: errorContent
28+
} ?: errorContent()
2929
}
3030
}

paymentsheet/src/main/java/com/stripe/android/link/ui/wallet/WalletPaymentMethodMenu.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ private val ConsumerPaymentDetails.PaymentDetails.canBeSetAsDefault
5959
get() = when (this) {
6060
is ConsumerPaymentDetails.BankAccount,
6161
is ConsumerPaymentDetails.Card,
62-
is ConsumerPaymentDetails.Passthrough -> isDefault
62+
is ConsumerPaymentDetails.Passthrough -> !isDefault
6363
is ConsumerPaymentDetails.Generic -> false
6464
}

0 commit comments

Comments
 (0)