-
Notifications
You must be signed in to change notification settings - Fork 295
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
[v7] Remove cardAddChallenge
#1487
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ee845d3
remove cardAddChallenge; update property order; update logic
jaxdesmarais f5cb010
update cardAdd logic
jaxdesmarais a3dbc1a
update unit tests for changes
jaxdesmarais a61142a
add CHANGELOG entry
jaxdesmarais b961343
remove unneeded test
jaxdesmarais 387fb39
Update Sources/BraintreeThreeDSecure/BTThreeDSecureClient.swift
jaxdesmarais c51a54c
Merge branch 'v7' into remove-card-add-challenge
jaxdesmarais File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
Sources/BraintreeThreeDSecure/BTThreeDSecureCardAddChallenge.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
nonce: "fake-card-nonce", | ||
accountType: .credit, | ||
billingAddress: billingAddress, | ||
_cardAddChallenge: .requested, | ||
cardAddChallengeRequested: true, | ||
challengeRequested: true, | ||
dataOnlyRequested: true, | ||
|
@@ -92,8 +91,7 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
func testPerformThreeDSecureLookup_whenDefaultsArePassed_buildsRequestWithNilValues() { | ||
let expectation = expectation(description: "willCallCompletion") | ||
|
||
threeDSecureRequest.nonce = "fake-card-nonce" | ||
threeDSecureRequest.amount = "9.99" | ||
let threeDSecureRequest = BTThreeDSecureRequest(amount: "9.99", nonce: "fake-card-nonce") | ||
|
||
client.performThreeDSecureLookup(threeDSecureRequest) { _, _ in | ||
XCTAssertEqual(self.mockAPIClient.lastPOSTParameters!["amount"] as! String, "9.99") | ||
|
@@ -108,26 +106,6 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
waitForExpectations(timeout: 1) | ||
} | ||
|
||
func testPerformThreeDSecureLookup_whenCardAddChallengeNotRequested_sendsCardAddFalse() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test was specific to this removed logic in the client: } else if request._cardAddChallenge == .notRequested {
requestParameters["cardAdd"] = false
} |
||
let expectation = self.expectation(description: "willCallCompletion") | ||
|
||
threeDSecureRequest = BTThreeDSecureRequest( | ||
amount: "9.97", | ||
nonce: "fake-card-nonce", | ||
_cardAddChallenge: .notRequested, | ||
cardAddChallengeRequested: false, | ||
dfReferenceID: "df-reference-id" | ||
) | ||
|
||
client.performThreeDSecureLookup(threeDSecureRequest) { (lookup, error) in | ||
XCTAssertFalse(self.mockAPIClient.lastPOSTParameters!["cardAdd"] as! Bool) | ||
|
||
expectation.fulfill() | ||
} | ||
|
||
waitForExpectations(timeout: 1, handler: nil) | ||
} | ||
|
||
func testPerformThreeDSecureLookup_whenCardAddChallengeRequestedNotSet_doesNotSendCardAddParameter() { | ||
let expectation = self.expectation(description: "willCallCompletion") | ||
|
||
|
@@ -285,12 +263,10 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
func testStartPaymentFlow_whenAmountIsEmpty_throwsError() { | ||
mockAPIClient.cannedConfigurationResponseBody = mockConfiguration | ||
|
||
let request = BTThreeDSecureRequest(amount: "10.00", nonce: "fake-card-nonce") | ||
request.amount = "" | ||
|
||
let expectation = self.expectation(description: "Callback envoked") | ||
threeDSecureRequest = BTThreeDSecureRequest(amount: "", nonce: "fake-card-nonce") | ||
let expectation = self.expectation(description: "Callback invoked") | ||
|
||
client.startPaymentFlow(request) { result, error in | ||
client.startPaymentFlow(threeDSecureRequest) { result, error in | ||
XCTAssertNil(result) | ||
XCTAssertEqual(error?.localizedDescription, "BTThreeDSecureRequest amount can not be nil or NaN.") | ||
expectation.fulfill() | ||
|
@@ -640,7 +616,6 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
mockAPIClient.cannedConfigurationResponseBody = mockConfiguration | ||
let expectation = expectation(description: "willCallCompletion") | ||
|
||
threeDSecureRequest.nonce = "fake-card-nonce" | ||
threeDSecureRequest.dfReferenceID = "fake-df-reference-id" | ||
|
||
client.prepareLookup(threeDSecureRequest) { clientData, error in | ||
|
@@ -668,7 +643,6 @@ class BTThreeDSecureClient_Tests: XCTestCase { | |
let client = BTThreeDSecureClient(apiClient: MockAPIClient(authorization: "sandbox_9dbg82cq_dcpspy2brwdjr3qn")!) | ||
let expectation = expectation(description: "willCallCompletion") | ||
|
||
threeDSecureRequest.nonce = "fake-card-nonce" | ||
threeDSecureRequest.dfReferenceID = "fake-df-reference-id" | ||
|
||
client.prepareLookup(threeDSecureRequest) { _, error in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only property that should need to be a var according to our logic. Updated these and the unit tests with this change. Also confirmed in the demo app things are still appearing as expected.