Skip to content

Commit

Permalink
Add P24 confirm payment functionality for web integration (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeuszblanik authored Dec 22, 2024
1 parent a0f78f1 commit b76793a
Show file tree
Hide file tree
Showing 13 changed files with 1,168 additions and 59 deletions.
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';

Check warning on line 4 in packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_data.dart

View workflow job for this annotation

GitHub Actions / Typo CI

freezed

"freezed" is a typo. Did you mean "freezes"?
part 'confirm_p24_payment_data.g.dart';

@freezed

Check warning on line 7 in packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_data.dart

View workflow job for this annotation

GitHub Actions / Typo CI

freezed

"freezed" is a typo. Did you mean "freezes"?
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);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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';

Check warning on line 3 in packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_options.dart

View workflow job for this annotation

GitHub Actions / Typo CI

freezed

"freezed" is a typo. Did you mean "freezes"?
part 'confirm_p24_payment_options.g.dart';

@freezed

Check warning on line 6 in packages/stripe_js/lib/src/api/payment_intents/confirm_p24_payment_options.dart

View workflow job for this annotation

GitHub Actions / Typo CI

freezed

"freezed" is a typo. Did you mean "freezes"?
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);
}
Loading

0 comments on commit b76793a

Please sign in to comment.