Skip to content

Commit e6197af

Browse files
authored
Set active to true for new Link payment details (#11279)
1 parent 3085d93 commit e6197af

File tree

10 files changed

+8
-25
lines changed

10 files changed

+8
-25
lines changed

payments-model/src/main/java/com/stripe/android/model/ConsumerPaymentDetailsCreateParams.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ sealed interface ConsumerPaymentDetailsCreateParams : StripeParamsModel, Parcela
1818
data class Card(
1919
private val cardPaymentMethodCreateParamsMap: Map<String, @RawValue Any>,
2020
private val email: String,
21-
private val active: Boolean,
2221
) : ConsumerPaymentDetailsCreateParams {
2322

2423
override fun toParamMap(): Map<String, Any> {
2524
val params = mutableMapOf<String, Any>(
2625
"type" to "card",
27-
"active" to active,
26+
"active" to true,
2827
LINK_PARAM_BILLING_EMAIL_ADDRESS to email,
2928
)
3029

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ConsumerPaymentDetailsCreateParamsTest {
3030
)
3131
),
3232
email = "[email protected]",
33-
active = false,
3433
).toParamMap()
3534
).isEqualTo(
3635
mapOf(
@@ -45,7 +44,7 @@ class ConsumerPaymentDetailsCreateParamsTest {
4544
"country_code" to "US",
4645
"postal_code" to "12345"
4746
),
48-
"active" to false,
47+
"active" to true,
4948
)
5049
)
5150
}
@@ -75,7 +74,6 @@ class ConsumerPaymentDetailsCreateParamsTest {
7574
)
7675
),
7776
email = "[email protected]",
78-
active = false,
7977
).toParamMap()
8078
).isEqualTo(
8179
mapOf(
@@ -91,7 +89,7 @@ class ConsumerPaymentDetailsCreateParamsTest {
9189
"country_code" to "US",
9290
"postal_code" to "12345"
9391
),
94-
"active" to false,
92+
"active" to true,
9593
)
9694
)
9795
}

