mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Fix bad use of toString in StripeApi.
This commit is contained in:
committed by
Greyson Parrelli
parent
556dc0d1ec
commit
e58cea9a26
@@ -120,7 +120,7 @@ class StripeApi(
|
||||
if (response.isSuccessful) {
|
||||
return response
|
||||
} else {
|
||||
val body = response.body()?.toString()
|
||||
val body = response.body()?.string()
|
||||
throw StripeError.PostError(
|
||||
response.code(),
|
||||
parseErrorCode(body),
|
||||
@@ -150,12 +150,7 @@ class StripeApi(
|
||||
}
|
||||
|
||||
return try {
|
||||
val jsonBody = JSONObject(body)
|
||||
Log.d(TAG, "parseDeclineCode: Parsed body with keys: ${jsonBody.keys().asSequence().joinToString(", ")}")
|
||||
val jsonError = jsonBody.getJSONObject("error")
|
||||
Log.d(TAG, "parseDeclineCode: Parsed error with keys: ${jsonError.keys().asSequence().joinToString(", ")}")
|
||||
|
||||
StripeDeclineCode.getFromCode(jsonError.getString("decline_code"))
|
||||
StripeDeclineCode.getFromCode(JSONObject(body).getJSONObject("error").getString("decline_code"))
|
||||
} catch (e: Exception) {
|
||||
Log.d(TAG, "parseDeclineCode: Failed to parse decline code.", e, true)
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user