Stripe выдает ошибку token_in_use, даже если токен не используется - PullRequest
0 голосов
/ 25 марта 2020

Кто-нибудь сталкивался с этой ошибкой? В нескольких тестах используется следующий шаблон:

  1. Создание пользователя
  2. Создание чека для оплаты в полосе
  3. Прикрепление токена к пользователю
  4. Зарядите пользователя токеном, прикрепленным к пользователю

Иногда, когда я запускаю этот тест, я получаю следующую ошибку:

%Stripe.Error{
  code: :invalid_request_error,
  extra: %{
    card_code: :token_in_use, 
    http_status: 400, 
    raw_error: %{
      "code" => "token_in_use", 
      "doc_url" => "https://stripe.com/docs/error-codes/token-in-use", 
      "message" => "There is currently another in-progress request using this Stripe token (that probably means you clicked twice, and the other charge is still going through): src_1GQSQOJzKOsRMI5KPg3d5KZE. This token can not be used again if that charge is successful.'",               
      "type" => "invalid_request_error"
    }
  }, 
  message: "There is currently another in-progress request using this Stripe token (that probably means you clicked twice, and the other charge is still going through): src_1GQSQOJzKOsRMI5KPg3d5KZE. This token can not be used again if that charge is successful.'", 
  request_id: nil, 
  source: :stripe, 
  user_message: nil
}

Дело в том, что я создаю бренд новый клиент и токен для каждого теста, поэтому нельзя использовать два теста для одного и того же клиента или токена. Кто-нибудь сталкивался с этим вопросом? Это только начало происходить недавно.

...