-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mandate handling in
Payment Element
- Loading branch information
1 parent
65d3422
commit c40b474
Showing
11 changed files
with
205 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
payments-core/src/test/java/com/stripe/android/ConfirmSetupIntentParamsFactoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.stripe.android | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import com.stripe.android.model.ConfirmSetupIntentParams | ||
import com.stripe.android.model.ConfirmStripeIntentParams | ||
import com.stripe.android.model.MandateDataParams | ||
import com.stripe.android.testing.PaymentMethodFactory | ||
import com.stripe.android.testing.SetupIntentFactory | ||
import org.junit.Test | ||
|
||
class ConfirmSetupIntentParamsFactoryTest { | ||
@Test | ||
fun `create() should not contain mandate data`() { | ||
val factoryWithConfig = ConfirmSetupIntentParamsFactory( | ||
clientSecret = CLIENT_SECRET, | ||
intent = SetupIntentFactory.create(), | ||
) | ||
|
||
val result = factoryWithConfig.create( | ||
paymentMethod = PaymentMethodFactory.cashAppPay(), | ||
optionsParams = null, | ||
) | ||
|
||
assertThat(result).isInstanceOf(ConfirmSetupIntentParams::class.java) | ||
|
||
val params = result.asConfirmSetupIntentParams() | ||
|
||
assertThat(params.mandateData).isEqualTo(MandateDataParams(MandateDataParams.Type.Online.DEFAULT)) | ||
} | ||
|
||
private fun ConfirmStripeIntentParams.asConfirmSetupIntentParams(): ConfirmSetupIntentParams { | ||
return this as ConfirmSetupIntentParams | ||
} | ||
|
||
private companion object { | ||
private const val CLIENT_SECRET = "client_secret" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.