-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add P24 confirm payment functionality for web integration
- Loading branch information
1 parent
9c2e704
commit ca7bd06
Showing
10 changed files
with
630 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_data.dart
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,34 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:stripe_js/stripe_api.dart'; | ||
|
||
part 'confirm_p24_payment_data.freezed.dart'; | ||
part 'confirm_p24_payment_data.g.dart'; | ||
|
||
@freezed | ||
class ConfirmP24PaymentData with _$ConfirmP24PaymentData { | ||
const factory ConfirmP24PaymentData({ | ||
/// Either the ID of an existing PaymentMethod, or an object containing | ||
/// data to create a PaymentMethod with. | ||
/// | ||
/// This is required to process the payment. If you already have a PaymentMethod | ||
/// attached to the PaymentIntent, you do not need to specify this field. | ||
/// | ||
/// See the official Stripe documentation for additional details: | ||
/// https://stripe.com/docs/payments/p24 | ||
@paymentMethodDetailJsonKey P24PaymentMethodDetails? paymentMethod, | ||
|
||
/// The url your customer will be directed to after they complete authentication. | ||
@JsonKey(name: "return_url") String? returnUrl, | ||
|
||
/// To set up a SEPA Direct Debit payment method using the bank details | ||
/// from this P24 payment, set this parameter to off_session. | ||
/// When using this parameter, a customer will need to be set on the | ||
/// PaymentIntent. The newly created SEPA Direct Debit PaymentMethod | ||
/// will be attached to this customer. | ||
@JsonKey(name: "setup_future_usage") | ||
PaymentIntentSetupFutureUsage? setupFutureUsage, | ||
}) = _ConfirmP24PaymentData; | ||
|
||
factory ConfirmP24PaymentData.fromJson(Map<String, dynamic> json) => | ||
_$ConfirmP24PaymentDataFromJson(json); | ||
} |
285 changes: 285 additions & 0 deletions
285
packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_data.freezed.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_data.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_options.dart
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,16 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'confirm_p24_payment_options.freezed.dart'; | ||
part 'confirm_p24_payment_options.g.dart'; | ||
|
||
@freezed | ||
class ConfirmP24PaymentOptions with _$ConfirmP24PaymentOptions { | ||
const factory ConfirmP24PaymentOptions({ | ||
/// Set this to false if you want to manually handle | ||
/// the authorization redirect. Default is true. | ||
@Default(true) bool? handleActions, | ||
}) = _ConfirmP24PaymentOptions; | ||
|
||
factory ConfirmP24PaymentOptions.fromJson(Map<String, dynamic> json) => | ||
_$ConfirmP24PaymentOptionsFromJson(json); | ||
} |
Oops, something went wrong.