Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK crashes after 3DS verification, if the user added a wrong expiration date #1778

Closed
VelkeiMiklos opened this issue Mar 22, 2021 · 3 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@VelkeiMiklos
Copy link

VelkeiMiklos commented Mar 22, 2021

Summary

I wanted to register a Revolut bank card. I entered a wrong bank card expiration date accidentally. After the 3DS verification process, the Revolut sent me back an "Whops, you entered the wrong expiry date for your card" message. But the the sdk crashed here->
assert(false, "Calling completion with invalid state")

The method name: confirmSetupIntent in the STPPaymentHandler class

Assertion failed: Calling completion with invalid state: file Stripe/STPPaymentHandler.swift, line 351

inProgress = true
weak var weakSelf = self
// wrappedCompletion ensures we perform some final logic before calling the completion block.
let wrappedCompletion: STPPaymentHandlerActionSetupIntentCompletionBlock = {
  status, setupIntent, error in
  guard let strongSelf = weakSelf else {
    return
  }
  // Reset our internal state
  strongSelf.inProgress = false

  if status == .succeeded {
    // Ensure the .succeeded case returns a PaymentIntent in the expected state.
    if let setupIntent = setupIntent,
      error == nil,
      setupIntent.status == .succeeded
    {
      completion(.succeeded, setupIntent, nil)
    } else {
     assert(false, "Calling completion with invalid state")
      completion(
        .failed, setupIntent,
        error ?? strongSelf._error(for: .intentStatusErrorCode, userInfo: nil))
    }

  } else {
    completion(status, setupIntent, error)
  }
}

Code to reproduce

In the Summary section, I added the code where it crashed. If you need more info, feel free to ask.

iOS version

iOS 14.4.1

Installation method

Pod

SDK version

21.3.1

Other information

I can always reproduce this issue with a Revolut card. If you need more info, feel free to ask.

@davidme-stripe
Copy link
Contributor

Thanks for filing this, and sorry for the trouble! We'll fix this in the next SDK update.

Asserts are generally compiled out in release mode, so this shouldn't impact your production app — your customer will instead receive an error if the expiration date is invalid.

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Mar 25, 2021
@VelkeiMiklos
Copy link
Author

Thank you!

@davidme-stripe
Copy link
Contributor

This should be fixed in 21.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

2 participants