payments-model/src/test/java/com/stripe/android/repository/ConsumersApiServiceImplTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class ConsumersApiServiceImplTest {
225225
header("User-Agent", "Stripe/v1 ${StripeSdkVersion.VERSION}"),
226226
bodyPart(urlEncode("credentials[consumer_session_client_secret]"), "secret"),
227227
bodyPart("type", "card"),
228-
bodyPart("active", "false"),
228+
bodyPart("active", "true"),
229229
bodyPart("billing_email_address", urlEncode(email)),
230230
bodyPart(urlEncode("card[number]"), "4242424242424242"),
231231
bodyPart(urlEncode("card[exp_month]"), "12"),
@@ -257,7 +257,6 @@ class ConsumersApiServiceImplTest {
257257
paymentDetailsCreateParams = ConsumerPaymentDetailsCreateParams.Card(
258258
cardPaymentMethodCreateParamsMap = paymentMethodCreateParams,
259259
email = email,
260-
active = false,
261260
),
262261
requestSurface = requestSurface,
263262
requestOptions = DEFAULT_OPTIONS,
@@ -279,7 +278,7 @@ class ConsumersApiServiceImplTest {
279278
header("User-Agent", "Stripe/v1 ${StripeSdkVersion.VERSION}"),
280279
bodyPart(urlEncode("credentials[consumer_session_client_secret]"), "secret"),
281280
bodyPart("type", "card"),
282-
bodyPart("active", "false"),
281+
bodyPart("active", "true"),
283282
bodyPart("billing_email_address", urlEncode(email)),
284283
bodyPart(urlEncode("card[number]"), "4242424242424242"),
285284
bodyPart(urlEncode("card[exp_month]"), "12"),
@@ -315,7 +314,6 @@ class ConsumersApiServiceImplTest {
315314
paymentDetailsCreateParams = ConsumerPaymentDetailsCreateParams.Card(
316315
cardPaymentMethodCreateParamsMap = paymentMethodCreateParams,
317316
email = email,
318-
active = false,
319317
),
320318
requestSurface = requestSurface,
321319
requestOptions = DEFAULT_OPTIONS,

paymentsheet/src/main/java/com/stripe/android/link/account/DefaultLinkAccountManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ internal class DefaultLinkAccountManager @Inject constructor(
288288
stripeIntent = config.stripeIntent,
289289
consumerSessionClientSecret = account.clientSecret,
290290
consumerPublishableKey = account.consumerPublishableKey.takeIf { !config.passthroughModeEnabled },
291-
active = config.passthroughModeEnabled,
292291
).onSuccess {
293292
errorReporter.report(ErrorReporter.SuccessEvent.LINK_CREATE_CARD_SUCCESS)
294293
}

paymentsheet/src/main/java/com/stripe/android/link/repositories/LinkApiRepository.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,12 @@ internal class LinkApiRepository @Inject constructor(
178178
stripeIntent: StripeIntent,
179179
consumerSessionClientSecret: String,
180180
consumerPublishableKey: String?,
181-
active: Boolean,
182181
): Result<LinkPaymentDetails.New> = withContext(workContext) {
183182
consumersApiService.createPaymentDetails(
184183
consumerSessionClientSecret = consumerSessionClientSecret,
185184
paymentDetailsCreateParams = ConsumerPaymentDetailsCreateParams.Card(
186185
cardPaymentMethodCreateParamsMap = paymentMethodCreateParams.toParamMap(),
187186
email = userEmail,
188-
active = active,
189187
),
190188
requestSurface = REQUEST_SURFACE,
191189
requestOptions = buildRequestOptions(consumerPublishableKey),

paymentsheet/src/main/java/com/stripe/android/link/repositories/LinkRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ internal interface LinkRepository {
9292
stripeIntent: StripeIntent,
9393
consumerSessionClientSecret: String,
9494
consumerPublishableKey: String?,
95-
active: Boolean,
9695
): Result<LinkPaymentDetails.New>
9796

9897
suspend fun createBankAccountPaymentDetails(

paymentsheet/src/test/java/com/stripe/android/link/account/DefaultLinkAccountManagerTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ class DefaultLinkAccountManagerTest {
482482
stripeIntent: StripeIntent,
483483
consumerSessionClientSecret: String,
484484
consumerPublishableKey: String?,
485-
active: Boolean
486485
): Result<LinkPaymentDetails.New> {
487486
val details = result.first()
488487
if (result.size > 1) {

paymentsheet/src/test/java/com/stripe/android/link/repositories/FakeLinkRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ internal open class FakeLinkRepository : LinkRepository {
129129
stripeIntent: StripeIntent,
130130
consumerSessionClientSecret: String,
131131
consumerPublishableKey: String?,
132-
active: Boolean
133132
) = createCardPaymentDetailsResult
134133

135134
override suspend fun createBankAccountPaymentDetails(

paymentsheet/src/test/java/com/stripe/android/link/repositories/LinkApiRepositoryTest.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ class LinkApiRepositoryTest {
279279
stripeIntent = paymentIntent,
280280
consumerSessionClientSecret = secret,
281281
consumerPublishableKey = consumerKey,
282-
active = false,
283282
)
284283

285284
verify(consumersApiService).createPaymentDetails(
@@ -297,7 +296,7 @@ class LinkApiRepositoryTest {
297296
"country_code" to "US",
298297
"postal_code" to "12345"
299298
),
300-
"active" to false,
299+
"active" to true,
301300
)
302301
},
303302
requestSurface = eq("android_payment_element"),
@@ -330,7 +329,6 @@ class LinkApiRepositoryTest {
330329
stripeIntent = paymentIntent,
331330
consumerSessionClientSecret = secret,
332331
consumerPublishableKey = consumerKey,
333-
active = false,
334332
).getOrThrow()
335333

336334
assertThat(linkDetails.paymentMethodCreateParams.allowRedisplay).isEqualTo(allowRedisplay)
@@ -349,7 +347,6 @@ class LinkApiRepositoryTest {
349347
stripeIntent = paymentIntent,
350348
consumerSessionClientSecret = secret,
351349
consumerPublishableKey = null,
352-
active = false,
353350
)
354351

355352
verify(consumersApiService).createPaymentDetails(
@@ -367,7 +364,7 @@ class LinkApiRepositoryTest {
367364
"country_code" to "US",
368365
"postal_code" to "12345"
369366
),
370-
"active" to false,
367+
"active" to true,
371368
)
372369
},
373370
requestSurface = eq("android_payment_element"),
@@ -395,7 +392,6 @@ class LinkApiRepositoryTest {
395392
stripeIntent = paymentIntent,
396393
consumerSessionClientSecret = consumerSessionSecret,
397394
consumerPublishableKey = null,
398-
active = false,
399395
)
400396

401397
assertThat(result.isSuccess).isTrue()
@@ -443,7 +439,6 @@ class LinkApiRepositoryTest {
443439
stripeIntent = paymentIntent,
444440
consumerSessionClientSecret = "secret",
445441
consumerPublishableKey = null,
446-
active = false,
447442
)
448443
val loggedErrors = errorReporter.getLoggedErrors()
449444

paymentsheet/src/test/java/com/stripe/android/link/ui/paymentmethod/SupportedPaymentMethodTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class SupportedPaymentMethodTest {
2828
ConsumerPaymentDetailsCreateParams.Card(
2929
cardPaymentMethodCreateParamsMap = paymentMethodCreateParams,
3030
email = "[email protected]",
31-
active = false,
3231
).toParamMap()
3332
).isEqualTo(
3433
mapOf(
@@ -43,7 +42,7 @@ class SupportedPaymentMethodTest {
4342
"country_code" to "US",
4443
"postal_code" to "12345"
4544
),
46-
"active" to false,
45+
"active" to true,
4746
)
4847
)
4948
}

0 commit comments

Comments
 (0)