-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Card: Remove Approve Order Listener Pattern (#305)
* Rename CardResult to LegacyCardResult before refactoring. * Migrate ApproveOrder away from listener pattern. * Remove ApproveOrderListener. * Fix unit test compilation errors. * Fix lint errors. * Refactor CardAuthLauncher parsing. * Clean up code. * Keep CardClient formatting consistent. * Clean up legacy named methods. * Move CardCallback.ApproveOrder to it's own top level class. * Add docstrings. * Add comment. * Flatten result for approve order sealed class hierarchy. * Flatten Card FinishApproveOrder sealed class hierarchy. * Remove unecessary CardResult type. * Clean up lint errors. * Update CHANGELOG.md. * Rename callback.
- Loading branch information
1 parent
41f3f56
commit ab03611
Showing
16 changed files
with
235 additions
and
205 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
48 changes: 0 additions & 48 deletions
48
CardPayments/src/main/java/com/paypal/android/cardpayments/ApproveOrderListener.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
CardPayments/src/main/java/com/paypal/android/cardpayments/CardApproveOrderCallback.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.paypal.android.cardpayments | ||
|
||
import androidx.annotation.MainThread | ||
|
||
fun interface CardApproveOrderCallback { | ||
/** | ||
* Called when the order is approved. | ||
* | ||
* @param result [CardApproveOrderResult] result with details | ||
*/ | ||
@MainThread | ||
fun onCardApproveOrderResult(result: CardApproveOrderResult) | ||
} |
15 changes: 15 additions & 0 deletions
15
CardPayments/src/main/java/com/paypal/android/cardpayments/CardApproveOrderResult.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.paypal.android.cardpayments | ||
|
||
import com.paypal.android.corepayments.PayPalSDKError | ||
|
||
sealed class CardApproveOrderResult { | ||
|
||
data class Success( | ||
val orderId: String, | ||
val status: String? = null, | ||
val didAttemptThreeDSecureAuthentication: Boolean = false | ||
) : CardApproveOrderResult() | ||
|
||
data class AuthorizationRequired(val authChallenge: CardAuthChallenge) : CardApproveOrderResult() | ||
data class Failure(val error: PayPalSDKError) : CardApproveOrderResult() | ||
} |
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: 15 additions & 0 deletions
15
CardPayments/src/main/java/com/paypal/android/cardpayments/CardFinishApproveOrderResult.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.paypal.android.cardpayments | ||
|
||
import com.paypal.android.corepayments.PayPalSDKError | ||
|
||
sealed class CardFinishApproveOrderResult { | ||
data class Success( | ||
val orderId: String, | ||
val status: String? = null, | ||
val didAttemptThreeDSecureAuthentication: Boolean = false | ||
) : CardFinishApproveOrderResult() | ||
|
||
data class Failure(val error: PayPalSDKError) : CardFinishApproveOrderResult() | ||
data object Canceled : CardFinishApproveOrderResult() | ||
data object NoResult : CardFinishApproveOrderResult() | ||
} |
17 changes: 0 additions & 17 deletions
17
CardPayments/src/main/java/com/paypal/android/cardpayments/CardResult.kt
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
Oops, something went wrong.