Allow stripe error codes to be upgraded to decline codes.

This commit is contained in:
Alex Hart 2022-10-31 10:37:07 -03:00 committed by Cody Henthorne
parent 1a657a7a19
commit 123fb95916

View file

@ -194,10 +194,13 @@ class StripeApi(
return response
} else {
val body = response.body()?.string()
val errorCode = parseErrorCode(body)
val declineCode = parseDeclineCode(body) ?: StripeDeclineCode.getFromCode(errorCode)
throw StripeError.PostError(
response.code(),
parseErrorCode(body),
parseDeclineCode(body)
errorCode,
declineCode
)
}
}