-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Card: Remove try/catch from Vault Flow (#303)
* Convert UpdateSetupTokenResult into a sealed class Success/Failure result type. * Migrate CardClient vault flow away from throws. * Rename GraphQLResponse to GraphQLResult. * Migrate GraphQL client to result type. * Write test to cover JSON parsing error. * Fix test. * Migrate resource loader away from throw. * Fix DataVaultPaymentMethodTokensAPIUnitTest. * Clean up detekt errors. * Refactor DataVaultPaymentMethodTokensAPI to isolate JSON parsing code. * Add test cases for error scenarios with UpdateSetupTokenAPI. * Fix lint error.
- Loading branch information
1 parent
d6028a0
commit 41f3f56
Showing
14 changed files
with
276 additions
and
141 deletions.
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
17 changes: 12 additions & 5 deletions
17
CardPayments/src/main/java/com/paypal/android/cardpayments/UpdateSetupTokenResult.kt
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 |
---|---|---|
@@ -1,7 +1,14 @@ | ||
package com.paypal.android.cardpayments | ||
|
||
internal data class UpdateSetupTokenResult( | ||
val setupTokenId: String, | ||
val status: String, | ||
val approveHref: String? | ||
) | ||
import com.paypal.android.corepayments.PayPalSDKError | ||
|
||
internal sealed class UpdateSetupTokenResult { | ||
|
||
data class Success( | ||
val setupTokenId: String, | ||
val status: String, | ||
val approveHref: String? | ||
) : UpdateSetupTokenResult() | ||
|
||
data class Failure(val error: PayPalSDKError) : UpdateSetupTokenResult() | ||
} |
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.