This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 355
@orta: Fixes for Kiosk CC testing on Staging, Unresolved bids, Bidding errors #510
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
49e34a3
[Crash] Removes forced downcast.
ashfurrow 3bb6554
[CC Processing] Adds logging, breaks on errors.
ashfurrow 3a20f01
[CC Processing] Adds Cardflight staging environment.
ashfurrow 91a2b3a
[CC Processing] Always use the card token, even on staging.
ashfurrow 05a35bc
[CC Processing] Use test CCs for staging.
ashfurrow 2e9a760
[CC Processing] Shored up tests.
ashfurrow c07c545
[Bid Resolution] Increased polling requests to twenty.
ashfurrow 68ea778
[Bid Resolution] Changes language for unresolved bids.
ashfurrow c8eef2a
[Bid Resolution] Fixes tests (were never correct).
ashfurrow 10e079f
[Bidding] Understands outbid error from API.
ashfurrow 1c80597
[Bid Resolution] Addressed typos.
ashfurrow 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
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
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
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 |
---|---|---|
|
@@ -36,8 +36,12 @@ class BidderNetworkModel: NSObject { | |
} | ||
|
||
private func createOrUpdateUser() -> RACSignal { | ||
let boolSignal = self.checkUserEmailExists(fulfillmentController.bidDetails.newUser.email!) | ||
// Signal to test for user existence (does a user exist with this email?) | ||
let boolSignal = self.checkUserEmailExists(fulfillmentController.bidDetails.newUser.email ?? "") | ||
// If the user exists, update their info to the API, otherwise create a new user. | ||
let signal = RACSignal.`if`(boolSignal, then: self.updateUser(), `else`: self.createNewUser()) | ||
|
||
// After update/create signal finishes, add a CC to their account (if we've collected one) | ||
return signal.then { self.addCardToUser() } | ||
} | ||
|
||
|
@@ -66,19 +70,22 @@ class BidderNetworkModel: NSObject { | |
|
||
return updateProviderIfNecessary().then { | ||
self.fulfillmentController.loggedInProvider!.request(endpoint).filterSuccessfulStatusCodes().mapJSON() | ||
}.doError { (error) in | ||
}.logNext().doError { (error) in | ||
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. nice |
||
logger.log("Updating user failed.") | ||
logger.log("Error: \(error.localizedDescription). \n \(error.artsyServerError())") | ||
} | ||
} | ||
|
||
private func addCardToUser() -> RACSignal { | ||
if (fulfillmentController.bidDetails.newUser.creditCardToken == nil) { return RACSignal.empty() } | ||
let endpoint: ArtsyAPI = ArtsyAPI.RegisterCard(stripeToken: fulfillmentController.bidDetails.newUser.creditCardToken!) | ||
// If the user was asked to swipe a card, we'd have stored the token. | ||
// If the token is not there, then the user must already have one on file. So we can skip this step. | ||
guard let token = fulfillmentController.bidDetails.newUser.creditCardToken else { | ||
return RACSignal.empty() | ||
} | ||
|
||
// on Staging the card tokenization fails | ||
let endpoint: ArtsyAPI = ArtsyAPI.RegisterCard(stripeToken: token) | ||
|
||
return fulfillmentController.loggedInProvider!.request(endpoint).doError { (error) in | ||
return fulfillmentController.loggedInProvider!.request(endpoint).filterSuccessfulStatusCodes().mapJSON().doError { (error) in | ||
logger.log("Adding Card to User failed.") | ||
logger.log("Error: \(error.localizedDescription). \n \(error.artsyServerError())") | ||
} | ||
|
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
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
Oops, something went wrong.
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.
The logic here was messy, so I made it prettier.