-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Adyen/feature/improvePaymentResultClass
Feature/improve payment result class
- Loading branch information
Showing
4 changed files
with
68 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import 'package:adyen_checkout/adyen_checkout.dart'; | ||
|
||
class PaymentResult { | ||
final PaymentResultEnum type; | ||
final String? reason; | ||
final PaymentResultModel? result; | ||
sealed class PaymentResult {} | ||
|
||
class PaymentAdvancedFlowFinished extends PaymentResult { | ||
final String resultCode; | ||
|
||
PaymentResult( | ||
this.type, | ||
this.reason, | ||
this.result, | ||
); | ||
PaymentAdvancedFlowFinished({required this.resultCode}); | ||
} | ||
|
||
class PaymentResultModel { | ||
final String? sessionId; | ||
final String? sessionData; | ||
final String? resultCode; | ||
class PaymentSessionFinished extends PaymentResult { | ||
final String sessionId; | ||
final String sessionData; | ||
final String resultCode; | ||
final OrderResponse? order; | ||
|
||
PaymentResultModel( | ||
this.sessionId, | ||
this.sessionData, | ||
this.resultCode, | ||
PaymentSessionFinished({ | ||
required this.sessionId, | ||
required this.sessionData, | ||
required this.resultCode, | ||
this.order, | ||
); | ||
}); | ||
} | ||
|
||
class PaymentCancelledByUser extends PaymentResult {} | ||
|
||
class PaymentError extends PaymentResult { | ||
final String? reason; | ||
|
||
PaymentError({required this.reason}); | ||
} |
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