-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(POM-419): Dynamic Checkout lifecycle events (#233)
- Loading branch information
1 parent
7222ad9
commit 85950c8
Showing
11 changed files
with
455 additions
and
255 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
sdk/src/main/kotlin/com/processout/sdk/api/model/event/PODynamicCheckoutEvent.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,56 @@ | ||
package com.processout.sdk.api.model.event | ||
|
||
import com.processout.sdk.api.model.response.PODynamicCheckoutPaymentMethod | ||
import com.processout.sdk.core.ProcessOutResult | ||
|
||
/** | ||
* Defines dynamic checkout lifecycle events. | ||
*/ | ||
sealed class PODynamicCheckoutEvent { | ||
|
||
/** | ||
* Initial event that is sent prior any other event. | ||
*/ | ||
data object WillStart : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event indicates that initialization is complete. | ||
* Currently waiting for user input. | ||
*/ | ||
data object DidStart : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event is sent when user asked to confirm cancellation, e.g. via dialog. | ||
*/ | ||
data object DidRequestCancelConfirmation : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event is sent when payment method is selected by the user. | ||
*/ | ||
data class DidSelectPaymentMethod( | ||
val paymentMethod: PODynamicCheckoutPaymentMethod | ||
) : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event is sent when certain payment method has failed with retryable error. | ||
* User can provide different payment details or try another payment method. | ||
*/ | ||
data class DidFailPayment( | ||
val failure: ProcessOutResult.Failure, | ||
val paymentMethod: PODynamicCheckoutPaymentMethod | ||
) : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event is sent after payment was confirmed to be captured. This is a final event. | ||
*/ | ||
data class DidCompletePayment( | ||
val paymentMethod: PODynamicCheckoutPaymentMethod | ||
) : PODynamicCheckoutEvent() | ||
|
||
/** | ||
* Event is sent when unretryable error occurs. This is a final event. | ||
*/ | ||
data class DidFail( | ||
val failure: ProcessOutResult.Failure | ||
) : PODynamicCheckoutEvent() | ||
} |
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.