Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bug where fetchPaymentMethodNonces Return Incorrect Type #1100

Merged
merged 14 commits into from
Sep 29, 2023
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Braintree iOS SDK Release Notes

## unreleased
* BraintreeCore
* Fix bug where `type` was always returned as `Unknown` in `fetchPaymentMethodNonces` (fixes #1099)

## 6.6.0 (2023-08-22)
* BraintreePayPalNativeCheckout
* Update PayPalCheckout from 1.0.0 to 1.1.0.
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraintreeCore/BTPaymentMethodNonceParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Foundation
if json?["nonce"].isString != false {
return BTPaymentMethodNonce(
nonce: json?["nonce"].asString() ?? "",
type: "Unknown",
type: json?["type"].asString() ?? "Unknown",
isDefault: json?["default"].isTrue ?? false
)
}
Expand Down
2 changes: 2 additions & 0 deletions UnitTests/BraintreeCoreTests/BTAPIClient_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ class BTAPIClient_Tests: XCTestCase {

let firstNonce = paymentMethodNonces[0];
XCTAssertEqual(firstNonce.nonce, "fake-nonce1")
XCTAssertEqual(firstNonce.type, "CreditCard")

let secondNonce = paymentMethodNonces[1]
XCTAssertEqual(secondNonce.nonce, "fake-nonce2")
XCTAssertEqual(secondNonce.type, "PayPalAccount")

expectation.fulfill()
}
Expand Down
Loading