-
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.
- Loading branch information
1 parent
37b8c99
commit 9262a81
Showing
9 changed files
with
50 additions
and
51 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...src/test/java/com/stripe/android/paymentelement/embedded/form/ConfirmationStateHelpers.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,35 @@ | ||
package com.stripe.android.paymentelement.embedded.form | ||
|
||
import com.stripe.android.common.model.asCommonConfiguration | ||
import com.stripe.android.core.strings.resolvableString | ||
import com.stripe.android.model.PaymentIntentFixtures | ||
import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi | ||
import com.stripe.android.paymentelement.confirmation.ConfirmationHandler | ||
import com.stripe.android.paymentelement.confirmation.toConfirmationOption | ||
import com.stripe.android.paymentelement.embedded.content.EmbeddedConfirmationStateFixtures | ||
import com.stripe.android.paymentsheet.model.PaymentSelection | ||
|
||
@OptIn(ExperimentalEmbeddedPaymentElementApi::class) | ||
internal fun confirmationStateConfirming(selection: PaymentSelection): ConfirmationHandler.State.Confirming { | ||
val confirmationOption = selection.toConfirmationOption( | ||
configuration = EmbeddedConfirmationStateFixtures.defaultState().configuration.asCommonConfiguration(), | ||
linkConfiguration = null | ||
) | ||
return ConfirmationHandler.State.Confirming(requireNotNull(confirmationOption)) | ||
} | ||
|
||
internal fun confirmationStateComplete(succeeded: Boolean): ConfirmationHandler.State.Complete { | ||
val result = if (succeeded) { | ||
ConfirmationHandler.Result.Succeeded( | ||
PaymentIntentFixtures.PI_SUCCEEDED, | ||
null | ||
) | ||
} else { | ||
ConfirmationHandler.Result.Failed( | ||
cause = Throwable(), | ||
message = "Something went wrong".resolvableString, | ||
type = ConfirmationHandler.Result.Failed.ErrorType.Internal | ||
) | ||
} | ||
return ConfirmationHandler.State.Complete(result) | ||
} |
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
Binary file modified
BIN
-256 Bytes
(99%)
...ded.form_FormActivityScreenShotTest_testFormActivity_error[CrazyAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-415 Bytes
(99%)
...ed.form_FormActivityScreenShotTest_testFormActivity_error[CustomAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-300 Bytes
(99%)
...d.form_FormActivityScreenShotTest_testFormActivity_error[DefaultAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.59 KB
(96%)
...orm_FormActivityScreenShotTest_testFormActivity_processing[CrazyAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.22 KB
(97%)
...rm_FormActivityScreenShotTest_testFormActivity_processing[CustomAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.6 KB
(96%)
...m_FormActivityScreenShotTest_testFormActivity_processing[DefaultAppearance].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.