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 return response
} else { } else {
val body = response.body()?.string() val body = response.body()?.string()
val errorCode = parseErrorCode(body)
val declineCode = parseDeclineCode(body) ?: StripeDeclineCode.getFromCode(errorCode)
throw StripeError.PostError( throw StripeError.PostError(
response.code(), response.code(),
parseErrorCode(body), errorCode,
parseDeclineCode(body) declineCode
) )
} }
} }