Skip to content

Commit

Permalink
Flip fallback logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
sshropshire committed Feb 6, 2023
1 parent a717a2d commit ad1a37a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ static SamsungPayNonce fromJSON(JSONObject inputJson) throws JSONException {
JSONObject tokenizeSamsungPayResponse =
braintreeData.getJSONObject("tokenizeSamsungPayCard");

JSONObject paymentMethod = tokenizeSamsungPayResponse.optJSONObject("singleUseToken");
JSONObject paymentMethod = tokenizeSamsungPayResponse.optJSONObject("paymentMethod");
if (paymentMethod == null) {
// fallback to payment method key
paymentMethod = tokenizeSamsungPayResponse.getJSONObject("paymentMethod");
// fallback to single use token key; throws when fallback not present
paymentMethod = tokenizeSamsungPayResponse.getJSONObject("singleUseToken");
}

String nonce = paymentMethod.getString("id");
Expand Down

0 comments on commit ad1a37a

Please sign in to comment.