Skip to content

Commit 0227725

Browse files
committed
Address PR comments
1 parent b1a854e commit 0227725

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

paymentsheet/detekt-baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<ID>MaxLineLength:SupportedPaymentMethod.kt$SupportedPaymentMethod$/** This describes the image in the LPM selector. These can be found internally [here](https://www.figma.com/file/2b9r3CJbyeVAmKi1VHV2h9/Mobile-Payment-Element?node-id=1128%3A0) */</ID>
9090
<ID>MaxLineLength:USBankAccountFormViewModelTest.kt$USBankAccountFormViewModelTest$fun</ID>
9191
<ID>MaximumLineLength:CardDefinition.kt$internal</ID>
92+
<ID>TooGenericExceptionCaught:IntentConfirmationInterceptor.kt$DefaultIntentConfirmationInterceptor$exception: Exception</ID>
9293
<ID>TooManyFunctions:CustomerSheetEventReporter.kt$CustomerSheetEventReporter</ID>
9394
<ID>TooManyFunctions:DefaultCustomerSheetEventReporter.kt$DefaultCustomerSheetEventReporter : CustomerSheetEventReporter</ID>
9495
<ID>TooManyFunctions:DefaultEventReporter.kt$DefaultEventReporter : EventReporter</ID>

paymentsheet/src/main/java/com/stripe/android/paymentelement/PreparePaymentMethodHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fun interface PreparePaymentMethodHandler {
1010
/**
1111
* Prepares a payment method and shipping address to be passed through an external provider
1212
*
13-
* After the call of to this method, the session will be completed in Payment Element successfully.
13+
* After the call to this method, the session will be completed in Payment Element successfully.
1414
*
1515
* @param paymentMethod The [PaymentMethod] representing the customer's payment details. If your
1616
* server needs the payment method, send [PaymentMethod.id] to your server and have it fetch the

paymentsheet/src/main/java/com/stripe/android/paymentelement/confirmation/intent/IntentConfirmationInterceptor.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.stripe.android.core.injection.STRIPE_ACCOUNT_ID
77
import com.stripe.android.core.networking.ApiRequest
88
import com.stripe.android.core.strings.ResolvableString
99
import com.stripe.android.core.strings.resolvableString
10+
import com.stripe.android.link.utils.errorMessage
1011
import com.stripe.android.model.ConfirmPaymentIntentParams
1112
import com.stripe.android.model.ConfirmStripeIntentParams
1213
import com.stripe.android.model.PaymentIntent
@@ -362,12 +363,19 @@ internal class DefaultIntentConfirmationInterceptor @Inject constructor(
362363
): NextStep {
363364
return when (val handler = waitForPreparePaymentMethodHandler()) {
364365
is PreparePaymentMethodHandler -> {
365-
handler.onPreparePaymentMethod(
366-
paymentMethod = paymentMethod,
367-
shippingAddress = shippingValues?.toAddressDetails(),
368-
)
366+
try {
367+
handler.onPreparePaymentMethod(
368+
paymentMethod = paymentMethod,
369+
shippingAddress = shippingValues?.toAddressDetails(),
370+
)
369371

370-
NextStep.Complete(isForceSuccess = true)
372+
NextStep.Complete(isForceSuccess = true)
373+
} catch (exception: Exception) {
374+
NextStep.Fail(
375+
cause = exception,
376+
message = exception.errorMessage,
377+
)
378+
}
371379
}
372380

373381
else -> {

0 commit comments

Comments
 (0)