diff --git a/.vscode/launch.json b/.vscode/launch.json index 88dbcf186..0b6806fbf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,6 +10,16 @@ "request": "launch", "type": "dart", }, + { + "name": "example no web security", + "cwd": "example", + "request": "launch", + "type": "dart", + "args": [ + "--web-browser-flag", + "--disable-web-security", + ] + }, { "name": "Stripe.js web tests", "request": "launch", diff --git a/example/.gitignore b/example/.gitignore index ae3455efa..8becefafd 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -33,7 +33,6 @@ /build/ # Web related -lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols diff --git a/example/lib/screens/payment_sheet/payment_element/platforms/payment_element_web.dart b/example/lib/screens/payment_sheet/payment_element/platforms/payment_element_web.dart index a57d9060e..ca2bdcaea 100644 --- a/example/lib/screens/payment_sheet/payment_element/platforms/payment_element_web.dart +++ b/example/lib/screens/payment_sheet/payment_element/platforms/payment_element_web.dart @@ -1,7 +1,10 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_stripe_web/flutter_stripe_web.dart'; +import 'package:web/web.dart' as web; -import 'stripe_checkout_web.dart'; +String getUrlPort() => web.window.location.port; + +String getReturnUrl() => web.window.location.href; Future pay() async { await WebStripe.instance.confirmPaymentElement( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e1306647f..7367d849c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" dependencies: @@ -16,7 +16,7 @@ dependencies: http: ^1.1.0 font_awesome_flutter: ^10.6.0 platform: ^3.0.0 - + web: ^0.5.1 dev_dependencies: integration_test: diff --git a/packages/stripe_js/lib/src/api/converters/js_converter.dart b/packages/stripe_js/lib/src/api/converters/js_converter.dart index fa8fcae95..71369acf7 100644 --- a/packages/stripe_js/lib/src/api/converters/js_converter.dart +++ b/packages/stripe_js/lib/src/api/converters/js_converter.dart @@ -1,10 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stripe_js/stripe_api.dart'; -class ElementsConverter extends JSConverter { - const ElementsConverter(); -} - class JSConverter implements JsonConverter { const JSConverter(); @@ -15,6 +11,10 @@ class JSConverter implements JsonConverter { dynamic toJson(dynamic object) => object; } +class ElementsConverter extends JSConverter { + const ElementsConverter(); +} + class ElementConverter extends JSConverter { const ElementConverter(); } diff --git a/packages/stripe_js/lib/src/api/core/billing_details.freezed.dart b/packages/stripe_js/lib/src/api/core/billing_details.freezed.dart index 0c1a52c6c..ca25e3bac 100644 --- a/packages/stripe_js/lib/src/api/core/billing_details.freezed.dart +++ b/packages/stripe_js/lib/src/api/core/billing_details.freezed.dart @@ -12,7 +12,7 @@ part of 'billing_details.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); BillingDetails _$BillingDetailsFromJson(Map json) { return _BillingDetails.fromJson(json); @@ -183,7 +183,7 @@ class _$BillingDetailsImpl implements _BillingDetails { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BillingDetailsImpl && @@ -453,7 +453,7 @@ class _$PaymentElementBillingDetailsAddressImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsAddressImpl && diff --git a/packages/stripe_js/lib/src/api/core/error.freezed.dart b/packages/stripe_js/lib/src/api/core/error.freezed.dart index 794c150d7..6029a7071 100644 --- a/packages/stripe_js/lib/src/api/core/error.freezed.dart +++ b/packages/stripe_js/lib/src/api/core/error.freezed.dart @@ -12,7 +12,7 @@ part of 'error.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); StripeError _$StripeErrorFromJson(Map json) { return _PaymentElementChangeEvent.fromJson(json); @@ -206,7 +206,7 @@ class _$PaymentElementChangeEventImpl implements _PaymentElementChangeEvent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementChangeEventImpl && diff --git a/packages/stripe_js/lib/src/api/core/shipping_details.freezed.dart b/packages/stripe_js/lib/src/api/core/shipping_details.freezed.dart index 30c3ba084..5b176ca0c 100644 --- a/packages/stripe_js/lib/src/api/core/shipping_details.freezed.dart +++ b/packages/stripe_js/lib/src/api/core/shipping_details.freezed.dart @@ -12,7 +12,7 @@ part of 'shipping_details.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ShippingDetails _$ShippingDetailsFromJson(Map json) { return _PaymentElementChangeEvent.fromJson(json); @@ -220,7 +220,7 @@ class _$PaymentElementChangeEventImpl implements _PaymentElementChangeEvent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementChangeEventImpl && @@ -505,7 +505,7 @@ class _$PaymentElementBillingDetailsAddressImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsAddressImpl && diff --git a/packages/stripe_js/lib/src/api/elements/card_element_options.freezed.dart b/packages/stripe_js/lib/src/api/elements/card_element_options.freezed.dart index b3c0afbcf..c0505529c 100644 --- a/packages/stripe_js/lib/src/api/elements/card_element_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/card_element_options.freezed.dart @@ -12,7 +12,7 @@ part of 'card_element_options.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CardElementOptions _$CardElementOptionsFromJson(Map json) { return _CardElementOptions.fromJson(json); @@ -231,7 +231,7 @@ class _$CardElementOptionsImpl implements _CardElementOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardElementOptionsImpl && @@ -525,7 +525,7 @@ class _$CardElementClassesImpl implements _CardElementClasses { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardElementClassesImpl && diff --git a/packages/stripe_js/lib/src/api/elements/element.dart b/packages/stripe_js/lib/src/api/elements/element.dart index 9e078719c..a55750b85 100644 --- a/packages/stripe_js/lib/src/api/elements/element.dart +++ b/packages/stripe_js/lib/src/api/elements/element.dart @@ -1,3 +1,3 @@ -abstract class Element {} +extension type const Element._(Object o) implements Object {} -abstract class Elements {} +extension type const Elements._(Object o) implements Object {} diff --git a/packages/stripe_js/lib/src/api/elements/element_appearance.freezed.dart b/packages/stripe_js/lib/src/api/elements/element_appearance.freezed.dart index 8e0b70b25..b490ac041 100644 --- a/packages/stripe_js/lib/src/api/elements/element_appearance.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/element_appearance.freezed.dart @@ -12,7 +12,7 @@ part of 'element_appearance.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ElementAppearance _$ElementAppearanceFromJson(Map json) { return _ElementAppearance.fromJson(json); @@ -183,7 +183,7 @@ class _$ElementAppearanceImpl implements _ElementAppearance { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ElementAppearanceImpl && diff --git a/packages/stripe_js/lib/src/api/elements/payment_element_change_event.freezed.dart b/packages/stripe_js/lib/src/api/elements/payment_element_change_event.freezed.dart index 250624c7c..4fe7eed19 100644 --- a/packages/stripe_js/lib/src/api/elements/payment_element_change_event.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/payment_element_change_event.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_element_change_event.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); PaymentElementChangeEvent _$PaymentElementChangeEventFromJson( Map json) { @@ -202,7 +202,7 @@ class _$PaymentElementChangeEventImpl implements _PaymentElementChangeEvent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementChangeEventImpl && @@ -370,7 +370,7 @@ class _$PaymentElementChangeEventValueImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementChangeEventValueImpl && diff --git a/packages/stripe_js/lib/src/api/elements/payment_element_options.dart b/packages/stripe_js/lib/src/api/elements/payment_element_options.dart index 7ac747467..cc766611d 100644 --- a/packages/stripe_js/lib/src/api/elements/payment_element_options.dart +++ b/packages/stripe_js/lib/src/api/elements/payment_element_options.dart @@ -37,9 +37,10 @@ class PaymentElementOptions with _$PaymentElementOptions { /// be rejected. PaymentElementFields? fields, - dynamic readOnly, - dynamic terms, - dynamic wallets, + bool? readOnly, + PaymentElementOptionsTerms? terms, + PaymentElementWalletOptions? wallets, + PaymentElementApplePayOptions? applePay, }) = _PaymentElementOptions; factory PaymentElementOptions.fromJson(Map json) => @@ -78,6 +79,12 @@ class PaymentElementLayout with _$PaymentElementLayout { /// with space in between them. /// This property is only applicable to the accordion layout. bool? spacedAccordionItems, + + /// Sets the max number of Payment Methods visible before using the "More" + /// button to hide additional Payment Methods. Set this value to 0 to + /// disable the "More" button and render all available Payment Methods. + /// Default is 5. This property is only applicable to the accordion layout. + int? visibleAccordionItemsCount, }) = _PaymentElementLayout; static const tabs = PaymentElementLayout(type: PaymentElementLayoutType.tabs); static const accordion = @@ -96,12 +103,78 @@ class PaymentElementDefaultValues with _$PaymentElementDefaultValues { /// Pre-filling as much information as possible streamlines /// the checkout process. PaymentElementBillingDetails? billingDetails, + + /// Specify customer's default information for different payment methods. + /// Pre-filling as much information as possible streamlines the checkout process. + PaymentElementPaymentMethodDefaults? paymentMethods, }) = _PaymentElementDefaultValues; factory PaymentElementDefaultValues.fromJson(Map json) => _$PaymentElementDefaultValuesFromJson(json); } +@freezed +class PaymentElementPaymentMethodDefaults + with _$PaymentElementPaymentMethodDefaults { + const factory PaymentElementPaymentMethodDefaults({ + /// Defaults for ideal + PaymentElementIdealDefaults? ideal, + + /// Defaults for card payment method + PaymentElementCardDefaults? card, + }) = _PaymentElementPaymentMethodDefaults; + + factory PaymentElementPaymentMethodDefaults.fromJson( + Map json) => + _$PaymentElementPaymentMethodDefaultsFromJson(json); +} + +@freezed + +/// By default, the Payment Element will display all the payment methods that the underlying Payment Intent was created with. +/// However, wallets like Apple Pay and Google Pay are not payment methods per the Payment Intent API. They will show when the Payment Intent has the card payment method and the customer is using a supported platform and have an active card in their account. +/// This is the auto behavior, and it is the default for choice for all wallets. +/// If you do not want to show a given wallet as a payment option, you can set its property in wallets to never. +class PaymentElementWalletOptions with _$PaymentElementWalletOptions { + const factory PaymentElementWalletOptions({ + /// Apple pay required options + PaymentElementFieldRequired? applePay, + + /// Google pay required options + PaymentElementFieldRequired? googlePay, + }) = _PaymentElementWalletOptions; + + factory PaymentElementWalletOptions.fromJson(Map json) => + _$PaymentElementWalletOptionsFromJson(json); +} + +@freezed +class PaymentElementIdealDefaults with _$PaymentElementIdealDefaults { + const factory PaymentElementIdealDefaults({ + /// The customer’s bank name. + /// + /// See https://docs.stripe.com/payments/ideal/accept-a-payment?ui=element#bank-reference + /// for all options. + String? bank, + }) = _PaymentElementIdealDefaults; + + factory PaymentElementIdealDefaults.fromJson(Map json) => + _$PaymentElementIdealDefaultsFromJson(json); +} + +@freezed +class PaymentElementCardDefaults with _$PaymentElementCardDefaults { + const factory PaymentElementCardDefaults({ + /// The specified network prferences for card brand choice. The first network in the array + /// that matches a network on the enetered cobranded card will be selected by default + /// in the card brand choice. + List? network, + }) = _PaymentElementCardDefaults; + + factory PaymentElementCardDefaults.fromJson(Map json) => + _$PaymentElementCardDefaultsFromJson(json); +} + @freezed class PaymentElementBillingDetails with _$PaymentElementBillingDetails { const factory PaymentElementBillingDetails({ @@ -155,6 +228,8 @@ class PaymentElementBusiness with _$PaymentElementBusiness { enum PaymentElementFieldRequired { never, auto } +enum PaymentElementShowTerms { never, auto, always } + @freezed class PaymentElementFields with _$PaymentElementFields { const factory PaymentElementFields({ @@ -210,3 +285,203 @@ class PaymentElementAddressFields with _$PaymentElementAddressFields { factory PaymentElementAddressFields.fromJson(Map json) => _$PaymentElementAddressFieldsFromJson(json); } + +@freezed + +///Control how mandates or other legal agreements are displayed in the Payment Element. +/// The default setting is auto, which causes legal agreements to only be shown when necessary. +class PaymentElementOptionsTerms with _$PaymentElementOptionsTerms { + const factory PaymentElementOptionsTerms({ + /// Terms for apple pay + PaymentElementShowTerms? applePay, + + /// Terms for aubecs debit + PaymentElementShowTerms? auBecsDebit, + + /// Terms for bancontact + PaymentElementShowTerms? bancontact, + + /// Terms for card + PaymentElementShowTerms? card, + + /// Terms for cashapp + PaymentElementShowTerms? cashApp, + + /// Terms for googlePay + PaymentElementShowTerms? googlePay, + + /// Terms for ideal + PaymentElementShowTerms? ideal, + + /// Terms for paypal + PaymentElementShowTerms? payPal, + + /// Terms for sepa debit + PaymentElementShowTerms? sepaDebit, + + /// Terms for sofort + PaymentElementShowTerms? sofort, + + /// Terms for usBankAccount + PaymentElementShowTerms? usBankAccount, + }) = _PaymentElementOptionsTerms; + + factory PaymentElementOptionsTerms.fromJson(Map json) => + _$PaymentElementOptionsTermsFromJson(json); +} + +@freezed +class PaymentElementApplePayOptions with _$PaymentElementApplePayOptions { + const factory PaymentElementApplePayOptions({ + /// Information about a recurring payment with ApplePay + PaymentElementAppleRecurringRequest? recurringPaymentRequest, + + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest, + + /// Information about an auto reload payment with ApplePay + PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest, + }) = _PaymentElementApplePayOptions; + + factory PaymentElementApplePayOptions.fromJson(Map json) => + _$PaymentElementApplePayOptionsFromJson(json); +} + +@freezed +class PaymentElementAppleRecurringRequest + with _$PaymentElementAppleRecurringRequest { + const factory PaymentElementAppleRecurringRequest({ + /// The description of the payment + required String paymentDescription, + + /// Management url + required String managementUrl, + + /// Information in case of a trial billing + PaymentElementRecurringPaymentProperties? trialBilling, + + /// Information in case of a regular billing + PaymentElementRecurringPaymentProperties? regularBilling, + }) = _PaymentElementAppleRecurringRequest; + + factory PaymentElementAppleRecurringRequest.fromJson( + Map json) => + _$PaymentElementAppleRecurringRequestFromJson(json); +} + +@freezed +class PaymentElementRecurringPaymentProperties + with _$PaymentElementRecurringPaymentProperties { + const factory PaymentElementRecurringPaymentProperties({ + /// The amount of the payment + required double amount, + + /// Description label + required String label, + + /// The startdate of the recurring payment + DateTime? recurringPaymentStartDate, + + /// The enddate of the recurring payment + DateTime? recurringPaymentEndDate, + + /// The interval of payment + ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, + + /// The amount of intervals + int? recurringPaymentIntervalCount, + }) = _PaymentElementRecurringPaymentProperties; + + factory PaymentElementRecurringPaymentProperties.fromJson( + Map json) => + _$PaymentElementRecurringPaymentPropertiesFromJson(json); +} + +@freezed +class PaymentElementApplePayDeferredPaymentRequest + with _$PaymentElementApplePayDeferredPaymentRequest { + const factory PaymentElementApplePayDeferredPaymentRequest({ + /// The description of the payment + required String paymentDescription, + + /// Management url + required String managementUrl, + + /// Billing agreement label + String? billingAgreement, + + /// The date when you can cancel for free + DateTime? freeCancellationDate, + + /// The timezone of the free cancellation date + String? freeCancellationTimezone, + + /// Billing information of the deffered payment + required PaymentElementApplePayDeferredPaymentProperties deferredBilling, + }) = _PaymentElementApplePayDeferredPaymentRequest; + + factory PaymentElementApplePayDeferredPaymentRequest.fromJson( + Map json) => + _$PaymentElementApplePayDeferredPaymentRequestFromJson(json); +} + +@freezed +class PaymentElementApplePayDeferredPaymentProperties + with _$PaymentElementApplePayDeferredPaymentProperties { + const factory PaymentElementApplePayDeferredPaymentProperties({ + /// The amount of the payment + required double amount, + + /// Description label + required String label, + + /// The date when the payment will be processed + required DateTime deferredPaymentDate, + }) = _PaymentElementApplePayDeferredPaymentProperties; + + factory PaymentElementApplePayDeferredPaymentProperties.fromJson( + Map json) => + _$PaymentElementApplePayDeferredPaymentPropertiesFromJson(json); +} + +@freezed +class PaymentElementApplePayAutoReloadPaymentRequest + with _$PaymentElementApplePayAutoReloadPaymentRequest { + const factory PaymentElementApplePayAutoReloadPaymentRequest({ + /// The description of the payment + required String paymentDescription, + + /// Management url + required String managementUrl, + + /// Billing information of the deffered payment + required PaymentElementApplePayReloadPaymentProperties + automaticReloadBilling, + }) = _PaymentElementApplePayAutoReloadPaymentRequest; + + factory PaymentElementApplePayAutoReloadPaymentRequest.fromJson( + Map json) => + _$PaymentElementApplePayAutoReloadPaymentRequestFromJson(json); +} + +@freezed +class PaymentElementApplePayReloadPaymentProperties + with _$PaymentElementApplePayReloadPaymentProperties { + const factory PaymentElementApplePayReloadPaymentProperties({ + /// The amount of the payment + required double amount, + + /// Description label + required String label, + + /// The date when the threshold amount will be reached + required DateTime automaticReloadPaymentThresholdAmount, + }) = _PaymentElementApplePayReloadPaymentProperties; + + factory PaymentElementApplePayReloadPaymentProperties.fromJson( + Map json) => + _$PaymentElementApplePayReloadPaymentPropertiesFromJson(json); +} + +enum ApplePayRecurringPaymentTimeInterVal { year, month, day, hour, minute } diff --git a/packages/stripe_js/lib/src/api/elements/payment_element_options.freezed.dart b/packages/stripe_js/lib/src/api/elements/payment_element_options.freezed.dart index 375fdaf79..990cd0394 100644 --- a/packages/stripe_js/lib/src/api/elements/payment_element_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/payment_element_options.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_element_options.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); PaymentElementOptions _$PaymentElementOptionsFromJson( Map json) { @@ -50,9 +50,12 @@ mixin _$PaymentElementOptions { /// you must pass that same data to stripe.confirmPayment or the payment will /// be rejected. PaymentElementFields? get fields => throw _privateConstructorUsedError; - dynamic get readOnly => throw _privateConstructorUsedError; - dynamic get terms => throw _privateConstructorUsedError; - dynamic get wallets => throw _privateConstructorUsedError; + bool? get readOnly => throw _privateConstructorUsedError; + PaymentElementOptionsTerms? get terms => throw _privateConstructorUsedError; + PaymentElementWalletOptions? get wallets => + throw _privateConstructorUsedError; + PaymentElementApplePayOptions? get applePay => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -72,14 +75,18 @@ abstract class $PaymentElementOptionsCopyWith<$Res> { PaymentElementBusiness? business, dynamic paymentMethodOrder, PaymentElementFields? fields, - dynamic readOnly, - dynamic terms, - dynamic wallets}); + bool? readOnly, + PaymentElementOptionsTerms? terms, + PaymentElementWalletOptions? wallets, + PaymentElementApplePayOptions? applePay}); $PaymentElementLayoutCopyWith<$Res>? get layout; $PaymentElementDefaultValuesCopyWith<$Res>? get defaultValues; $PaymentElementBusinessCopyWith<$Res>? get business; $PaymentElementFieldsCopyWith<$Res>? get fields; + $PaymentElementOptionsTermsCopyWith<$Res>? get terms; + $PaymentElementWalletOptionsCopyWith<$Res>? get wallets; + $PaymentElementApplePayOptionsCopyWith<$Res>? get applePay; } /// @nodoc @@ -104,6 +111,7 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, Object? readOnly = freezed, Object? terms = freezed, Object? wallets = freezed, + Object? applePay = freezed, }) { return _then(_value.copyWith( layout: freezed == layout @@ -129,15 +137,19 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, readOnly: freezed == readOnly ? _value.readOnly : readOnly // ignore: cast_nullable_to_non_nullable - as dynamic, + as bool?, terms: freezed == terms ? _value.terms : terms // ignore: cast_nullable_to_non_nullable - as dynamic, + as PaymentElementOptionsTerms?, wallets: freezed == wallets ? _value.wallets : wallets // ignore: cast_nullable_to_non_nullable - as dynamic, + as PaymentElementWalletOptions?, + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayOptions?, ) as $Val); } @@ -189,6 +201,43 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, return _then(_value.copyWith(fields: value) as $Val); }); } + + @override + @pragma('vm:prefer-inline') + $PaymentElementOptionsTermsCopyWith<$Res>? get terms { + if (_value.terms == null) { + return null; + } + + return $PaymentElementOptionsTermsCopyWith<$Res>(_value.terms!, (value) { + return _then(_value.copyWith(terms: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementWalletOptionsCopyWith<$Res>? get wallets { + if (_value.wallets == null) { + return null; + } + + return $PaymentElementWalletOptionsCopyWith<$Res>(_value.wallets!, (value) { + return _then(_value.copyWith(wallets: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementApplePayOptionsCopyWith<$Res>? get applePay { + if (_value.applePay == null) { + return null; + } + + return $PaymentElementApplePayOptionsCopyWith<$Res>(_value.applePay!, + (value) { + return _then(_value.copyWith(applePay: value) as $Val); + }); + } } /// @nodoc @@ -206,9 +255,10 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> PaymentElementBusiness? business, dynamic paymentMethodOrder, PaymentElementFields? fields, - dynamic readOnly, - dynamic terms, - dynamic wallets}); + bool? readOnly, + PaymentElementOptionsTerms? terms, + PaymentElementWalletOptions? wallets, + PaymentElementApplePayOptions? applePay}); @override $PaymentElementLayoutCopyWith<$Res>? get layout; @@ -218,6 +268,12 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> $PaymentElementBusinessCopyWith<$Res>? get business; @override $PaymentElementFieldsCopyWith<$Res>? get fields; + @override + $PaymentElementOptionsTermsCopyWith<$Res>? get terms; + @override + $PaymentElementWalletOptionsCopyWith<$Res>? get wallets; + @override + $PaymentElementApplePayOptionsCopyWith<$Res>? get applePay; } /// @nodoc @@ -240,6 +296,7 @@ class __$$PaymentElementOptionsImplCopyWithImpl<$Res> Object? readOnly = freezed, Object? terms = freezed, Object? wallets = freezed, + Object? applePay = freezed, }) { return _then(_$PaymentElementOptionsImpl( layout: freezed == layout @@ -265,15 +322,19 @@ class __$$PaymentElementOptionsImplCopyWithImpl<$Res> readOnly: freezed == readOnly ? _value.readOnly : readOnly // ignore: cast_nullable_to_non_nullable - as dynamic, + as bool?, terms: freezed == terms ? _value.terms : terms // ignore: cast_nullable_to_non_nullable - as dynamic, + as PaymentElementOptionsTerms?, wallets: freezed == wallets ? _value.wallets : wallets // ignore: cast_nullable_to_non_nullable - as dynamic, + as PaymentElementWalletOptions?, + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayOptions?, )); } } @@ -289,7 +350,8 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { this.fields, this.readOnly, this.terms, - this.wallets}); + this.wallets, + this.applePay}); factory _$PaymentElementOptionsImpl.fromJson(Map json) => _$$PaymentElementOptionsImplFromJson(json); @@ -328,19 +390,21 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { @override final PaymentElementFields? fields; @override - final dynamic readOnly; + final bool? readOnly; @override - final dynamic terms; + final PaymentElementOptionsTerms? terms; @override - final dynamic wallets; + final PaymentElementWalletOptions? wallets; + @override + final PaymentElementApplePayOptions? applePay; @override String toString() { - return 'PaymentElementOptions(layout: $layout, defaultValues: $defaultValues, business: $business, paymentMethodOrder: $paymentMethodOrder, fields: $fields, readOnly: $readOnly, terms: $terms, wallets: $wallets)'; + return 'PaymentElementOptions(layout: $layout, defaultValues: $defaultValues, business: $business, paymentMethodOrder: $paymentMethodOrder, fields: $fields, readOnly: $readOnly, terms: $terms, wallets: $wallets, applePay: $applePay)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementOptionsImpl && @@ -352,9 +416,12 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { const DeepCollectionEquality() .equals(other.paymentMethodOrder, paymentMethodOrder) && (identical(other.fields, fields) || other.fields == fields) && - const DeepCollectionEquality().equals(other.readOnly, readOnly) && - const DeepCollectionEquality().equals(other.terms, terms) && - const DeepCollectionEquality().equals(other.wallets, wallets)); + (identical(other.readOnly, readOnly) || + other.readOnly == readOnly) && + (identical(other.terms, terms) || other.terms == terms) && + (identical(other.wallets, wallets) || other.wallets == wallets) && + (identical(other.applePay, applePay) || + other.applePay == applePay)); } @JsonKey(ignore: true) @@ -366,9 +433,10 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { business, const DeepCollectionEquality().hash(paymentMethodOrder), fields, - const DeepCollectionEquality().hash(readOnly), - const DeepCollectionEquality().hash(terms), - const DeepCollectionEquality().hash(wallets)); + readOnly, + terms, + wallets, + applePay); @JsonKey(ignore: true) @override @@ -387,14 +455,16 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { abstract class _PaymentElementOptions implements PaymentElementOptions { const factory _PaymentElementOptions( - {final PaymentElementLayout? layout, - final PaymentElementDefaultValues? defaultValues, - final PaymentElementBusiness? business, - final dynamic paymentMethodOrder, - final PaymentElementFields? fields, - final dynamic readOnly, - final dynamic terms, - final dynamic wallets}) = _$PaymentElementOptionsImpl; + {final PaymentElementLayout? layout, + final PaymentElementDefaultValues? defaultValues, + final PaymentElementBusiness? business, + final dynamic paymentMethodOrder, + final PaymentElementFields? fields, + final bool? readOnly, + final PaymentElementOptionsTerms? terms, + final PaymentElementWalletOptions? wallets, + final PaymentElementApplePayOptions? applePay}) = + _$PaymentElementOptionsImpl; factory _PaymentElementOptions.fromJson(Map json) = _$PaymentElementOptionsImpl.fromJson; @@ -433,11 +503,13 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { /// be rejected. PaymentElementFields? get fields; @override - dynamic get readOnly; + bool? get readOnly; + @override + PaymentElementOptionsTerms? get terms; @override - dynamic get terms; + PaymentElementWalletOptions? get wallets; @override - dynamic get wallets; + PaymentElementApplePayOptions? get applePay; @override @JsonKey(ignore: true) _$$PaymentElementOptionsImplCopyWith<_$PaymentElementOptionsImpl> @@ -472,6 +544,12 @@ mixin _$PaymentElementLayout { /// This property is only applicable to the accordion layout. bool? get spacedAccordionItems => throw _privateConstructorUsedError; + /// Sets the max number of Payment Methods visible before using the "More" + /// button to hide additional Payment Methods. Set this value to 0 to + /// disable the "More" button and render all available Payment Methods. + /// Default is 5. This property is only applicable to the accordion layout. + int? get visibleAccordionItemsCount => throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $PaymentElementLayoutCopyWith get copyWith => @@ -488,7 +566,8 @@ abstract class $PaymentElementLayoutCopyWith<$Res> { {PaymentElementLayoutType type, bool? defaultCollapsed, bool? radios, - bool? spacedAccordionItems}); + bool? spacedAccordionItems, + int? visibleAccordionItemsCount}); } /// @nodoc @@ -509,6 +588,7 @@ class _$PaymentElementLayoutCopyWithImpl<$Res, Object? defaultCollapsed = freezed, Object? radios = freezed, Object? spacedAccordionItems = freezed, + Object? visibleAccordionItemsCount = freezed, }) { return _then(_value.copyWith( type: null == type @@ -527,6 +607,10 @@ class _$PaymentElementLayoutCopyWithImpl<$Res, ? _value.spacedAccordionItems : spacedAccordionItems // ignore: cast_nullable_to_non_nullable as bool?, + visibleAccordionItemsCount: freezed == visibleAccordionItemsCount + ? _value.visibleAccordionItemsCount + : visibleAccordionItemsCount // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } } @@ -543,7 +627,8 @@ abstract class _$$PaymentElementLayoutImplCopyWith<$Res> {PaymentElementLayoutType type, bool? defaultCollapsed, bool? radios, - bool? spacedAccordionItems}); + bool? spacedAccordionItems, + int? visibleAccordionItemsCount}); } /// @nodoc @@ -561,6 +646,7 @@ class __$$PaymentElementLayoutImplCopyWithImpl<$Res> Object? defaultCollapsed = freezed, Object? radios = freezed, Object? spacedAccordionItems = freezed, + Object? visibleAccordionItemsCount = freezed, }) { return _then(_$PaymentElementLayoutImpl( type: null == type @@ -579,6 +665,10 @@ class __$$PaymentElementLayoutImplCopyWithImpl<$Res> ? _value.spacedAccordionItems : spacedAccordionItems // ignore: cast_nullable_to_non_nullable as bool?, + visibleAccordionItemsCount: freezed == visibleAccordionItemsCount + ? _value.visibleAccordionItemsCount + : visibleAccordionItemsCount // ignore: cast_nullable_to_non_nullable + as int?, )); } } @@ -590,7 +680,8 @@ class _$PaymentElementLayoutImpl implements _PaymentElementLayout { {required this.type, this.defaultCollapsed, this.radios, - this.spacedAccordionItems}); + this.spacedAccordionItems, + this.visibleAccordionItemsCount}); factory _$PaymentElementLayoutImpl.fromJson(Map json) => _$$PaymentElementLayoutImplFromJson(json); @@ -621,13 +712,20 @@ class _$PaymentElementLayoutImpl implements _PaymentElementLayout { @override final bool? spacedAccordionItems; + /// Sets the max number of Payment Methods visible before using the "More" + /// button to hide additional Payment Methods. Set this value to 0 to + /// disable the "More" button and render all available Payment Methods. + /// Default is 5. This property is only applicable to the accordion layout. + @override + final int? visibleAccordionItemsCount; + @override String toString() { - return 'PaymentElementLayout(type: $type, defaultCollapsed: $defaultCollapsed, radios: $radios, spacedAccordionItems: $spacedAccordionItems)'; + return 'PaymentElementLayout(type: $type, defaultCollapsed: $defaultCollapsed, radios: $radios, spacedAccordionItems: $spacedAccordionItems, visibleAccordionItemsCount: $visibleAccordionItemsCount)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementLayoutImpl && @@ -636,13 +734,17 @@ class _$PaymentElementLayoutImpl implements _PaymentElementLayout { other.defaultCollapsed == defaultCollapsed) && (identical(other.radios, radios) || other.radios == radios) && (identical(other.spacedAccordionItems, spacedAccordionItems) || - other.spacedAccordionItems == spacedAccordionItems)); + other.spacedAccordionItems == spacedAccordionItems) && + (identical(other.visibleAccordionItemsCount, + visibleAccordionItemsCount) || + other.visibleAccordionItemsCount == + visibleAccordionItemsCount)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, type, defaultCollapsed, radios, spacedAccordionItems); + int get hashCode => Object.hash(runtimeType, type, defaultCollapsed, radios, + spacedAccordionItems, visibleAccordionItemsCount); @JsonKey(ignore: true) @override @@ -665,7 +767,8 @@ abstract class _PaymentElementLayout implements PaymentElementLayout { {required final PaymentElementLayoutType type, final bool? defaultCollapsed, final bool? radios, - final bool? spacedAccordionItems}) = _$PaymentElementLayoutImpl; + final bool? spacedAccordionItems, + final int? visibleAccordionItemsCount}) = _$PaymentElementLayoutImpl; factory _PaymentElementLayout.fromJson(Map json) = _$PaymentElementLayoutImpl.fromJson; @@ -697,6 +800,13 @@ abstract class _PaymentElementLayout implements PaymentElementLayout { /// This property is only applicable to the accordion layout. bool? get spacedAccordionItems; @override + + /// Sets the max number of Payment Methods visible before using the "More" + /// button to hide additional Payment Methods. Set this value to 0 to + /// disable the "More" button and render all available Payment Methods. + /// Default is 5. This property is only applicable to the accordion layout. + int? get visibleAccordionItemsCount; + @override @JsonKey(ignore: true) _$$PaymentElementLayoutImplCopyWith<_$PaymentElementLayoutImpl> get copyWith => throw _privateConstructorUsedError; @@ -717,6 +827,11 @@ mixin _$PaymentElementDefaultValues { PaymentElementBillingDetails? get billingDetails => throw _privateConstructorUsedError; + /// Specify customer's default information for different payment methods. + /// Pre-filling as much information as possible streamlines the checkout process. + PaymentElementPaymentMethodDefaults? get paymentMethods => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $PaymentElementDefaultValuesCopyWith @@ -731,9 +846,12 @@ abstract class $PaymentElementDefaultValuesCopyWith<$Res> { _$PaymentElementDefaultValuesCopyWithImpl<$Res, PaymentElementDefaultValues>; @useResult - $Res call({PaymentElementBillingDetails? billingDetails}); + $Res call( + {PaymentElementBillingDetails? billingDetails, + PaymentElementPaymentMethodDefaults? paymentMethods}); $PaymentElementBillingDetailsCopyWith<$Res>? get billingDetails; + $PaymentElementPaymentMethodDefaultsCopyWith<$Res>? get paymentMethods; } /// @nodoc @@ -751,12 +869,17 @@ class _$PaymentElementDefaultValuesCopyWithImpl<$Res, @override $Res call({ Object? billingDetails = freezed, + Object? paymentMethods = freezed, }) { return _then(_value.copyWith( billingDetails: freezed == billingDetails ? _value.billingDetails : billingDetails // ignore: cast_nullable_to_non_nullable as PaymentElementBillingDetails?, + paymentMethods: freezed == paymentMethods + ? _value.paymentMethods + : paymentMethods // ignore: cast_nullable_to_non_nullable + as PaymentElementPaymentMethodDefaults?, ) as $Val); } @@ -772,6 +895,19 @@ class _$PaymentElementDefaultValuesCopyWithImpl<$Res, return _then(_value.copyWith(billingDetails: value) as $Val); }); } + + @override + @pragma('vm:prefer-inline') + $PaymentElementPaymentMethodDefaultsCopyWith<$Res>? get paymentMethods { + if (_value.paymentMethods == null) { + return null; + } + + return $PaymentElementPaymentMethodDefaultsCopyWith<$Res>( + _value.paymentMethods!, (value) { + return _then(_value.copyWith(paymentMethods: value) as $Val); + }); + } } /// @nodoc @@ -783,10 +919,14 @@ abstract class _$$PaymentElementDefaultValuesImplCopyWith<$Res> __$$PaymentElementDefaultValuesImplCopyWithImpl<$Res>; @override @useResult - $Res call({PaymentElementBillingDetails? billingDetails}); + $Res call( + {PaymentElementBillingDetails? billingDetails, + PaymentElementPaymentMethodDefaults? paymentMethods}); @override $PaymentElementBillingDetailsCopyWith<$Res>? get billingDetails; + @override + $PaymentElementPaymentMethodDefaultsCopyWith<$Res>? get paymentMethods; } /// @nodoc @@ -803,12 +943,17 @@ class __$$PaymentElementDefaultValuesImplCopyWithImpl<$Res> @override $Res call({ Object? billingDetails = freezed, + Object? paymentMethods = freezed, }) { return _then(_$PaymentElementDefaultValuesImpl( billingDetails: freezed == billingDetails ? _value.billingDetails : billingDetails // ignore: cast_nullable_to_non_nullable as PaymentElementBillingDetails?, + paymentMethods: freezed == paymentMethods + ? _value.paymentMethods + : paymentMethods // ignore: cast_nullable_to_non_nullable + as PaymentElementPaymentMethodDefaults?, )); } } @@ -817,7 +962,8 @@ class __$$PaymentElementDefaultValuesImplCopyWithImpl<$Res> @JsonSerializable() class _$PaymentElementDefaultValuesImpl implements _PaymentElementDefaultValues { - const _$PaymentElementDefaultValuesImpl({this.billingDetails}); + const _$PaymentElementDefaultValuesImpl( + {this.billingDetails, this.paymentMethods}); factory _$PaymentElementDefaultValuesImpl.fromJson( Map json) => @@ -831,23 +977,30 @@ class _$PaymentElementDefaultValuesImpl @override final PaymentElementBillingDetails? billingDetails; + /// Specify customer's default information for different payment methods. + /// Pre-filling as much information as possible streamlines the checkout process. + @override + final PaymentElementPaymentMethodDefaults? paymentMethods; + @override String toString() { - return 'PaymentElementDefaultValues(billingDetails: $billingDetails)'; + return 'PaymentElementDefaultValues(billingDetails: $billingDetails, paymentMethods: $paymentMethods)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementDefaultValuesImpl && (identical(other.billingDetails, billingDetails) || - other.billingDetails == billingDetails)); + other.billingDetails == billingDetails) && + (identical(other.paymentMethods, paymentMethods) || + other.paymentMethods == paymentMethods)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, billingDetails); + int get hashCode => Object.hash(runtimeType, billingDetails, paymentMethods); @JsonKey(ignore: true) @override @@ -867,7 +1020,8 @@ class _$PaymentElementDefaultValuesImpl abstract class _PaymentElementDefaultValues implements PaymentElementDefaultValues { const factory _PaymentElementDefaultValues( - {final PaymentElementBillingDetails? billingDetails}) = + {final PaymentElementBillingDetails? billingDetails, + final PaymentElementPaymentMethodDefaults? paymentMethods}) = _$PaymentElementDefaultValuesImpl; factory _PaymentElementDefaultValues.fromJson(Map json) = @@ -882,52 +1036,56 @@ abstract class _PaymentElementDefaultValues /// the checkout process. PaymentElementBillingDetails? get billingDetails; @override + + /// Specify customer's default information for different payment methods. + /// Pre-filling as much information as possible streamlines the checkout process. + PaymentElementPaymentMethodDefaults? get paymentMethods; + @override @JsonKey(ignore: true) _$$PaymentElementDefaultValuesImplCopyWith<_$PaymentElementDefaultValuesImpl> get copyWith => throw _privateConstructorUsedError; } -PaymentElementBillingDetails _$PaymentElementBillingDetailsFromJson( - Map json) { - return _PaymentElementBillingDetails.fromJson(json); +PaymentElementPaymentMethodDefaults + _$PaymentElementPaymentMethodDefaultsFromJson(Map json) { + return _PaymentElementPaymentMethodDefaults.fromJson(json); } /// @nodoc -mixin _$PaymentElementBillingDetails { - String? get name => throw _privateConstructorUsedError; - String? get email => throw _privateConstructorUsedError; - String? get phone => throw _privateConstructorUsedError; - PaymentElementBillingDetailsAddress? get address => - throw _privateConstructorUsedError; +mixin _$PaymentElementPaymentMethodDefaults { + /// Defaults for ideal + PaymentElementIdealDefaults? get ideal => throw _privateConstructorUsedError; + + /// Defaults for card payment method + PaymentElementCardDefaults? get card => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PaymentElementBillingDetailsCopyWith + $PaymentElementPaymentMethodDefaultsCopyWith< + PaymentElementPaymentMethodDefaults> get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PaymentElementBillingDetailsCopyWith<$Res> { - factory $PaymentElementBillingDetailsCopyWith( - PaymentElementBillingDetails value, - $Res Function(PaymentElementBillingDetails) then) = - _$PaymentElementBillingDetailsCopyWithImpl<$Res, - PaymentElementBillingDetails>; +abstract class $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + factory $PaymentElementPaymentMethodDefaultsCopyWith( + PaymentElementPaymentMethodDefaults value, + $Res Function(PaymentElementPaymentMethodDefaults) then) = + _$PaymentElementPaymentMethodDefaultsCopyWithImpl<$Res, + PaymentElementPaymentMethodDefaults>; @useResult $Res call( - {String? name, - String? email, - String? phone, - PaymentElementBillingDetailsAddress? address}); + {PaymentElementIdealDefaults? ideal, PaymentElementCardDefaults? card}); - $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address; + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal; + $PaymentElementCardDefaultsCopyWith<$Res>? get card; } /// @nodoc -class _$PaymentElementBillingDetailsCopyWithImpl<$Res, - $Val extends PaymentElementBillingDetails> - implements $PaymentElementBillingDetailsCopyWith<$Res> { - _$PaymentElementBillingDetailsCopyWithImpl(this._value, this._then); +class _$PaymentElementPaymentMethodDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementPaymentMethodDefaults> + implements $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + _$PaymentElementPaymentMethodDefaultsCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -937,241 +1095,210 @@ class _$PaymentElementBillingDetailsCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, - Object? email = freezed, - Object? phone = freezed, - Object? address = freezed, + Object? ideal = freezed, + Object? card = freezed, }) { return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - email: freezed == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String?, - phone: freezed == phone - ? _value.phone - : phone // ignore: cast_nullable_to_non_nullable - as String?, - address: freezed == address - ? _value.address - : address // ignore: cast_nullable_to_non_nullable - as PaymentElementBillingDetailsAddress?, + ideal: freezed == ideal + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as PaymentElementIdealDefaults?, + card: freezed == card + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as PaymentElementCardDefaults?, ) as $Val); } @override @pragma('vm:prefer-inline') - $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address { - if (_value.address == null) { + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal { + if (_value.ideal == null) { return null; } - return $PaymentElementBillingDetailsAddressCopyWith<$Res>(_value.address!, - (value) { - return _then(_value.copyWith(address: value) as $Val); + return $PaymentElementIdealDefaultsCopyWith<$Res>(_value.ideal!, (value) { + return _then(_value.copyWith(ideal: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementCardDefaultsCopyWith<$Res>? get card { + if (_value.card == null) { + return null; + } + + return $PaymentElementCardDefaultsCopyWith<$Res>(_value.card!, (value) { + return _then(_value.copyWith(card: value) as $Val); }); } } /// @nodoc -abstract class _$$PaymentElementBillingDetailsImplCopyWith<$Res> - implements $PaymentElementBillingDetailsCopyWith<$Res> { - factory _$$PaymentElementBillingDetailsImplCopyWith( - _$PaymentElementBillingDetailsImpl value, - $Res Function(_$PaymentElementBillingDetailsImpl) then) = - __$$PaymentElementBillingDetailsImplCopyWithImpl<$Res>; +abstract class _$$PaymentElementPaymentMethodDefaultsImplCopyWith<$Res> + implements $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + factory _$$PaymentElementPaymentMethodDefaultsImplCopyWith( + _$PaymentElementPaymentMethodDefaultsImpl value, + $Res Function(_$PaymentElementPaymentMethodDefaultsImpl) then) = + __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl<$Res>; @override @useResult $Res call( - {String? name, - String? email, - String? phone, - PaymentElementBillingDetailsAddress? address}); + {PaymentElementIdealDefaults? ideal, PaymentElementCardDefaults? card}); @override - $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address; + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal; + @override + $PaymentElementCardDefaultsCopyWith<$Res>? get card; } /// @nodoc -class __$$PaymentElementBillingDetailsImplCopyWithImpl<$Res> - extends _$PaymentElementBillingDetailsCopyWithImpl<$Res, - _$PaymentElementBillingDetailsImpl> - implements _$$PaymentElementBillingDetailsImplCopyWith<$Res> { - __$$PaymentElementBillingDetailsImplCopyWithImpl( - _$PaymentElementBillingDetailsImpl _value, - $Res Function(_$PaymentElementBillingDetailsImpl) _then) +class __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl<$Res> + extends _$PaymentElementPaymentMethodDefaultsCopyWithImpl<$Res, + _$PaymentElementPaymentMethodDefaultsImpl> + implements _$$PaymentElementPaymentMethodDefaultsImplCopyWith<$Res> { + __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl( + _$PaymentElementPaymentMethodDefaultsImpl _value, + $Res Function(_$PaymentElementPaymentMethodDefaultsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, - Object? email = freezed, - Object? phone = freezed, - Object? address = freezed, + Object? ideal = freezed, + Object? card = freezed, }) { - return _then(_$PaymentElementBillingDetailsImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - email: freezed == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String?, - phone: freezed == phone - ? _value.phone - : phone // ignore: cast_nullable_to_non_nullable - as String?, - address: freezed == address - ? _value.address - : address // ignore: cast_nullable_to_non_nullable - as PaymentElementBillingDetailsAddress?, + return _then(_$PaymentElementPaymentMethodDefaultsImpl( + ideal: freezed == ideal + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as PaymentElementIdealDefaults?, + card: freezed == card + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as PaymentElementCardDefaults?, )); } } /// @nodoc @JsonSerializable() -class _$PaymentElementBillingDetailsImpl - implements _PaymentElementBillingDetails { - const _$PaymentElementBillingDetailsImpl( - {this.name, this.email, this.phone, this.address}); +class _$PaymentElementPaymentMethodDefaultsImpl + implements _PaymentElementPaymentMethodDefaults { + const _$PaymentElementPaymentMethodDefaultsImpl({this.ideal, this.card}); - factory _$PaymentElementBillingDetailsImpl.fromJson( + factory _$PaymentElementPaymentMethodDefaultsImpl.fromJson( Map json) => - _$$PaymentElementBillingDetailsImplFromJson(json); + _$$PaymentElementPaymentMethodDefaultsImplFromJson(json); + /// Defaults for ideal @override - final String? name; - @override - final String? email; - @override - final String? phone; + final PaymentElementIdealDefaults? ideal; + + /// Defaults for card payment method @override - final PaymentElementBillingDetailsAddress? address; + final PaymentElementCardDefaults? card; @override String toString() { - return 'PaymentElementBillingDetails(name: $name, email: $email, phone: $phone, address: $address)'; + return 'PaymentElementPaymentMethodDefaults(ideal: $ideal, card: $card)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PaymentElementBillingDetailsImpl && - (identical(other.name, name) || other.name == name) && - (identical(other.email, email) || other.email == email) && - (identical(other.phone, phone) || other.phone == phone) && - (identical(other.address, address) || other.address == address)); + other is _$PaymentElementPaymentMethodDefaultsImpl && + (identical(other.ideal, ideal) || other.ideal == ideal) && + (identical(other.card, card) || other.card == card)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, name, email, phone, address); + int get hashCode => Object.hash(runtimeType, ideal, card); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PaymentElementBillingDetailsImplCopyWith< - _$PaymentElementBillingDetailsImpl> - get copyWith => __$$PaymentElementBillingDetailsImplCopyWithImpl< - _$PaymentElementBillingDetailsImpl>(this, _$identity); + _$$PaymentElementPaymentMethodDefaultsImplCopyWith< + _$PaymentElementPaymentMethodDefaultsImpl> + get copyWith => __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl< + _$PaymentElementPaymentMethodDefaultsImpl>(this, _$identity); @override Map toJson() { - return _$$PaymentElementBillingDetailsImplToJson( + return _$$PaymentElementPaymentMethodDefaultsImplToJson( this, ); } } -abstract class _PaymentElementBillingDetails - implements PaymentElementBillingDetails { - const factory _PaymentElementBillingDetails( - {final String? name, - final String? email, - final String? phone, - final PaymentElementBillingDetailsAddress? address}) = - _$PaymentElementBillingDetailsImpl; +abstract class _PaymentElementPaymentMethodDefaults + implements PaymentElementPaymentMethodDefaults { + const factory _PaymentElementPaymentMethodDefaults( + {final PaymentElementIdealDefaults? ideal, + final PaymentElementCardDefaults? card}) = + _$PaymentElementPaymentMethodDefaultsImpl; - factory _PaymentElementBillingDetails.fromJson(Map json) = - _$PaymentElementBillingDetailsImpl.fromJson; + factory _PaymentElementPaymentMethodDefaults.fromJson( + Map json) = + _$PaymentElementPaymentMethodDefaultsImpl.fromJson; @override - String? get name; - @override - String? get email; - @override - String? get phone; + + /// Defaults for ideal + PaymentElementIdealDefaults? get ideal; @override - PaymentElementBillingDetailsAddress? get address; + + /// Defaults for card payment method + PaymentElementCardDefaults? get card; @override @JsonKey(ignore: true) - _$$PaymentElementBillingDetailsImplCopyWith< - _$PaymentElementBillingDetailsImpl> + _$$PaymentElementPaymentMethodDefaultsImplCopyWith< + _$PaymentElementPaymentMethodDefaultsImpl> get copyWith => throw _privateConstructorUsedError; } -PaymentElementBillingDetailsAddress - _$PaymentElementBillingDetailsAddressFromJson(Map json) { - return _PaymentElementBillingDetailsAddress.fromJson(json); +PaymentElementWalletOptions _$PaymentElementWalletOptionsFromJson( + Map json) { + return _PaymentElementWalletOptions.fromJson(json); } /// @nodoc -mixin _$PaymentElementBillingDetailsAddress { - /// Address line 1 (e.g., street, PO Box, or company name). - String? get line1 => throw _privateConstructorUsedError; - - /// Address line 2 (e.g., apartment, suite, unit, or building). - String? get line2 => throw _privateConstructorUsedError; - - /// City, district, suburb, town, or village. - String? get city => throw _privateConstructorUsedError; - - /// State, county, province, or region. - String? get state => throw _privateConstructorUsedError; - - /// Two-letter country code (ISO 3166-1 alpha-2). - String? get country => throw _privateConstructorUsedError; +mixin _$PaymentElementWalletOptions { + /// Apple pay required options + PaymentElementFieldRequired? get applePay => + throw _privateConstructorUsedError; - /// ZIP or postal code. - @JsonKey(name: 'postal_code') - String? get postalCode => throw _privateConstructorUsedError; + /// Google pay required options + PaymentElementFieldRequired? get googlePay => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PaymentElementBillingDetailsAddressCopyWith< - PaymentElementBillingDetailsAddress> + $PaymentElementWalletOptionsCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PaymentElementBillingDetailsAddressCopyWith<$Res> { - factory $PaymentElementBillingDetailsAddressCopyWith( - PaymentElementBillingDetailsAddress value, - $Res Function(PaymentElementBillingDetailsAddress) then) = - _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, - PaymentElementBillingDetailsAddress>; +abstract class $PaymentElementWalletOptionsCopyWith<$Res> { + factory $PaymentElementWalletOptionsCopyWith( + PaymentElementWalletOptions value, + $Res Function(PaymentElementWalletOptions) then) = + _$PaymentElementWalletOptionsCopyWithImpl<$Res, + PaymentElementWalletOptions>; @useResult $Res call( - {String? line1, - String? line2, - String? city, - String? state, - String? country, - @JsonKey(name: 'postal_code') String? postalCode}); + {PaymentElementFieldRequired? applePay, + PaymentElementFieldRequired? googlePay}); } /// @nodoc -class _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, - $Val extends PaymentElementBillingDetailsAddress> - implements $PaymentElementBillingDetailsAddressCopyWith<$Res> { - _$PaymentElementBillingDetailsAddressCopyWithImpl(this._value, this._then); +class _$PaymentElementWalletOptionsCopyWithImpl<$Res, + $Val extends PaymentElementWalletOptions> + implements $PaymentElementWalletOptionsCopyWith<$Res> { + _$PaymentElementWalletOptionsCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -1181,266 +1308,177 @@ class _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? line1 = freezed, - Object? line2 = freezed, - Object? city = freezed, - Object? state = freezed, - Object? country = freezed, - Object? postalCode = freezed, + Object? applePay = freezed, + Object? googlePay = freezed, }) { return _then(_value.copyWith( - line1: freezed == line1 - ? _value.line1 - : line1 // ignore: cast_nullable_to_non_nullable - as String?, - line2: freezed == line2 - ? _value.line2 - : line2 // ignore: cast_nullable_to_non_nullable - as String?, - city: freezed == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String?, - state: freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - postalCode: freezed == postalCode - ? _value.postalCode - : postalCode // ignore: cast_nullable_to_non_nullable - as String?, + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired?, + googlePay: freezed == googlePay + ? _value.googlePay + : googlePay // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired?, ) as $Val); } } /// @nodoc -abstract class _$$PaymentElementBillingDetailsAddressImplCopyWith<$Res> - implements $PaymentElementBillingDetailsAddressCopyWith<$Res> { - factory _$$PaymentElementBillingDetailsAddressImplCopyWith( - _$PaymentElementBillingDetailsAddressImpl value, - $Res Function(_$PaymentElementBillingDetailsAddressImpl) then) = - __$$PaymentElementBillingDetailsAddressImplCopyWithImpl<$Res>; +abstract class _$$PaymentElementWalletOptionsImplCopyWith<$Res> + implements $PaymentElementWalletOptionsCopyWith<$Res> { + factory _$$PaymentElementWalletOptionsImplCopyWith( + _$PaymentElementWalletOptionsImpl value, + $Res Function(_$PaymentElementWalletOptionsImpl) then) = + __$$PaymentElementWalletOptionsImplCopyWithImpl<$Res>; @override @useResult $Res call( - {String? line1, - String? line2, - String? city, - String? state, - String? country, - @JsonKey(name: 'postal_code') String? postalCode}); + {PaymentElementFieldRequired? applePay, + PaymentElementFieldRequired? googlePay}); } /// @nodoc -class __$$PaymentElementBillingDetailsAddressImplCopyWithImpl<$Res> - extends _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, - _$PaymentElementBillingDetailsAddressImpl> - implements _$$PaymentElementBillingDetailsAddressImplCopyWith<$Res> { - __$$PaymentElementBillingDetailsAddressImplCopyWithImpl( - _$PaymentElementBillingDetailsAddressImpl _value, - $Res Function(_$PaymentElementBillingDetailsAddressImpl) _then) +class __$$PaymentElementWalletOptionsImplCopyWithImpl<$Res> + extends _$PaymentElementWalletOptionsCopyWithImpl<$Res, + _$PaymentElementWalletOptionsImpl> + implements _$$PaymentElementWalletOptionsImplCopyWith<$Res> { + __$$PaymentElementWalletOptionsImplCopyWithImpl( + _$PaymentElementWalletOptionsImpl _value, + $Res Function(_$PaymentElementWalletOptionsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? line1 = freezed, - Object? line2 = freezed, - Object? city = freezed, - Object? state = freezed, - Object? country = freezed, - Object? postalCode = freezed, + Object? applePay = freezed, + Object? googlePay = freezed, }) { - return _then(_$PaymentElementBillingDetailsAddressImpl( - line1: freezed == line1 - ? _value.line1 - : line1 // ignore: cast_nullable_to_non_nullable - as String?, - line2: freezed == line2 - ? _value.line2 - : line2 // ignore: cast_nullable_to_non_nullable - as String?, - city: freezed == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String?, - state: freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - postalCode: freezed == postalCode - ? _value.postalCode - : postalCode // ignore: cast_nullable_to_non_nullable - as String?, + return _then(_$PaymentElementWalletOptionsImpl( + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired?, + googlePay: freezed == googlePay + ? _value.googlePay + : googlePay // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired?, )); } } /// @nodoc @JsonSerializable() -class _$PaymentElementBillingDetailsAddressImpl - implements _PaymentElementBillingDetailsAddress { - const _$PaymentElementBillingDetailsAddressImpl( - {this.line1, - this.line2, - this.city, - this.state, - this.country, - @JsonKey(name: 'postal_code') this.postalCode}); +class _$PaymentElementWalletOptionsImpl + implements _PaymentElementWalletOptions { + const _$PaymentElementWalletOptionsImpl({this.applePay, this.googlePay}); - factory _$PaymentElementBillingDetailsAddressImpl.fromJson( + factory _$PaymentElementWalletOptionsImpl.fromJson( Map json) => - _$$PaymentElementBillingDetailsAddressImplFromJson(json); - - /// Address line 1 (e.g., street, PO Box, or company name). - @override - final String? line1; - - /// Address line 2 (e.g., apartment, suite, unit, or building). - @override - final String? line2; - - /// City, district, suburb, town, or village. - @override - final String? city; - - /// State, county, province, or region. - @override - final String? state; + _$$PaymentElementWalletOptionsImplFromJson(json); - /// Two-letter country code (ISO 3166-1 alpha-2). + /// Apple pay required options @override - final String? country; + final PaymentElementFieldRequired? applePay; - /// ZIP or postal code. + /// Google pay required options @override - @JsonKey(name: 'postal_code') - final String? postalCode; + final PaymentElementFieldRequired? googlePay; @override String toString() { - return 'PaymentElementBillingDetailsAddress(line1: $line1, line2: $line2, city: $city, state: $state, country: $country, postalCode: $postalCode)'; + return 'PaymentElementWalletOptions(applePay: $applePay, googlePay: $googlePay)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PaymentElementBillingDetailsAddressImpl && - (identical(other.line1, line1) || other.line1 == line1) && - (identical(other.line2, line2) || other.line2 == line2) && - (identical(other.city, city) || other.city == city) && - (identical(other.state, state) || other.state == state) && - (identical(other.country, country) || other.country == country) && - (identical(other.postalCode, postalCode) || - other.postalCode == postalCode)); + other is _$PaymentElementWalletOptionsImpl && + (identical(other.applePay, applePay) || + other.applePay == applePay) && + (identical(other.googlePay, googlePay) || + other.googlePay == googlePay)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, line1, line2, city, state, country, postalCode); + int get hashCode => Object.hash(runtimeType, applePay, googlePay); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PaymentElementBillingDetailsAddressImplCopyWith< - _$PaymentElementBillingDetailsAddressImpl> - get copyWith => __$$PaymentElementBillingDetailsAddressImplCopyWithImpl< - _$PaymentElementBillingDetailsAddressImpl>(this, _$identity); + _$$PaymentElementWalletOptionsImplCopyWith<_$PaymentElementWalletOptionsImpl> + get copyWith => __$$PaymentElementWalletOptionsImplCopyWithImpl< + _$PaymentElementWalletOptionsImpl>(this, _$identity); @override Map toJson() { - return _$$PaymentElementBillingDetailsAddressImplToJson( + return _$$PaymentElementWalletOptionsImplToJson( this, ); } } -abstract class _PaymentElementBillingDetailsAddress - implements PaymentElementBillingDetailsAddress { - const factory _PaymentElementBillingDetailsAddress( - {final String? line1, - final String? line2, - final String? city, - final String? state, - final String? country, - @JsonKey(name: 'postal_code') final String? postalCode}) = - _$PaymentElementBillingDetailsAddressImpl; - - factory _PaymentElementBillingDetailsAddress.fromJson( - Map json) = - _$PaymentElementBillingDetailsAddressImpl.fromJson; - - @override - - /// Address line 1 (e.g., street, PO Box, or company name). - String? get line1; - @override - - /// Address line 2 (e.g., apartment, suite, unit, or building). - String? get line2; - @override +abstract class _PaymentElementWalletOptions + implements PaymentElementWalletOptions { + const factory _PaymentElementWalletOptions( + {final PaymentElementFieldRequired? applePay, + final PaymentElementFieldRequired? googlePay}) = + _$PaymentElementWalletOptionsImpl; - /// City, district, suburb, town, or village. - String? get city; - @override + factory _PaymentElementWalletOptions.fromJson(Map json) = + _$PaymentElementWalletOptionsImpl.fromJson; - /// State, county, province, or region. - String? get state; @override - /// Two-letter country code (ISO 3166-1 alpha-2). - String? get country; + /// Apple pay required options + PaymentElementFieldRequired? get applePay; @override - /// ZIP or postal code. - @JsonKey(name: 'postal_code') - String? get postalCode; + /// Google pay required options + PaymentElementFieldRequired? get googlePay; @override @JsonKey(ignore: true) - _$$PaymentElementBillingDetailsAddressImplCopyWith< - _$PaymentElementBillingDetailsAddressImpl> + _$$PaymentElementWalletOptionsImplCopyWith<_$PaymentElementWalletOptionsImpl> get copyWith => throw _privateConstructorUsedError; } -PaymentElementBusiness _$PaymentElementBusinessFromJson( +PaymentElementIdealDefaults _$PaymentElementIdealDefaultsFromJson( Map json) { - return _PaymentElementBusiness.fromJson(json); + return _PaymentElementIdealDefaults.fromJson(json); } /// @nodoc -mixin _$PaymentElementBusiness { - String? get name => throw _privateConstructorUsedError; +mixin _$PaymentElementIdealDefaults { + /// The customer’s bank name. + /// + /// See https://docs.stripe.com/payments/ideal/accept-a-payment?ui=element#bank-reference + /// for all options. + String? get bank => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PaymentElementBusinessCopyWith get copyWith => - throw _privateConstructorUsedError; + $PaymentElementIdealDefaultsCopyWith + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PaymentElementBusinessCopyWith<$Res> { - factory $PaymentElementBusinessCopyWith(PaymentElementBusiness value, - $Res Function(PaymentElementBusiness) then) = - _$PaymentElementBusinessCopyWithImpl<$Res, PaymentElementBusiness>; +abstract class $PaymentElementIdealDefaultsCopyWith<$Res> { + factory $PaymentElementIdealDefaultsCopyWith( + PaymentElementIdealDefaults value, + $Res Function(PaymentElementIdealDefaults) then) = + _$PaymentElementIdealDefaultsCopyWithImpl<$Res, + PaymentElementIdealDefaults>; @useResult - $Res call({String? name}); + $Res call({String? bank}); } /// @nodoc -class _$PaymentElementBusinessCopyWithImpl<$Res, - $Val extends PaymentElementBusiness> - implements $PaymentElementBusinessCopyWith<$Res> { - _$PaymentElementBusinessCopyWithImpl(this._value, this._then); +class _$PaymentElementIdealDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementIdealDefaults> + implements $PaymentElementIdealDefaultsCopyWith<$Res> { + _$PaymentElementIdealDefaultsCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -1450,48 +1488,48 @@ class _$PaymentElementBusinessCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, + Object? bank = freezed, }) { return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable + bank: freezed == bank + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable as String?, ) as $Val); } } /// @nodoc -abstract class _$$PaymentElementBusinessImplCopyWith<$Res> - implements $PaymentElementBusinessCopyWith<$Res> { - factory _$$PaymentElementBusinessImplCopyWith( - _$PaymentElementBusinessImpl value, - $Res Function(_$PaymentElementBusinessImpl) then) = - __$$PaymentElementBusinessImplCopyWithImpl<$Res>; +abstract class _$$PaymentElementIdealDefaultsImplCopyWith<$Res> + implements $PaymentElementIdealDefaultsCopyWith<$Res> { + factory _$$PaymentElementIdealDefaultsImplCopyWith( + _$PaymentElementIdealDefaultsImpl value, + $Res Function(_$PaymentElementIdealDefaultsImpl) then) = + __$$PaymentElementIdealDefaultsImplCopyWithImpl<$Res>; @override @useResult - $Res call({String? name}); + $Res call({String? bank}); } /// @nodoc -class __$$PaymentElementBusinessImplCopyWithImpl<$Res> - extends _$PaymentElementBusinessCopyWithImpl<$Res, - _$PaymentElementBusinessImpl> - implements _$$PaymentElementBusinessImplCopyWith<$Res> { - __$$PaymentElementBusinessImplCopyWithImpl( - _$PaymentElementBusinessImpl _value, - $Res Function(_$PaymentElementBusinessImpl) _then) +class __$$PaymentElementIdealDefaultsImplCopyWithImpl<$Res> + extends _$PaymentElementIdealDefaultsCopyWithImpl<$Res, + _$PaymentElementIdealDefaultsImpl> + implements _$$PaymentElementIdealDefaultsImplCopyWith<$Res> { + __$$PaymentElementIdealDefaultsImplCopyWithImpl( + _$PaymentElementIdealDefaultsImpl _value, + $Res Function(_$PaymentElementIdealDefaultsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, + Object? bank = freezed, }) { - return _then(_$PaymentElementBusinessImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable + return _then(_$PaymentElementIdealDefaultsImpl( + bank: freezed == bank + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable as String?, )); } @@ -1499,98 +1537,107 @@ class __$$PaymentElementBusinessImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$PaymentElementBusinessImpl implements _PaymentElementBusiness { - const _$PaymentElementBusinessImpl({this.name}); +class _$PaymentElementIdealDefaultsImpl + implements _PaymentElementIdealDefaults { + const _$PaymentElementIdealDefaultsImpl({this.bank}); - factory _$PaymentElementBusinessImpl.fromJson(Map json) => - _$$PaymentElementBusinessImplFromJson(json); + factory _$PaymentElementIdealDefaultsImpl.fromJson( + Map json) => + _$$PaymentElementIdealDefaultsImplFromJson(json); + /// The customer’s bank name. + /// + /// See https://docs.stripe.com/payments/ideal/accept-a-payment?ui=element#bank-reference + /// for all options. @override - final String? name; + final String? bank; @override String toString() { - return 'PaymentElementBusiness(name: $name)'; + return 'PaymentElementIdealDefaults(bank: $bank)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PaymentElementBusinessImpl && - (identical(other.name, name) || other.name == name)); + other is _$PaymentElementIdealDefaultsImpl && + (identical(other.bank, bank) || other.bank == bank)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, name); + int get hashCode => Object.hash(runtimeType, bank); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PaymentElementBusinessImplCopyWith<_$PaymentElementBusinessImpl> - get copyWith => __$$PaymentElementBusinessImplCopyWithImpl< - _$PaymentElementBusinessImpl>(this, _$identity); + _$$PaymentElementIdealDefaultsImplCopyWith<_$PaymentElementIdealDefaultsImpl> + get copyWith => __$$PaymentElementIdealDefaultsImplCopyWithImpl< + _$PaymentElementIdealDefaultsImpl>(this, _$identity); @override Map toJson() { - return _$$PaymentElementBusinessImplToJson( + return _$$PaymentElementIdealDefaultsImplToJson( this, ); } } -abstract class _PaymentElementBusiness implements PaymentElementBusiness { - const factory _PaymentElementBusiness({final String? name}) = - _$PaymentElementBusinessImpl; +abstract class _PaymentElementIdealDefaults + implements PaymentElementIdealDefaults { + const factory _PaymentElementIdealDefaults({final String? bank}) = + _$PaymentElementIdealDefaultsImpl; - factory _PaymentElementBusiness.fromJson(Map json) = - _$PaymentElementBusinessImpl.fromJson; + factory _PaymentElementIdealDefaults.fromJson(Map json) = + _$PaymentElementIdealDefaultsImpl.fromJson; @override - String? get name; + + /// The customer’s bank name. + /// + /// See https://docs.stripe.com/payments/ideal/accept-a-payment?ui=element#bank-reference + /// for all options. + String? get bank; @override @JsonKey(ignore: true) - _$$PaymentElementBusinessImplCopyWith<_$PaymentElementBusinessImpl> + _$$PaymentElementIdealDefaultsImplCopyWith<_$PaymentElementIdealDefaultsImpl> get copyWith => throw _privateConstructorUsedError; } -PaymentElementFields _$PaymentElementFieldsFromJson(Map json) { - return _PaymentElementFields.fromJson(json); +PaymentElementCardDefaults _$PaymentElementCardDefaultsFromJson( + Map json) { + return _PaymentElementCardDefaults.fromJson(json); } /// @nodoc -mixin _$PaymentElementFields { - /// Specify never to avoid collecting all billing details in the - /// Payment Element. - /// If you would like to disable only certain billing details, - /// pass an BillingDetailsFields specifying which fields you would like - /// to disable collection for. - /// The default setting for each field is auto. - BillingDetailsFields get billingDetails => throw _privateConstructorUsedError; +mixin _$PaymentElementCardDefaults { + /// The specified network prferences for card brand choice. The first network in the array + /// that matches a network on the enetered cobranded card will be selected by default + /// in the card brand choice. + List? get network => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PaymentElementFieldsCopyWith get copyWith => - throw _privateConstructorUsedError; + $PaymentElementCardDefaultsCopyWith + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PaymentElementFieldsCopyWith<$Res> { - factory $PaymentElementFieldsCopyWith(PaymentElementFields value, - $Res Function(PaymentElementFields) then) = - _$PaymentElementFieldsCopyWithImpl<$Res, PaymentElementFields>; +abstract class $PaymentElementCardDefaultsCopyWith<$Res> { + factory $PaymentElementCardDefaultsCopyWith(PaymentElementCardDefaults value, + $Res Function(PaymentElementCardDefaults) then) = + _$PaymentElementCardDefaultsCopyWithImpl<$Res, + PaymentElementCardDefaults>; @useResult - $Res call({BillingDetailsFields billingDetails}); - - $BillingDetailsFieldsCopyWith<$Res> get billingDetails; + $Res call({List? network}); } /// @nodoc -class _$PaymentElementFieldsCopyWithImpl<$Res, - $Val extends PaymentElementFields> - implements $PaymentElementFieldsCopyWith<$Res> { - _$PaymentElementFieldsCopyWithImpl(this._value, this._then); +class _$PaymentElementCardDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementCardDefaults> + implements $PaymentElementCardDefaultsCopyWith<$Res> { + _$PaymentElementCardDefaultsCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -1600,173 +1647,174 @@ class _$PaymentElementFieldsCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? billingDetails = null, + Object? network = freezed, }) { return _then(_value.copyWith( - billingDetails: null == billingDetails - ? _value.billingDetails - : billingDetails // ignore: cast_nullable_to_non_nullable - as BillingDetailsFields, + network: freezed == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } +} - @override - @pragma('vm:prefer-inline') - $BillingDetailsFieldsCopyWith<$Res> get billingDetails { - return $BillingDetailsFieldsCopyWith<$Res>(_value.billingDetails, (value) { - return _then(_value.copyWith(billingDetails: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PaymentElementFieldsImplCopyWith<$Res> - implements $PaymentElementFieldsCopyWith<$Res> { - factory _$$PaymentElementFieldsImplCopyWith(_$PaymentElementFieldsImpl value, - $Res Function(_$PaymentElementFieldsImpl) then) = - __$$PaymentElementFieldsImplCopyWithImpl<$Res>; +/// @nodoc +abstract class _$$PaymentElementCardDefaultsImplCopyWith<$Res> + implements $PaymentElementCardDefaultsCopyWith<$Res> { + factory _$$PaymentElementCardDefaultsImplCopyWith( + _$PaymentElementCardDefaultsImpl value, + $Res Function(_$PaymentElementCardDefaultsImpl) then) = + __$$PaymentElementCardDefaultsImplCopyWithImpl<$Res>; @override @useResult - $Res call({BillingDetailsFields billingDetails}); - - @override - $BillingDetailsFieldsCopyWith<$Res> get billingDetails; + $Res call({List? network}); } /// @nodoc -class __$$PaymentElementFieldsImplCopyWithImpl<$Res> - extends _$PaymentElementFieldsCopyWithImpl<$Res, _$PaymentElementFieldsImpl> - implements _$$PaymentElementFieldsImplCopyWith<$Res> { - __$$PaymentElementFieldsImplCopyWithImpl(_$PaymentElementFieldsImpl _value, - $Res Function(_$PaymentElementFieldsImpl) _then) +class __$$PaymentElementCardDefaultsImplCopyWithImpl<$Res> + extends _$PaymentElementCardDefaultsCopyWithImpl<$Res, + _$PaymentElementCardDefaultsImpl> + implements _$$PaymentElementCardDefaultsImplCopyWith<$Res> { + __$$PaymentElementCardDefaultsImplCopyWithImpl( + _$PaymentElementCardDefaultsImpl _value, + $Res Function(_$PaymentElementCardDefaultsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? billingDetails = null, + Object? network = freezed, }) { - return _then(_$PaymentElementFieldsImpl( - billingDetails: null == billingDetails - ? _value.billingDetails - : billingDetails // ignore: cast_nullable_to_non_nullable - as BillingDetailsFields, + return _then(_$PaymentElementCardDefaultsImpl( + network: freezed == network + ? _value._network + : network // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$PaymentElementFieldsImpl implements _PaymentElementFields { - const _$PaymentElementFieldsImpl( - {this.billingDetails = BillingDetailsFields.auto}); - - factory _$PaymentElementFieldsImpl.fromJson(Map json) => - _$$PaymentElementFieldsImplFromJson(json); +class _$PaymentElementCardDefaultsImpl implements _PaymentElementCardDefaults { + const _$PaymentElementCardDefaultsImpl({final List? network}) + : _network = network; - /// Specify never to avoid collecting all billing details in the - /// Payment Element. - /// If you would like to disable only certain billing details, - /// pass an BillingDetailsFields specifying which fields you would like - /// to disable collection for. - /// The default setting for each field is auto. - @override - @JsonKey() - final BillingDetailsFields billingDetails; + factory _$PaymentElementCardDefaultsImpl.fromJson( + Map json) => + _$$PaymentElementCardDefaultsImplFromJson(json); + + /// The specified network prferences for card brand choice. The first network in the array + /// that matches a network on the enetered cobranded card will be selected by default + /// in the card brand choice. + final List? _network; + + /// The specified network prferences for card brand choice. The first network in the array + /// that matches a network on the enetered cobranded card will be selected by default + /// in the card brand choice. + @override + List? get network { + final value = _network; + if (value == null) return null; + if (_network is EqualUnmodifiableListView) return _network; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'PaymentElementFields(billingDetails: $billingDetails)'; + return 'PaymentElementCardDefaults(network: $network)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PaymentElementFieldsImpl && - (identical(other.billingDetails, billingDetails) || - other.billingDetails == billingDetails)); + other is _$PaymentElementCardDefaultsImpl && + const DeepCollectionEquality().equals(other._network, _network)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, billingDetails); + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_network)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PaymentElementFieldsImplCopyWith<_$PaymentElementFieldsImpl> - get copyWith => - __$$PaymentElementFieldsImplCopyWithImpl<_$PaymentElementFieldsImpl>( - this, _$identity); + _$$PaymentElementCardDefaultsImplCopyWith<_$PaymentElementCardDefaultsImpl> + get copyWith => __$$PaymentElementCardDefaultsImplCopyWithImpl< + _$PaymentElementCardDefaultsImpl>(this, _$identity); @override Map toJson() { - return _$$PaymentElementFieldsImplToJson( + return _$$PaymentElementCardDefaultsImplToJson( this, ); } } -abstract class _PaymentElementFields implements PaymentElementFields { - const factory _PaymentElementFields( - {final BillingDetailsFields billingDetails}) = _$PaymentElementFieldsImpl; +abstract class _PaymentElementCardDefaults + implements PaymentElementCardDefaults { + const factory _PaymentElementCardDefaults({final List? network}) = + _$PaymentElementCardDefaultsImpl; - factory _PaymentElementFields.fromJson(Map json) = - _$PaymentElementFieldsImpl.fromJson; + factory _PaymentElementCardDefaults.fromJson(Map json) = + _$PaymentElementCardDefaultsImpl.fromJson; @override - /// Specify never to avoid collecting all billing details in the - /// Payment Element. - /// If you would like to disable only certain billing details, - /// pass an BillingDetailsFields specifying which fields you would like - /// to disable collection for. - /// The default setting for each field is auto. - BillingDetailsFields get billingDetails; + /// The specified network prferences for card brand choice. The first network in the array + /// that matches a network on the enetered cobranded card will be selected by default + /// in the card brand choice. + List? get network; @override @JsonKey(ignore: true) - _$$PaymentElementFieldsImplCopyWith<_$PaymentElementFieldsImpl> + _$$PaymentElementCardDefaultsImplCopyWith<_$PaymentElementCardDefaultsImpl> get copyWith => throw _privateConstructorUsedError; } -BillingDetailsFields _$BillingDetailsFieldsFromJson(Map json) { - return _BillingDetailsFields.fromJson(json); +PaymentElementBillingDetails _$PaymentElementBillingDetailsFromJson( + Map json) { + return _PaymentElementBillingDetails.fromJson(json); } /// @nodoc -mixin _$BillingDetailsFields { - PaymentElementFieldRequired get name => throw _privateConstructorUsedError; - PaymentElementFieldRequired get email => throw _privateConstructorUsedError; - PaymentElementFieldRequired get phone => throw _privateConstructorUsedError; - PaymentElementAddressFields get address => throw _privateConstructorUsedError; +mixin _$PaymentElementBillingDetails { + String? get name => throw _privateConstructorUsedError; + String? get email => throw _privateConstructorUsedError; + String? get phone => throw _privateConstructorUsedError; + PaymentElementBillingDetailsAddress? get address => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BillingDetailsFieldsCopyWith get copyWith => - throw _privateConstructorUsedError; + $PaymentElementBillingDetailsCopyWith + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $BillingDetailsFieldsCopyWith<$Res> { - factory $BillingDetailsFieldsCopyWith(BillingDetailsFields value, - $Res Function(BillingDetailsFields) then) = - _$BillingDetailsFieldsCopyWithImpl<$Res, BillingDetailsFields>; +abstract class $PaymentElementBillingDetailsCopyWith<$Res> { + factory $PaymentElementBillingDetailsCopyWith( + PaymentElementBillingDetails value, + $Res Function(PaymentElementBillingDetails) then) = + _$PaymentElementBillingDetailsCopyWithImpl<$Res, + PaymentElementBillingDetails>; @useResult $Res call( - {PaymentElementFieldRequired name, - PaymentElementFieldRequired email, - PaymentElementFieldRequired phone, - PaymentElementAddressFields address}); + {String? name, + String? email, + String? phone, + PaymentElementBillingDetailsAddress? address}); - $PaymentElementAddressFieldsCopyWith<$Res> get address; + $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address; } /// @nodoc -class _$BillingDetailsFieldsCopyWithImpl<$Res, - $Val extends BillingDetailsFields> - implements $BillingDetailsFieldsCopyWith<$Res> { - _$BillingDetailsFieldsCopyWithImpl(this._value, this._then); +class _$PaymentElementBillingDetailsCopyWithImpl<$Res, + $Val extends PaymentElementBillingDetails> + implements $PaymentElementBillingDetailsCopyWith<$Res> { + _$PaymentElementBillingDetailsCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -1776,130 +1824,133 @@ class _$BillingDetailsFieldsCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? name = null, - Object? email = null, - Object? phone = null, - Object? address = null, + Object? name = freezed, + Object? email = freezed, + Object? phone = freezed, + Object? address = freezed, }) { return _then(_value.copyWith( - name: null == name + name: freezed == name ? _value.name : name // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - email: null == email + as String?, + email: freezed == email ? _value.email : email // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - phone: null == phone + as String?, + phone: freezed == phone ? _value.phone : phone // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - address: null == address + as String?, + address: freezed == address ? _value.address : address // ignore: cast_nullable_to_non_nullable - as PaymentElementAddressFields, + as PaymentElementBillingDetailsAddress?, ) as $Val); } @override @pragma('vm:prefer-inline') - $PaymentElementAddressFieldsCopyWith<$Res> get address { - return $PaymentElementAddressFieldsCopyWith<$Res>(_value.address, (value) { + $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address { + if (_value.address == null) { + return null; + } + + return $PaymentElementBillingDetailsAddressCopyWith<$Res>(_value.address!, + (value) { return _then(_value.copyWith(address: value) as $Val); }); } } /// @nodoc -abstract class _$$BillingDetailsFieldsImplCopyWith<$Res> - implements $BillingDetailsFieldsCopyWith<$Res> { - factory _$$BillingDetailsFieldsImplCopyWith(_$BillingDetailsFieldsImpl value, - $Res Function(_$BillingDetailsFieldsImpl) then) = - __$$BillingDetailsFieldsImplCopyWithImpl<$Res>; +abstract class _$$PaymentElementBillingDetailsImplCopyWith<$Res> + implements $PaymentElementBillingDetailsCopyWith<$Res> { + factory _$$PaymentElementBillingDetailsImplCopyWith( + _$PaymentElementBillingDetailsImpl value, + $Res Function(_$PaymentElementBillingDetailsImpl) then) = + __$$PaymentElementBillingDetailsImplCopyWithImpl<$Res>; @override @useResult $Res call( - {PaymentElementFieldRequired name, - PaymentElementFieldRequired email, - PaymentElementFieldRequired phone, - PaymentElementAddressFields address}); + {String? name, + String? email, + String? phone, + PaymentElementBillingDetailsAddress? address}); @override - $PaymentElementAddressFieldsCopyWith<$Res> get address; + $PaymentElementBillingDetailsAddressCopyWith<$Res>? get address; } /// @nodoc -class __$$BillingDetailsFieldsImplCopyWithImpl<$Res> - extends _$BillingDetailsFieldsCopyWithImpl<$Res, _$BillingDetailsFieldsImpl> - implements _$$BillingDetailsFieldsImplCopyWith<$Res> { - __$$BillingDetailsFieldsImplCopyWithImpl(_$BillingDetailsFieldsImpl _value, - $Res Function(_$BillingDetailsFieldsImpl) _then) +class __$$PaymentElementBillingDetailsImplCopyWithImpl<$Res> + extends _$PaymentElementBillingDetailsCopyWithImpl<$Res, + _$PaymentElementBillingDetailsImpl> + implements _$$PaymentElementBillingDetailsImplCopyWith<$Res> { + __$$PaymentElementBillingDetailsImplCopyWithImpl( + _$PaymentElementBillingDetailsImpl _value, + $Res Function(_$PaymentElementBillingDetailsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? name = null, - Object? email = null, - Object? phone = null, - Object? address = null, + Object? name = freezed, + Object? email = freezed, + Object? phone = freezed, + Object? address = freezed, }) { - return _then(_$BillingDetailsFieldsImpl( - name: null == name + return _then(_$PaymentElementBillingDetailsImpl( + name: freezed == name ? _value.name : name // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - email: null == email + as String?, + email: freezed == email ? _value.email : email // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - phone: null == phone + as String?, + phone: freezed == phone ? _value.phone : phone // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - address: null == address + as String?, + address: freezed == address ? _value.address : address // ignore: cast_nullable_to_non_nullable - as PaymentElementAddressFields, + as PaymentElementBillingDetailsAddress?, )); } } /// @nodoc @JsonSerializable() -class _$BillingDetailsFieldsImpl implements _BillingDetailsFields { - const _$BillingDetailsFieldsImpl( - {this.name = PaymentElementFieldRequired.auto, - this.email = PaymentElementFieldRequired.auto, - this.phone = PaymentElementFieldRequired.auto, - this.address = PaymentElementAddressFields.auto}); +class _$PaymentElementBillingDetailsImpl + implements _PaymentElementBillingDetails { + const _$PaymentElementBillingDetailsImpl( + {this.name, this.email, this.phone, this.address}); - factory _$BillingDetailsFieldsImpl.fromJson(Map json) => - _$$BillingDetailsFieldsImplFromJson(json); + factory _$PaymentElementBillingDetailsImpl.fromJson( + Map json) => + _$$PaymentElementBillingDetailsImplFromJson(json); @override - @JsonKey() - final PaymentElementFieldRequired name; + final String? name; @override - @JsonKey() - final PaymentElementFieldRequired email; + final String? email; @override - @JsonKey() - final PaymentElementFieldRequired phone; + final String? phone; @override - @JsonKey() - final PaymentElementAddressFields address; + final PaymentElementBillingDetailsAddress? address; @override String toString() { - return 'BillingDetailsFields(name: $name, email: $email, phone: $phone, address: $address)'; + return 'PaymentElementBillingDetails(name: $name, email: $email, phone: $phone, address: $address)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$BillingDetailsFieldsImpl && + other is _$PaymentElementBillingDetailsImpl && (identical(other.name, name) || other.name == name) && (identical(other.email, email) || other.email == email) && (identical(other.phone, phone) || other.phone == phone) && @@ -1913,86 +1964,3281 @@ class _$BillingDetailsFieldsImpl implements _BillingDetailsFields { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BillingDetailsFieldsImplCopyWith<_$BillingDetailsFieldsImpl> - get copyWith => - __$$BillingDetailsFieldsImplCopyWithImpl<_$BillingDetailsFieldsImpl>( - this, _$identity); + _$$PaymentElementBillingDetailsImplCopyWith< + _$PaymentElementBillingDetailsImpl> + get copyWith => __$$PaymentElementBillingDetailsImplCopyWithImpl< + _$PaymentElementBillingDetailsImpl>(this, _$identity); @override Map toJson() { - return _$$BillingDetailsFieldsImplToJson( + return _$$PaymentElementBillingDetailsImplToJson( this, ); } } -abstract class _BillingDetailsFields implements BillingDetailsFields { - const factory _BillingDetailsFields( - {final PaymentElementFieldRequired name, - final PaymentElementFieldRequired email, +abstract class _PaymentElementBillingDetails + implements PaymentElementBillingDetails { + const factory _PaymentElementBillingDetails( + {final String? name, + final String? email, + final String? phone, + final PaymentElementBillingDetailsAddress? address}) = + _$PaymentElementBillingDetailsImpl; + + factory _PaymentElementBillingDetails.fromJson(Map json) = + _$PaymentElementBillingDetailsImpl.fromJson; + + @override + String? get name; + @override + String? get email; + @override + String? get phone; + @override + PaymentElementBillingDetailsAddress? get address; + @override + @JsonKey(ignore: true) + _$$PaymentElementBillingDetailsImplCopyWith< + _$PaymentElementBillingDetailsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementBillingDetailsAddress + _$PaymentElementBillingDetailsAddressFromJson(Map json) { + return _PaymentElementBillingDetailsAddress.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementBillingDetailsAddress { + /// Address line 1 (e.g., street, PO Box, or company name). + String? get line1 => throw _privateConstructorUsedError; + + /// Address line 2 (e.g., apartment, suite, unit, or building). + String? get line2 => throw _privateConstructorUsedError; + + /// City, district, suburb, town, or village. + String? get city => throw _privateConstructorUsedError; + + /// State, county, province, or region. + String? get state => throw _privateConstructorUsedError; + + /// Two-letter country code (ISO 3166-1 alpha-2). + String? get country => throw _privateConstructorUsedError; + + /// ZIP or postal code. + @JsonKey(name: 'postal_code') + String? get postalCode => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementBillingDetailsAddressCopyWith< + PaymentElementBillingDetailsAddress> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementBillingDetailsAddressCopyWith<$Res> { + factory $PaymentElementBillingDetailsAddressCopyWith( + PaymentElementBillingDetailsAddress value, + $Res Function(PaymentElementBillingDetailsAddress) then) = + _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, + PaymentElementBillingDetailsAddress>; + @useResult + $Res call( + {String? line1, + String? line2, + String? city, + String? state, + String? country, + @JsonKey(name: 'postal_code') String? postalCode}); +} + +/// @nodoc +class _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, + $Val extends PaymentElementBillingDetailsAddress> + implements $PaymentElementBillingDetailsAddressCopyWith<$Res> { + _$PaymentElementBillingDetailsAddressCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? line1 = freezed, + Object? line2 = freezed, + Object? city = freezed, + Object? state = freezed, + Object? country = freezed, + Object? postalCode = freezed, + }) { + return _then(_value.copyWith( + line1: freezed == line1 + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as String?, + line2: freezed == line2 + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as String?, + city: freezed == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + postalCode: freezed == postalCode + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementBillingDetailsAddressImplCopyWith<$Res> + implements $PaymentElementBillingDetailsAddressCopyWith<$Res> { + factory _$$PaymentElementBillingDetailsAddressImplCopyWith( + _$PaymentElementBillingDetailsAddressImpl value, + $Res Function(_$PaymentElementBillingDetailsAddressImpl) then) = + __$$PaymentElementBillingDetailsAddressImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String? line1, + String? line2, + String? city, + String? state, + String? country, + @JsonKey(name: 'postal_code') String? postalCode}); +} + +/// @nodoc +class __$$PaymentElementBillingDetailsAddressImplCopyWithImpl<$Res> + extends _$PaymentElementBillingDetailsAddressCopyWithImpl<$Res, + _$PaymentElementBillingDetailsAddressImpl> + implements _$$PaymentElementBillingDetailsAddressImplCopyWith<$Res> { + __$$PaymentElementBillingDetailsAddressImplCopyWithImpl( + _$PaymentElementBillingDetailsAddressImpl _value, + $Res Function(_$PaymentElementBillingDetailsAddressImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? line1 = freezed, + Object? line2 = freezed, + Object? city = freezed, + Object? state = freezed, + Object? country = freezed, + Object? postalCode = freezed, + }) { + return _then(_$PaymentElementBillingDetailsAddressImpl( + line1: freezed == line1 + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as String?, + line2: freezed == line2 + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as String?, + city: freezed == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + postalCode: freezed == postalCode + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementBillingDetailsAddressImpl + implements _PaymentElementBillingDetailsAddress { + const _$PaymentElementBillingDetailsAddressImpl( + {this.line1, + this.line2, + this.city, + this.state, + this.country, + @JsonKey(name: 'postal_code') this.postalCode}); + + factory _$PaymentElementBillingDetailsAddressImpl.fromJson( + Map json) => + _$$PaymentElementBillingDetailsAddressImplFromJson(json); + + /// Address line 1 (e.g., street, PO Box, or company name). + @override + final String? line1; + + /// Address line 2 (e.g., apartment, suite, unit, or building). + @override + final String? line2; + + /// City, district, suburb, town, or village. + @override + final String? city; + + /// State, county, province, or region. + @override + final String? state; + + /// Two-letter country code (ISO 3166-1 alpha-2). + @override + final String? country; + + /// ZIP or postal code. + @override + @JsonKey(name: 'postal_code') + final String? postalCode; + + @override + String toString() { + return 'PaymentElementBillingDetailsAddress(line1: $line1, line2: $line2, city: $city, state: $state, country: $country, postalCode: $postalCode)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementBillingDetailsAddressImpl && + (identical(other.line1, line1) || other.line1 == line1) && + (identical(other.line2, line2) || other.line2 == line2) && + (identical(other.city, city) || other.city == city) && + (identical(other.state, state) || other.state == state) && + (identical(other.country, country) || other.country == country) && + (identical(other.postalCode, postalCode) || + other.postalCode == postalCode)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, line1, line2, city, state, country, postalCode); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementBillingDetailsAddressImplCopyWith< + _$PaymentElementBillingDetailsAddressImpl> + get copyWith => __$$PaymentElementBillingDetailsAddressImplCopyWithImpl< + _$PaymentElementBillingDetailsAddressImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementBillingDetailsAddressImplToJson( + this, + ); + } +} + +abstract class _PaymentElementBillingDetailsAddress + implements PaymentElementBillingDetailsAddress { + const factory _PaymentElementBillingDetailsAddress( + {final String? line1, + final String? line2, + final String? city, + final String? state, + final String? country, + @JsonKey(name: 'postal_code') final String? postalCode}) = + _$PaymentElementBillingDetailsAddressImpl; + + factory _PaymentElementBillingDetailsAddress.fromJson( + Map json) = + _$PaymentElementBillingDetailsAddressImpl.fromJson; + + @override + + /// Address line 1 (e.g., street, PO Box, or company name). + String? get line1; + @override + + /// Address line 2 (e.g., apartment, suite, unit, or building). + String? get line2; + @override + + /// City, district, suburb, town, or village. + String? get city; + @override + + /// State, county, province, or region. + String? get state; + @override + + /// Two-letter country code (ISO 3166-1 alpha-2). + String? get country; + @override + + /// ZIP or postal code. + @JsonKey(name: 'postal_code') + String? get postalCode; + @override + @JsonKey(ignore: true) + _$$PaymentElementBillingDetailsAddressImplCopyWith< + _$PaymentElementBillingDetailsAddressImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementBusiness _$PaymentElementBusinessFromJson( + Map json) { + return _PaymentElementBusiness.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementBusiness { + String? get name => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementBusinessCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementBusinessCopyWith<$Res> { + factory $PaymentElementBusinessCopyWith(PaymentElementBusiness value, + $Res Function(PaymentElementBusiness) then) = + _$PaymentElementBusinessCopyWithImpl<$Res, PaymentElementBusiness>; + @useResult + $Res call({String? name}); +} + +/// @nodoc +class _$PaymentElementBusinessCopyWithImpl<$Res, + $Val extends PaymentElementBusiness> + implements $PaymentElementBusinessCopyWith<$Res> { + _$PaymentElementBusinessCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + }) { + return _then(_value.copyWith( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementBusinessImplCopyWith<$Res> + implements $PaymentElementBusinessCopyWith<$Res> { + factory _$$PaymentElementBusinessImplCopyWith( + _$PaymentElementBusinessImpl value, + $Res Function(_$PaymentElementBusinessImpl) then) = + __$$PaymentElementBusinessImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? name}); +} + +/// @nodoc +class __$$PaymentElementBusinessImplCopyWithImpl<$Res> + extends _$PaymentElementBusinessCopyWithImpl<$Res, + _$PaymentElementBusinessImpl> + implements _$$PaymentElementBusinessImplCopyWith<$Res> { + __$$PaymentElementBusinessImplCopyWithImpl( + _$PaymentElementBusinessImpl _value, + $Res Function(_$PaymentElementBusinessImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + }) { + return _then(_$PaymentElementBusinessImpl( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementBusinessImpl implements _PaymentElementBusiness { + const _$PaymentElementBusinessImpl({this.name}); + + factory _$PaymentElementBusinessImpl.fromJson(Map json) => + _$$PaymentElementBusinessImplFromJson(json); + + @override + final String? name; + + @override + String toString() { + return 'PaymentElementBusiness(name: $name)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementBusinessImpl && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, name); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementBusinessImplCopyWith<_$PaymentElementBusinessImpl> + get copyWith => __$$PaymentElementBusinessImplCopyWithImpl< + _$PaymentElementBusinessImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementBusinessImplToJson( + this, + ); + } +} + +abstract class _PaymentElementBusiness implements PaymentElementBusiness { + const factory _PaymentElementBusiness({final String? name}) = + _$PaymentElementBusinessImpl; + + factory _PaymentElementBusiness.fromJson(Map json) = + _$PaymentElementBusinessImpl.fromJson; + + @override + String? get name; + @override + @JsonKey(ignore: true) + _$$PaymentElementBusinessImplCopyWith<_$PaymentElementBusinessImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementFields _$PaymentElementFieldsFromJson(Map json) { + return _PaymentElementFields.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementFields { + /// Specify never to avoid collecting all billing details in the + /// Payment Element. + /// If you would like to disable only certain billing details, + /// pass an BillingDetailsFields specifying which fields you would like + /// to disable collection for. + /// The default setting for each field is auto. + BillingDetailsFields get billingDetails => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementFieldsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementFieldsCopyWith<$Res> { + factory $PaymentElementFieldsCopyWith(PaymentElementFields value, + $Res Function(PaymentElementFields) then) = + _$PaymentElementFieldsCopyWithImpl<$Res, PaymentElementFields>; + @useResult + $Res call({BillingDetailsFields billingDetails}); + + $BillingDetailsFieldsCopyWith<$Res> get billingDetails; +} + +/// @nodoc +class _$PaymentElementFieldsCopyWithImpl<$Res, + $Val extends PaymentElementFields> + implements $PaymentElementFieldsCopyWith<$Res> { + _$PaymentElementFieldsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? billingDetails = null, + }) { + return _then(_value.copyWith( + billingDetails: null == billingDetails + ? _value.billingDetails + : billingDetails // ignore: cast_nullable_to_non_nullable + as BillingDetailsFields, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $BillingDetailsFieldsCopyWith<$Res> get billingDetails { + return $BillingDetailsFieldsCopyWith<$Res>(_value.billingDetails, (value) { + return _then(_value.copyWith(billingDetails: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PaymentElementFieldsImplCopyWith<$Res> + implements $PaymentElementFieldsCopyWith<$Res> { + factory _$$PaymentElementFieldsImplCopyWith(_$PaymentElementFieldsImpl value, + $Res Function(_$PaymentElementFieldsImpl) then) = + __$$PaymentElementFieldsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({BillingDetailsFields billingDetails}); + + @override + $BillingDetailsFieldsCopyWith<$Res> get billingDetails; +} + +/// @nodoc +class __$$PaymentElementFieldsImplCopyWithImpl<$Res> + extends _$PaymentElementFieldsCopyWithImpl<$Res, _$PaymentElementFieldsImpl> + implements _$$PaymentElementFieldsImplCopyWith<$Res> { + __$$PaymentElementFieldsImplCopyWithImpl(_$PaymentElementFieldsImpl _value, + $Res Function(_$PaymentElementFieldsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? billingDetails = null, + }) { + return _then(_$PaymentElementFieldsImpl( + billingDetails: null == billingDetails + ? _value.billingDetails + : billingDetails // ignore: cast_nullable_to_non_nullable + as BillingDetailsFields, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementFieldsImpl implements _PaymentElementFields { + const _$PaymentElementFieldsImpl( + {this.billingDetails = BillingDetailsFields.auto}); + + factory _$PaymentElementFieldsImpl.fromJson(Map json) => + _$$PaymentElementFieldsImplFromJson(json); + + /// Specify never to avoid collecting all billing details in the + /// Payment Element. + /// If you would like to disable only certain billing details, + /// pass an BillingDetailsFields specifying which fields you would like + /// to disable collection for. + /// The default setting for each field is auto. + @override + @JsonKey() + final BillingDetailsFields billingDetails; + + @override + String toString() { + return 'PaymentElementFields(billingDetails: $billingDetails)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementFieldsImpl && + (identical(other.billingDetails, billingDetails) || + other.billingDetails == billingDetails)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, billingDetails); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementFieldsImplCopyWith<_$PaymentElementFieldsImpl> + get copyWith => + __$$PaymentElementFieldsImplCopyWithImpl<_$PaymentElementFieldsImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementFieldsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementFields implements PaymentElementFields { + const factory _PaymentElementFields( + {final BillingDetailsFields billingDetails}) = _$PaymentElementFieldsImpl; + + factory _PaymentElementFields.fromJson(Map json) = + _$PaymentElementFieldsImpl.fromJson; + + @override + + /// Specify never to avoid collecting all billing details in the + /// Payment Element. + /// If you would like to disable only certain billing details, + /// pass an BillingDetailsFields specifying which fields you would like + /// to disable collection for. + /// The default setting for each field is auto. + BillingDetailsFields get billingDetails; + @override + @JsonKey(ignore: true) + _$$PaymentElementFieldsImplCopyWith<_$PaymentElementFieldsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +BillingDetailsFields _$BillingDetailsFieldsFromJson(Map json) { + return _BillingDetailsFields.fromJson(json); +} + +/// @nodoc +mixin _$BillingDetailsFields { + PaymentElementFieldRequired get name => throw _privateConstructorUsedError; + PaymentElementFieldRequired get email => throw _privateConstructorUsedError; + PaymentElementFieldRequired get phone => throw _privateConstructorUsedError; + PaymentElementAddressFields get address => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $BillingDetailsFieldsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BillingDetailsFieldsCopyWith<$Res> { + factory $BillingDetailsFieldsCopyWith(BillingDetailsFields value, + $Res Function(BillingDetailsFields) then) = + _$BillingDetailsFieldsCopyWithImpl<$Res, BillingDetailsFields>; + @useResult + $Res call( + {PaymentElementFieldRequired name, + PaymentElementFieldRequired email, + PaymentElementFieldRequired phone, + PaymentElementAddressFields address}); + + $PaymentElementAddressFieldsCopyWith<$Res> get address; +} + +/// @nodoc +class _$BillingDetailsFieldsCopyWithImpl<$Res, + $Val extends BillingDetailsFields> + implements $BillingDetailsFieldsCopyWith<$Res> { + _$BillingDetailsFieldsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? email = null, + Object? phone = null, + Object? address = null, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + phone: null == phone + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as PaymentElementAddressFields, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementAddressFieldsCopyWith<$Res> get address { + return $PaymentElementAddressFieldsCopyWith<$Res>(_value.address, (value) { + return _then(_value.copyWith(address: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$BillingDetailsFieldsImplCopyWith<$Res> + implements $BillingDetailsFieldsCopyWith<$Res> { + factory _$$BillingDetailsFieldsImplCopyWith(_$BillingDetailsFieldsImpl value, + $Res Function(_$BillingDetailsFieldsImpl) then) = + __$$BillingDetailsFieldsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementFieldRequired name, + PaymentElementFieldRequired email, + PaymentElementFieldRequired phone, + PaymentElementAddressFields address}); + + @override + $PaymentElementAddressFieldsCopyWith<$Res> get address; +} + +/// @nodoc +class __$$BillingDetailsFieldsImplCopyWithImpl<$Res> + extends _$BillingDetailsFieldsCopyWithImpl<$Res, _$BillingDetailsFieldsImpl> + implements _$$BillingDetailsFieldsImplCopyWith<$Res> { + __$$BillingDetailsFieldsImplCopyWithImpl(_$BillingDetailsFieldsImpl _value, + $Res Function(_$BillingDetailsFieldsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? email = null, + Object? phone = null, + Object? address = null, + }) { + return _then(_$BillingDetailsFieldsImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + phone: null == phone + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as PaymentElementAddressFields, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$BillingDetailsFieldsImpl implements _BillingDetailsFields { + const _$BillingDetailsFieldsImpl( + {this.name = PaymentElementFieldRequired.auto, + this.email = PaymentElementFieldRequired.auto, + this.phone = PaymentElementFieldRequired.auto, + this.address = PaymentElementAddressFields.auto}); + + factory _$BillingDetailsFieldsImpl.fromJson(Map json) => + _$$BillingDetailsFieldsImplFromJson(json); + + @override + @JsonKey() + final PaymentElementFieldRequired name; + @override + @JsonKey() + final PaymentElementFieldRequired email; + @override + @JsonKey() + final PaymentElementFieldRequired phone; + @override + @JsonKey() + final PaymentElementAddressFields address; + + @override + String toString() { + return 'BillingDetailsFields(name: $name, email: $email, phone: $phone, address: $address)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BillingDetailsFieldsImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.email, email) || other.email == email) && + (identical(other.phone, phone) || other.phone == phone) && + (identical(other.address, address) || other.address == address)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, name, email, phone, address); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BillingDetailsFieldsImplCopyWith<_$BillingDetailsFieldsImpl> + get copyWith => + __$$BillingDetailsFieldsImplCopyWithImpl<_$BillingDetailsFieldsImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$BillingDetailsFieldsImplToJson( + this, + ); + } +} + +abstract class _BillingDetailsFields implements BillingDetailsFields { + const factory _BillingDetailsFields( + {final PaymentElementFieldRequired name, + final PaymentElementFieldRequired email, final PaymentElementFieldRequired phone, final PaymentElementAddressFields address}) = _$BillingDetailsFieldsImpl; - factory _BillingDetailsFields.fromJson(Map json) = - _$BillingDetailsFieldsImpl.fromJson; + factory _BillingDetailsFields.fromJson(Map json) = + _$BillingDetailsFieldsImpl.fromJson; + + @override + PaymentElementFieldRequired get name; + @override + PaymentElementFieldRequired get email; + @override + PaymentElementFieldRequired get phone; + @override + PaymentElementAddressFields get address; + @override + @JsonKey(ignore: true) + _$$BillingDetailsFieldsImplCopyWith<_$BillingDetailsFieldsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementAddressFields _$PaymentElementAddressFieldsFromJson( + Map json) { + return _PaymentElementAddressFields.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementAddressFields { + PaymentElementFieldRequired get line1 => throw _privateConstructorUsedError; + PaymentElementFieldRequired get line2 => throw _privateConstructorUsedError; + PaymentElementFieldRequired get city => throw _privateConstructorUsedError; + PaymentElementFieldRequired get state => throw _privateConstructorUsedError; + PaymentElementFieldRequired get country => throw _privateConstructorUsedError; + PaymentElementFieldRequired get postalCode => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementAddressFieldsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementAddressFieldsCopyWith<$Res> { + factory $PaymentElementAddressFieldsCopyWith( + PaymentElementAddressFields value, + $Res Function(PaymentElementAddressFields) then) = + _$PaymentElementAddressFieldsCopyWithImpl<$Res, + PaymentElementAddressFields>; + @useResult + $Res call( + {PaymentElementFieldRequired line1, + PaymentElementFieldRequired line2, + PaymentElementFieldRequired city, + PaymentElementFieldRequired state, + PaymentElementFieldRequired country, + PaymentElementFieldRequired postalCode}); +} + +/// @nodoc +class _$PaymentElementAddressFieldsCopyWithImpl<$Res, + $Val extends PaymentElementAddressFields> + implements $PaymentElementAddressFieldsCopyWith<$Res> { + _$PaymentElementAddressFieldsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? line1 = null, + Object? line2 = null, + Object? city = null, + Object? state = null, + Object? country = null, + Object? postalCode = null, + }) { + return _then(_value.copyWith( + line1: null == line1 + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + line2: null == line2 + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + postalCode: null == postalCode + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementAddressFieldsImplCopyWith<$Res> + implements $PaymentElementAddressFieldsCopyWith<$Res> { + factory _$$PaymentElementAddressFieldsImplCopyWith( + _$PaymentElementAddressFieldsImpl value, + $Res Function(_$PaymentElementAddressFieldsImpl) then) = + __$$PaymentElementAddressFieldsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementFieldRequired line1, + PaymentElementFieldRequired line2, + PaymentElementFieldRequired city, + PaymentElementFieldRequired state, + PaymentElementFieldRequired country, + PaymentElementFieldRequired postalCode}); +} + +/// @nodoc +class __$$PaymentElementAddressFieldsImplCopyWithImpl<$Res> + extends _$PaymentElementAddressFieldsCopyWithImpl<$Res, + _$PaymentElementAddressFieldsImpl> + implements _$$PaymentElementAddressFieldsImplCopyWith<$Res> { + __$$PaymentElementAddressFieldsImplCopyWithImpl( + _$PaymentElementAddressFieldsImpl _value, + $Res Function(_$PaymentElementAddressFieldsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? line1 = null, + Object? line2 = null, + Object? city = null, + Object? state = null, + Object? country = null, + Object? postalCode = null, + }) { + return _then(_$PaymentElementAddressFieldsImpl( + line1: null == line1 + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + line2: null == line2 + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + postalCode: null == postalCode + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as PaymentElementFieldRequired, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementAddressFieldsImpl + implements _PaymentElementAddressFields { + const _$PaymentElementAddressFieldsImpl( + {this.line1 = PaymentElementFieldRequired.auto, + this.line2 = PaymentElementFieldRequired.auto, + this.city = PaymentElementFieldRequired.auto, + this.state = PaymentElementFieldRequired.auto, + this.country = PaymentElementFieldRequired.auto, + this.postalCode = PaymentElementFieldRequired.auto}); + + factory _$PaymentElementAddressFieldsImpl.fromJson( + Map json) => + _$$PaymentElementAddressFieldsImplFromJson(json); + + @override + @JsonKey() + final PaymentElementFieldRequired line1; + @override + @JsonKey() + final PaymentElementFieldRequired line2; + @override + @JsonKey() + final PaymentElementFieldRequired city; + @override + @JsonKey() + final PaymentElementFieldRequired state; + @override + @JsonKey() + final PaymentElementFieldRequired country; + @override + @JsonKey() + final PaymentElementFieldRequired postalCode; + + @override + String toString() { + return 'PaymentElementAddressFields(line1: $line1, line2: $line2, city: $city, state: $state, country: $country, postalCode: $postalCode)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementAddressFieldsImpl && + (identical(other.line1, line1) || other.line1 == line1) && + (identical(other.line2, line2) || other.line2 == line2) && + (identical(other.city, city) || other.city == city) && + (identical(other.state, state) || other.state == state) && + (identical(other.country, country) || other.country == country) && + (identical(other.postalCode, postalCode) || + other.postalCode == postalCode)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, line1, line2, city, state, country, postalCode); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementAddressFieldsImplCopyWith<_$PaymentElementAddressFieldsImpl> + get copyWith => __$$PaymentElementAddressFieldsImplCopyWithImpl< + _$PaymentElementAddressFieldsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementAddressFieldsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementAddressFields + implements PaymentElementAddressFields { + const factory _PaymentElementAddressFields( + {final PaymentElementFieldRequired line1, + final PaymentElementFieldRequired line2, + final PaymentElementFieldRequired city, + final PaymentElementFieldRequired state, + final PaymentElementFieldRequired country, + final PaymentElementFieldRequired postalCode}) = + _$PaymentElementAddressFieldsImpl; + + factory _PaymentElementAddressFields.fromJson(Map json) = + _$PaymentElementAddressFieldsImpl.fromJson; + + @override + PaymentElementFieldRequired get line1; + @override + PaymentElementFieldRequired get line2; + @override + PaymentElementFieldRequired get city; + @override + PaymentElementFieldRequired get state; + @override + PaymentElementFieldRequired get country; + @override + PaymentElementFieldRequired get postalCode; + @override + @JsonKey(ignore: true) + _$$PaymentElementAddressFieldsImplCopyWith<_$PaymentElementAddressFieldsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementOptionsTerms _$PaymentElementOptionsTermsFromJson( + Map json) { + return _PaymentElementOptionsTerms.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementOptionsTerms { + /// Terms for apple pay + PaymentElementShowTerms? get applePay => throw _privateConstructorUsedError; + + /// Terms for aubecs debit + PaymentElementShowTerms? get auBecsDebit => + throw _privateConstructorUsedError; + + /// Terms for bancontact + PaymentElementShowTerms? get bancontact => throw _privateConstructorUsedError; + + /// Terms for card + PaymentElementShowTerms? get card => throw _privateConstructorUsedError; + + /// Terms for cashapp + PaymentElementShowTerms? get cashApp => throw _privateConstructorUsedError; + + /// Terms for googlePay + PaymentElementShowTerms? get googlePay => throw _privateConstructorUsedError; + + /// Terms for ideal + PaymentElementShowTerms? get ideal => throw _privateConstructorUsedError; + + /// Terms for paypal + PaymentElementShowTerms? get payPal => throw _privateConstructorUsedError; + + /// Terms for sepa debit + PaymentElementShowTerms? get sepaDebit => throw _privateConstructorUsedError; + + /// Terms for sofort + PaymentElementShowTerms? get sofort => throw _privateConstructorUsedError; + + /// Terms for usBankAccount + PaymentElementShowTerms? get usBankAccount => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementOptionsTermsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementOptionsTermsCopyWith<$Res> { + factory $PaymentElementOptionsTermsCopyWith(PaymentElementOptionsTerms value, + $Res Function(PaymentElementOptionsTerms) then) = + _$PaymentElementOptionsTermsCopyWithImpl<$Res, + PaymentElementOptionsTerms>; + @useResult + $Res call( + {PaymentElementShowTerms? applePay, + PaymentElementShowTerms? auBecsDebit, + PaymentElementShowTerms? bancontact, + PaymentElementShowTerms? card, + PaymentElementShowTerms? cashApp, + PaymentElementShowTerms? googlePay, + PaymentElementShowTerms? ideal, + PaymentElementShowTerms? payPal, + PaymentElementShowTerms? sepaDebit, + PaymentElementShowTerms? sofort, + PaymentElementShowTerms? usBankAccount}); +} + +/// @nodoc +class _$PaymentElementOptionsTermsCopyWithImpl<$Res, + $Val extends PaymentElementOptionsTerms> + implements $PaymentElementOptionsTermsCopyWith<$Res> { + _$PaymentElementOptionsTermsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? applePay = freezed, + Object? auBecsDebit = freezed, + Object? bancontact = freezed, + Object? card = freezed, + Object? cashApp = freezed, + Object? googlePay = freezed, + Object? ideal = freezed, + Object? payPal = freezed, + Object? sepaDebit = freezed, + Object? sofort = freezed, + Object? usBankAccount = freezed, + }) { + return _then(_value.copyWith( + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + auBecsDebit: freezed == auBecsDebit + ? _value.auBecsDebit + : auBecsDebit // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + bancontact: freezed == bancontact + ? _value.bancontact + : bancontact // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + card: freezed == card + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + cashApp: freezed == cashApp + ? _value.cashApp + : cashApp // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + googlePay: freezed == googlePay + ? _value.googlePay + : googlePay // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + ideal: freezed == ideal + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + payPal: freezed == payPal + ? _value.payPal + : payPal // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + sepaDebit: freezed == sepaDebit + ? _value.sepaDebit + : sepaDebit // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + sofort: freezed == sofort + ? _value.sofort + : sofort // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + usBankAccount: freezed == usBankAccount + ? _value.usBankAccount + : usBankAccount // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementOptionsTermsImplCopyWith<$Res> + implements $PaymentElementOptionsTermsCopyWith<$Res> { + factory _$$PaymentElementOptionsTermsImplCopyWith( + _$PaymentElementOptionsTermsImpl value, + $Res Function(_$PaymentElementOptionsTermsImpl) then) = + __$$PaymentElementOptionsTermsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementShowTerms? applePay, + PaymentElementShowTerms? auBecsDebit, + PaymentElementShowTerms? bancontact, + PaymentElementShowTerms? card, + PaymentElementShowTerms? cashApp, + PaymentElementShowTerms? googlePay, + PaymentElementShowTerms? ideal, + PaymentElementShowTerms? payPal, + PaymentElementShowTerms? sepaDebit, + PaymentElementShowTerms? sofort, + PaymentElementShowTerms? usBankAccount}); +} + +/// @nodoc +class __$$PaymentElementOptionsTermsImplCopyWithImpl<$Res> + extends _$PaymentElementOptionsTermsCopyWithImpl<$Res, + _$PaymentElementOptionsTermsImpl> + implements _$$PaymentElementOptionsTermsImplCopyWith<$Res> { + __$$PaymentElementOptionsTermsImplCopyWithImpl( + _$PaymentElementOptionsTermsImpl _value, + $Res Function(_$PaymentElementOptionsTermsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? applePay = freezed, + Object? auBecsDebit = freezed, + Object? bancontact = freezed, + Object? card = freezed, + Object? cashApp = freezed, + Object? googlePay = freezed, + Object? ideal = freezed, + Object? payPal = freezed, + Object? sepaDebit = freezed, + Object? sofort = freezed, + Object? usBankAccount = freezed, + }) { + return _then(_$PaymentElementOptionsTermsImpl( + applePay: freezed == applePay + ? _value.applePay + : applePay // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + auBecsDebit: freezed == auBecsDebit + ? _value.auBecsDebit + : auBecsDebit // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + bancontact: freezed == bancontact + ? _value.bancontact + : bancontact // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + card: freezed == card + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + cashApp: freezed == cashApp + ? _value.cashApp + : cashApp // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + googlePay: freezed == googlePay + ? _value.googlePay + : googlePay // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + ideal: freezed == ideal + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + payPal: freezed == payPal + ? _value.payPal + : payPal // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + sepaDebit: freezed == sepaDebit + ? _value.sepaDebit + : sepaDebit // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + sofort: freezed == sofort + ? _value.sofort + : sofort // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + usBankAccount: freezed == usBankAccount + ? _value.usBankAccount + : usBankAccount // ignore: cast_nullable_to_non_nullable + as PaymentElementShowTerms?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementOptionsTermsImpl implements _PaymentElementOptionsTerms { + const _$PaymentElementOptionsTermsImpl( + {this.applePay, + this.auBecsDebit, + this.bancontact, + this.card, + this.cashApp, + this.googlePay, + this.ideal, + this.payPal, + this.sepaDebit, + this.sofort, + this.usBankAccount}); + + factory _$PaymentElementOptionsTermsImpl.fromJson( + Map json) => + _$$PaymentElementOptionsTermsImplFromJson(json); + + /// Terms for apple pay + @override + final PaymentElementShowTerms? applePay; + + /// Terms for aubecs debit + @override + final PaymentElementShowTerms? auBecsDebit; + + /// Terms for bancontact + @override + final PaymentElementShowTerms? bancontact; + + /// Terms for card + @override + final PaymentElementShowTerms? card; + + /// Terms for cashapp + @override + final PaymentElementShowTerms? cashApp; + + /// Terms for googlePay + @override + final PaymentElementShowTerms? googlePay; + + /// Terms for ideal + @override + final PaymentElementShowTerms? ideal; + + /// Terms for paypal + @override + final PaymentElementShowTerms? payPal; + + /// Terms for sepa debit + @override + final PaymentElementShowTerms? sepaDebit; + + /// Terms for sofort + @override + final PaymentElementShowTerms? sofort; + + /// Terms for usBankAccount + @override + final PaymentElementShowTerms? usBankAccount; + + @override + String toString() { + return 'PaymentElementOptionsTerms(applePay: $applePay, auBecsDebit: $auBecsDebit, bancontact: $bancontact, card: $card, cashApp: $cashApp, googlePay: $googlePay, ideal: $ideal, payPal: $payPal, sepaDebit: $sepaDebit, sofort: $sofort, usBankAccount: $usBankAccount)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementOptionsTermsImpl && + (identical(other.applePay, applePay) || + other.applePay == applePay) && + (identical(other.auBecsDebit, auBecsDebit) || + other.auBecsDebit == auBecsDebit) && + (identical(other.bancontact, bancontact) || + other.bancontact == bancontact) && + (identical(other.card, card) || other.card == card) && + (identical(other.cashApp, cashApp) || other.cashApp == cashApp) && + (identical(other.googlePay, googlePay) || + other.googlePay == googlePay) && + (identical(other.ideal, ideal) || other.ideal == ideal) && + (identical(other.payPal, payPal) || other.payPal == payPal) && + (identical(other.sepaDebit, sepaDebit) || + other.sepaDebit == sepaDebit) && + (identical(other.sofort, sofort) || other.sofort == sofort) && + (identical(other.usBankAccount, usBankAccount) || + other.usBankAccount == usBankAccount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + applePay, + auBecsDebit, + bancontact, + card, + cashApp, + googlePay, + ideal, + payPal, + sepaDebit, + sofort, + usBankAccount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementOptionsTermsImplCopyWith<_$PaymentElementOptionsTermsImpl> + get copyWith => __$$PaymentElementOptionsTermsImplCopyWithImpl< + _$PaymentElementOptionsTermsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementOptionsTermsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementOptionsTerms + implements PaymentElementOptionsTerms { + const factory _PaymentElementOptionsTerms( + {final PaymentElementShowTerms? applePay, + final PaymentElementShowTerms? auBecsDebit, + final PaymentElementShowTerms? bancontact, + final PaymentElementShowTerms? card, + final PaymentElementShowTerms? cashApp, + final PaymentElementShowTerms? googlePay, + final PaymentElementShowTerms? ideal, + final PaymentElementShowTerms? payPal, + final PaymentElementShowTerms? sepaDebit, + final PaymentElementShowTerms? sofort, + final PaymentElementShowTerms? usBankAccount}) = + _$PaymentElementOptionsTermsImpl; + + factory _PaymentElementOptionsTerms.fromJson(Map json) = + _$PaymentElementOptionsTermsImpl.fromJson; + + @override + + /// Terms for apple pay + PaymentElementShowTerms? get applePay; + @override + + /// Terms for aubecs debit + PaymentElementShowTerms? get auBecsDebit; + @override + + /// Terms for bancontact + PaymentElementShowTerms? get bancontact; + @override + + /// Terms for card + PaymentElementShowTerms? get card; + @override + + /// Terms for cashapp + PaymentElementShowTerms? get cashApp; + @override + + /// Terms for googlePay + PaymentElementShowTerms? get googlePay; + @override + + /// Terms for ideal + PaymentElementShowTerms? get ideal; + @override + + /// Terms for paypal + PaymentElementShowTerms? get payPal; + @override + + /// Terms for sepa debit + PaymentElementShowTerms? get sepaDebit; + @override + + /// Terms for sofort + PaymentElementShowTerms? get sofort; + @override + + /// Terms for usBankAccount + PaymentElementShowTerms? get usBankAccount; + @override + @JsonKey(ignore: true) + _$$PaymentElementOptionsTermsImplCopyWith<_$PaymentElementOptionsTermsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementApplePayOptions _$PaymentElementApplePayOptionsFromJson( + Map json) { + return _PaymentElementApplePayOptions.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementApplePayOptions { + /// Information about a recurring payment with ApplePay + PaymentElementAppleRecurringRequest? get recurringPaymentRequest => + throw _privateConstructorUsedError; + + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? get deferredPaymentRequest => + throw _privateConstructorUsedError; + + /// Information about an auto reload payment with ApplePay + PaymentElementApplePayAutoReloadPaymentRequest? + get automaticReloadPaymentRequest => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementApplePayOptionsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementApplePayOptionsCopyWith<$Res> { + factory $PaymentElementApplePayOptionsCopyWith( + PaymentElementApplePayOptions value, + $Res Function(PaymentElementApplePayOptions) then) = + _$PaymentElementApplePayOptionsCopyWithImpl<$Res, + PaymentElementApplePayOptions>; + @useResult + $Res call( + {PaymentElementAppleRecurringRequest? recurringPaymentRequest, + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest, + PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}); + + $PaymentElementAppleRecurringRequestCopyWith<$Res>? + get recurringPaymentRequest; + $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? + get deferredPaymentRequest; + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>? + get automaticReloadPaymentRequest; +} + +/// @nodoc +class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, + $Val extends PaymentElementApplePayOptions> + implements $PaymentElementApplePayOptionsCopyWith<$Res> { + _$PaymentElementApplePayOptionsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? recurringPaymentRequest = freezed, + Object? deferredPaymentRequest = freezed, + Object? automaticReloadPaymentRequest = freezed, + }) { + return _then(_value.copyWith( + recurringPaymentRequest: freezed == recurringPaymentRequest + ? _value.recurringPaymentRequest + : recurringPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementAppleRecurringRequest?, + deferredPaymentRequest: freezed == deferredPaymentRequest + ? _value.deferredPaymentRequest + : deferredPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayDeferredPaymentRequest?, + automaticReloadPaymentRequest: freezed == automaticReloadPaymentRequest + ? _value.automaticReloadPaymentRequest + : automaticReloadPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayAutoReloadPaymentRequest?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementAppleRecurringRequestCopyWith<$Res>? + get recurringPaymentRequest { + if (_value.recurringPaymentRequest == null) { + return null; + } + + return $PaymentElementAppleRecurringRequestCopyWith<$Res>( + _value.recurringPaymentRequest!, (value) { + return _then(_value.copyWith(recurringPaymentRequest: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? + get deferredPaymentRequest { + if (_value.deferredPaymentRequest == null) { + return null; + } + + return $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>( + _value.deferredPaymentRequest!, (value) { + return _then(_value.copyWith(deferredPaymentRequest: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>? + get automaticReloadPaymentRequest { + if (_value.automaticReloadPaymentRequest == null) { + return null; + } + + return $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>( + _value.automaticReloadPaymentRequest!, (value) { + return _then( + _value.copyWith(automaticReloadPaymentRequest: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PaymentElementApplePayOptionsImplCopyWith<$Res> + implements $PaymentElementApplePayOptionsCopyWith<$Res> { + factory _$$PaymentElementApplePayOptionsImplCopyWith( + _$PaymentElementApplePayOptionsImpl value, + $Res Function(_$PaymentElementApplePayOptionsImpl) then) = + __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementAppleRecurringRequest? recurringPaymentRequest, + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest, + PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}); + + @override + $PaymentElementAppleRecurringRequestCopyWith<$Res>? + get recurringPaymentRequest; + @override + $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? + get deferredPaymentRequest; + @override + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>? + get automaticReloadPaymentRequest; +} + +/// @nodoc +class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> + extends _$PaymentElementApplePayOptionsCopyWithImpl<$Res, + _$PaymentElementApplePayOptionsImpl> + implements _$$PaymentElementApplePayOptionsImplCopyWith<$Res> { + __$$PaymentElementApplePayOptionsImplCopyWithImpl( + _$PaymentElementApplePayOptionsImpl _value, + $Res Function(_$PaymentElementApplePayOptionsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? recurringPaymentRequest = freezed, + Object? deferredPaymentRequest = freezed, + Object? automaticReloadPaymentRequest = freezed, + }) { + return _then(_$PaymentElementApplePayOptionsImpl( + recurringPaymentRequest: freezed == recurringPaymentRequest + ? _value.recurringPaymentRequest + : recurringPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementAppleRecurringRequest?, + deferredPaymentRequest: freezed == deferredPaymentRequest + ? _value.deferredPaymentRequest + : deferredPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayDeferredPaymentRequest?, + automaticReloadPaymentRequest: freezed == automaticReloadPaymentRequest + ? _value.automaticReloadPaymentRequest + : automaticReloadPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayAutoReloadPaymentRequest?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementApplePayOptionsImpl + implements _PaymentElementApplePayOptions { + const _$PaymentElementApplePayOptionsImpl( + {this.recurringPaymentRequest, + this.deferredPaymentRequest, + this.automaticReloadPaymentRequest}); + + factory _$PaymentElementApplePayOptionsImpl.fromJson( + Map json) => + _$$PaymentElementApplePayOptionsImplFromJson(json); + + /// Information about a recurring payment with ApplePay + @override + final PaymentElementAppleRecurringRequest? recurringPaymentRequest; + + /// Information about a deferred payment with ApplePay + @override + final PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest; + + /// Information about an auto reload payment with ApplePay + @override + final PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest; + + @override + String toString() { + return 'PaymentElementApplePayOptions(recurringPaymentRequest: $recurringPaymentRequest, deferredPaymentRequest: $deferredPaymentRequest, automaticReloadPaymentRequest: $automaticReloadPaymentRequest)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementApplePayOptionsImpl && + (identical( + other.recurringPaymentRequest, recurringPaymentRequest) || + other.recurringPaymentRequest == recurringPaymentRequest) && + (identical(other.deferredPaymentRequest, deferredPaymentRequest) || + other.deferredPaymentRequest == deferredPaymentRequest) && + (identical(other.automaticReloadPaymentRequest, + automaticReloadPaymentRequest) || + other.automaticReloadPaymentRequest == + automaticReloadPaymentRequest)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, recurringPaymentRequest, + deferredPaymentRequest, automaticReloadPaymentRequest); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementApplePayOptionsImplCopyWith< + _$PaymentElementApplePayOptionsImpl> + get copyWith => __$$PaymentElementApplePayOptionsImplCopyWithImpl< + _$PaymentElementApplePayOptionsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementApplePayOptionsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementApplePayOptions + implements PaymentElementApplePayOptions { + const factory _PaymentElementApplePayOptions( + {final PaymentElementAppleRecurringRequest? recurringPaymentRequest, + final PaymentElementApplePayDeferredPaymentRequest? + deferredPaymentRequest, + final PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}) = _$PaymentElementApplePayOptionsImpl; + + factory _PaymentElementApplePayOptions.fromJson(Map json) = + _$PaymentElementApplePayOptionsImpl.fromJson; + + @override + + /// Information about a recurring payment with ApplePay + PaymentElementAppleRecurringRequest? get recurringPaymentRequest; + @override + + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? get deferredPaymentRequest; + @override + + /// Information about an auto reload payment with ApplePay + PaymentElementApplePayAutoReloadPaymentRequest? + get automaticReloadPaymentRequest; + @override + @JsonKey(ignore: true) + _$$PaymentElementApplePayOptionsImplCopyWith< + _$PaymentElementApplePayOptionsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementAppleRecurringRequest + _$PaymentElementAppleRecurringRequestFromJson(Map json) { + return _PaymentElementAppleRecurringRequest.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementAppleRecurringRequest { + /// The description of the payment + String get paymentDescription => throw _privateConstructorUsedError; + + /// Management url + String get managementUrl => throw _privateConstructorUsedError; + + /// Information in case of a trial billing + PaymentElementRecurringPaymentProperties? get trialBilling => + throw _privateConstructorUsedError; + + /// Information in case of a regular billing + PaymentElementRecurringPaymentProperties? get regularBilling => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementAppleRecurringRequestCopyWith< + PaymentElementAppleRecurringRequest> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementAppleRecurringRequestCopyWith<$Res> { + factory $PaymentElementAppleRecurringRequestCopyWith( + PaymentElementAppleRecurringRequest value, + $Res Function(PaymentElementAppleRecurringRequest) then) = + _$PaymentElementAppleRecurringRequestCopyWithImpl<$Res, + PaymentElementAppleRecurringRequest>; + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + PaymentElementRecurringPaymentProperties? trialBilling, + PaymentElementRecurringPaymentProperties? regularBilling}); + + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get trialBilling; + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get regularBilling; +} + +/// @nodoc +class _$PaymentElementAppleRecurringRequestCopyWithImpl<$Res, + $Val extends PaymentElementAppleRecurringRequest> + implements $PaymentElementAppleRecurringRequestCopyWith<$Res> { + _$PaymentElementAppleRecurringRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? trialBilling = freezed, + Object? regularBilling = freezed, + }) { + return _then(_value.copyWith( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + trialBilling: freezed == trialBilling + ? _value.trialBilling + : trialBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementRecurringPaymentProperties?, + regularBilling: freezed == regularBilling + ? _value.regularBilling + : regularBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementRecurringPaymentProperties?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get trialBilling { + if (_value.trialBilling == null) { + return null; + } + + return $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>( + _value.trialBilling!, (value) { + return _then(_value.copyWith(trialBilling: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get regularBilling { + if (_value.regularBilling == null) { + return null; + } + + return $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>( + _value.regularBilling!, (value) { + return _then(_value.copyWith(regularBilling: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PaymentElementAppleRecurringRequestImplCopyWith<$Res> + implements $PaymentElementAppleRecurringRequestCopyWith<$Res> { + factory _$$PaymentElementAppleRecurringRequestImplCopyWith( + _$PaymentElementAppleRecurringRequestImpl value, + $Res Function(_$PaymentElementAppleRecurringRequestImpl) then) = + __$$PaymentElementAppleRecurringRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + PaymentElementRecurringPaymentProperties? trialBilling, + PaymentElementRecurringPaymentProperties? regularBilling}); + + @override + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get trialBilling; + @override + $PaymentElementRecurringPaymentPropertiesCopyWith<$Res>? get regularBilling; +} + +/// @nodoc +class __$$PaymentElementAppleRecurringRequestImplCopyWithImpl<$Res> + extends _$PaymentElementAppleRecurringRequestCopyWithImpl<$Res, + _$PaymentElementAppleRecurringRequestImpl> + implements _$$PaymentElementAppleRecurringRequestImplCopyWith<$Res> { + __$$PaymentElementAppleRecurringRequestImplCopyWithImpl( + _$PaymentElementAppleRecurringRequestImpl _value, + $Res Function(_$PaymentElementAppleRecurringRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? trialBilling = freezed, + Object? regularBilling = freezed, + }) { + return _then(_$PaymentElementAppleRecurringRequestImpl( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + trialBilling: freezed == trialBilling + ? _value.trialBilling + : trialBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementRecurringPaymentProperties?, + regularBilling: freezed == regularBilling + ? _value.regularBilling + : regularBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementRecurringPaymentProperties?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementAppleRecurringRequestImpl + implements _PaymentElementAppleRecurringRequest { + const _$PaymentElementAppleRecurringRequestImpl( + {required this.paymentDescription, + required this.managementUrl, + this.trialBilling, + this.regularBilling}); + + factory _$PaymentElementAppleRecurringRequestImpl.fromJson( + Map json) => + _$$PaymentElementAppleRecurringRequestImplFromJson(json); + + /// The description of the payment + @override + final String paymentDescription; + + /// Management url + @override + final String managementUrl; + + /// Information in case of a trial billing + @override + final PaymentElementRecurringPaymentProperties? trialBilling; + + /// Information in case of a regular billing + @override + final PaymentElementRecurringPaymentProperties? regularBilling; + + @override + String toString() { + return 'PaymentElementAppleRecurringRequest(paymentDescription: $paymentDescription, managementUrl: $managementUrl, trialBilling: $trialBilling, regularBilling: $regularBilling)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementAppleRecurringRequestImpl && + (identical(other.paymentDescription, paymentDescription) || + other.paymentDescription == paymentDescription) && + (identical(other.managementUrl, managementUrl) || + other.managementUrl == managementUrl) && + (identical(other.trialBilling, trialBilling) || + other.trialBilling == trialBilling) && + (identical(other.regularBilling, regularBilling) || + other.regularBilling == regularBilling)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, paymentDescription, + managementUrl, trialBilling, regularBilling); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementAppleRecurringRequestImplCopyWith< + _$PaymentElementAppleRecurringRequestImpl> + get copyWith => __$$PaymentElementAppleRecurringRequestImplCopyWithImpl< + _$PaymentElementAppleRecurringRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementAppleRecurringRequestImplToJson( + this, + ); + } +} + +abstract class _PaymentElementAppleRecurringRequest + implements PaymentElementAppleRecurringRequest { + const factory _PaymentElementAppleRecurringRequest( + {required final String paymentDescription, + required final String managementUrl, + final PaymentElementRecurringPaymentProperties? trialBilling, + final PaymentElementRecurringPaymentProperties? regularBilling}) = + _$PaymentElementAppleRecurringRequestImpl; + + factory _PaymentElementAppleRecurringRequest.fromJson( + Map json) = + _$PaymentElementAppleRecurringRequestImpl.fromJson; + + @override + + /// The description of the payment + String get paymentDescription; + @override + + /// Management url + String get managementUrl; + @override + + /// Information in case of a trial billing + PaymentElementRecurringPaymentProperties? get trialBilling; + @override + + /// Information in case of a regular billing + PaymentElementRecurringPaymentProperties? get regularBilling; + @override + @JsonKey(ignore: true) + _$$PaymentElementAppleRecurringRequestImplCopyWith< + _$PaymentElementAppleRecurringRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementRecurringPaymentProperties + _$PaymentElementRecurringPaymentPropertiesFromJson( + Map json) { + return _PaymentElementRecurringPaymentProperties.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementRecurringPaymentProperties { + /// The amount of the payment + double get amount => throw _privateConstructorUsedError; + + /// Description label + String get label => throw _privateConstructorUsedError; + + /// The startdate of the recurring payment + DateTime? get recurringPaymentStartDate => throw _privateConstructorUsedError; + + /// The enddate of the recurring payment + DateTime? get recurringPaymentEndDate => throw _privateConstructorUsedError; + + /// The interval of payment + ApplePayRecurringPaymentTimeInterVal? get recurringPaymentIntervalUnit => + throw _privateConstructorUsedError; + + /// The amount of intervals + int? get recurringPaymentIntervalCount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementRecurringPaymentPropertiesCopyWith< + PaymentElementRecurringPaymentProperties> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementRecurringPaymentPropertiesCopyWith<$Res> { + factory $PaymentElementRecurringPaymentPropertiesCopyWith( + PaymentElementRecurringPaymentProperties value, + $Res Function(PaymentElementRecurringPaymentProperties) then) = + _$PaymentElementRecurringPaymentPropertiesCopyWithImpl<$Res, + PaymentElementRecurringPaymentProperties>; + @useResult + $Res call( + {double amount, + String label, + DateTime? recurringPaymentStartDate, + DateTime? recurringPaymentEndDate, + ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, + int? recurringPaymentIntervalCount}); +} + +/// @nodoc +class _$PaymentElementRecurringPaymentPropertiesCopyWithImpl<$Res, + $Val extends PaymentElementRecurringPaymentProperties> + implements $PaymentElementRecurringPaymentPropertiesCopyWith<$Res> { + _$PaymentElementRecurringPaymentPropertiesCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + Object? label = null, + Object? recurringPaymentStartDate = freezed, + Object? recurringPaymentEndDate = freezed, + Object? recurringPaymentIntervalUnit = freezed, + Object? recurringPaymentIntervalCount = freezed, + }) { + return _then(_value.copyWith( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + recurringPaymentStartDate: freezed == recurringPaymentStartDate + ? _value.recurringPaymentStartDate + : recurringPaymentStartDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + recurringPaymentEndDate: freezed == recurringPaymentEndDate + ? _value.recurringPaymentEndDate + : recurringPaymentEndDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + recurringPaymentIntervalUnit: freezed == recurringPaymentIntervalUnit + ? _value.recurringPaymentIntervalUnit + : recurringPaymentIntervalUnit // ignore: cast_nullable_to_non_nullable + as ApplePayRecurringPaymentTimeInterVal?, + recurringPaymentIntervalCount: freezed == recurringPaymentIntervalCount + ? _value.recurringPaymentIntervalCount + : recurringPaymentIntervalCount // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementRecurringPaymentPropertiesImplCopyWith<$Res> + implements $PaymentElementRecurringPaymentPropertiesCopyWith<$Res> { + factory _$$PaymentElementRecurringPaymentPropertiesImplCopyWith( + _$PaymentElementRecurringPaymentPropertiesImpl value, + $Res Function(_$PaymentElementRecurringPaymentPropertiesImpl) then) = + __$$PaymentElementRecurringPaymentPropertiesImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {double amount, + String label, + DateTime? recurringPaymentStartDate, + DateTime? recurringPaymentEndDate, + ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, + int? recurringPaymentIntervalCount}); +} + +/// @nodoc +class __$$PaymentElementRecurringPaymentPropertiesImplCopyWithImpl<$Res> + extends _$PaymentElementRecurringPaymentPropertiesCopyWithImpl<$Res, + _$PaymentElementRecurringPaymentPropertiesImpl> + implements _$$PaymentElementRecurringPaymentPropertiesImplCopyWith<$Res> { + __$$PaymentElementRecurringPaymentPropertiesImplCopyWithImpl( + _$PaymentElementRecurringPaymentPropertiesImpl _value, + $Res Function(_$PaymentElementRecurringPaymentPropertiesImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + Object? label = null, + Object? recurringPaymentStartDate = freezed, + Object? recurringPaymentEndDate = freezed, + Object? recurringPaymentIntervalUnit = freezed, + Object? recurringPaymentIntervalCount = freezed, + }) { + return _then(_$PaymentElementRecurringPaymentPropertiesImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + recurringPaymentStartDate: freezed == recurringPaymentStartDate + ? _value.recurringPaymentStartDate + : recurringPaymentStartDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + recurringPaymentEndDate: freezed == recurringPaymentEndDate + ? _value.recurringPaymentEndDate + : recurringPaymentEndDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + recurringPaymentIntervalUnit: freezed == recurringPaymentIntervalUnit + ? _value.recurringPaymentIntervalUnit + : recurringPaymentIntervalUnit // ignore: cast_nullable_to_non_nullable + as ApplePayRecurringPaymentTimeInterVal?, + recurringPaymentIntervalCount: freezed == recurringPaymentIntervalCount + ? _value.recurringPaymentIntervalCount + : recurringPaymentIntervalCount // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementRecurringPaymentPropertiesImpl + implements _PaymentElementRecurringPaymentProperties { + const _$PaymentElementRecurringPaymentPropertiesImpl( + {required this.amount, + required this.label, + this.recurringPaymentStartDate, + this.recurringPaymentEndDate, + this.recurringPaymentIntervalUnit, + this.recurringPaymentIntervalCount}); + + factory _$PaymentElementRecurringPaymentPropertiesImpl.fromJson( + Map json) => + _$$PaymentElementRecurringPaymentPropertiesImplFromJson(json); + + /// The amount of the payment + @override + final double amount; + + /// Description label + @override + final String label; + + /// The startdate of the recurring payment + @override + final DateTime? recurringPaymentStartDate; + + /// The enddate of the recurring payment + @override + final DateTime? recurringPaymentEndDate; + + /// The interval of payment + @override + final ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit; + + /// The amount of intervals + @override + final int? recurringPaymentIntervalCount; + + @override + String toString() { + return 'PaymentElementRecurringPaymentProperties(amount: $amount, label: $label, recurringPaymentStartDate: $recurringPaymentStartDate, recurringPaymentEndDate: $recurringPaymentEndDate, recurringPaymentIntervalUnit: $recurringPaymentIntervalUnit, recurringPaymentIntervalCount: $recurringPaymentIntervalCount)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementRecurringPaymentPropertiesImpl && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.label, label) || other.label == label) && + (identical(other.recurringPaymentStartDate, + recurringPaymentStartDate) || + other.recurringPaymentStartDate == recurringPaymentStartDate) && + (identical( + other.recurringPaymentEndDate, recurringPaymentEndDate) || + other.recurringPaymentEndDate == recurringPaymentEndDate) && + (identical(other.recurringPaymentIntervalUnit, + recurringPaymentIntervalUnit) || + other.recurringPaymentIntervalUnit == + recurringPaymentIntervalUnit) && + (identical(other.recurringPaymentIntervalCount, + recurringPaymentIntervalCount) || + other.recurringPaymentIntervalCount == + recurringPaymentIntervalCount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + amount, + label, + recurringPaymentStartDate, + recurringPaymentEndDate, + recurringPaymentIntervalUnit, + recurringPaymentIntervalCount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementRecurringPaymentPropertiesImplCopyWith< + _$PaymentElementRecurringPaymentPropertiesImpl> + get copyWith => + __$$PaymentElementRecurringPaymentPropertiesImplCopyWithImpl< + _$PaymentElementRecurringPaymentPropertiesImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementRecurringPaymentPropertiesImplToJson( + this, + ); + } +} + +abstract class _PaymentElementRecurringPaymentProperties + implements PaymentElementRecurringPaymentProperties { + const factory _PaymentElementRecurringPaymentProperties( + {required final double amount, + required final String label, + final DateTime? recurringPaymentStartDate, + final DateTime? recurringPaymentEndDate, + final ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, + final int? recurringPaymentIntervalCount}) = + _$PaymentElementRecurringPaymentPropertiesImpl; + + factory _PaymentElementRecurringPaymentProperties.fromJson( + Map json) = + _$PaymentElementRecurringPaymentPropertiesImpl.fromJson; + + @override + + /// The amount of the payment + double get amount; + @override + + /// Description label + String get label; + @override + + /// The startdate of the recurring payment + DateTime? get recurringPaymentStartDate; + @override + + /// The enddate of the recurring payment + DateTime? get recurringPaymentEndDate; + @override + + /// The interval of payment + ApplePayRecurringPaymentTimeInterVal? get recurringPaymentIntervalUnit; + @override + + /// The amount of intervals + int? get recurringPaymentIntervalCount; + @override + @JsonKey(ignore: true) + _$$PaymentElementRecurringPaymentPropertiesImplCopyWith< + _$PaymentElementRecurringPaymentPropertiesImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementApplePayDeferredPaymentRequest + _$PaymentElementApplePayDeferredPaymentRequestFromJson( + Map json) { + return _PaymentElementApplePayDeferredPaymentRequest.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementApplePayDeferredPaymentRequest { + /// The description of the payment + String get paymentDescription => throw _privateConstructorUsedError; + + /// Management url + String get managementUrl => throw _privateConstructorUsedError; + + /// Billing agreement label + String? get billingAgreement => throw _privateConstructorUsedError; + + /// The date when you can cancel for free + DateTime? get freeCancellationDate => throw _privateConstructorUsedError; + + /// The timezone of the free cancellation date + String? get freeCancellationTimezone => throw _privateConstructorUsedError; + + /// Billing information of the deffered payment + PaymentElementApplePayDeferredPaymentProperties get deferredBilling => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementApplePayDeferredPaymentRequestCopyWith< + PaymentElementApplePayDeferredPaymentRequest> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res> { + factory $PaymentElementApplePayDeferredPaymentRequestCopyWith( + PaymentElementApplePayDeferredPaymentRequest value, + $Res Function(PaymentElementApplePayDeferredPaymentRequest) then) = + _$PaymentElementApplePayDeferredPaymentRequestCopyWithImpl<$Res, + PaymentElementApplePayDeferredPaymentRequest>; + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + String? billingAgreement, + DateTime? freeCancellationDate, + String? freeCancellationTimezone, + PaymentElementApplePayDeferredPaymentProperties deferredBilling}); + + $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> + get deferredBilling; +} + +/// @nodoc +class _$PaymentElementApplePayDeferredPaymentRequestCopyWithImpl<$Res, + $Val extends PaymentElementApplePayDeferredPaymentRequest> + implements $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res> { + _$PaymentElementApplePayDeferredPaymentRequestCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? billingAgreement = freezed, + Object? freeCancellationDate = freezed, + Object? freeCancellationTimezone = freezed, + Object? deferredBilling = null, + }) { + return _then(_value.copyWith( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + billingAgreement: freezed == billingAgreement + ? _value.billingAgreement + : billingAgreement // ignore: cast_nullable_to_non_nullable + as String?, + freeCancellationDate: freezed == freeCancellationDate + ? _value.freeCancellationDate + : freeCancellationDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + freeCancellationTimezone: freezed == freeCancellationTimezone + ? _value.freeCancellationTimezone + : freeCancellationTimezone // ignore: cast_nullable_to_non_nullable + as String?, + deferredBilling: null == deferredBilling + ? _value.deferredBilling + : deferredBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayDeferredPaymentProperties, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> + get deferredBilling { + return $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res>( + _value.deferredBilling, (value) { + return _then(_value.copyWith(deferredBilling: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PaymentElementApplePayDeferredPaymentRequestImplCopyWith<$Res> + implements $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res> { + factory _$$PaymentElementApplePayDeferredPaymentRequestImplCopyWith( + _$PaymentElementApplePayDeferredPaymentRequestImpl value, + $Res Function(_$PaymentElementApplePayDeferredPaymentRequestImpl) + then) = + __$$PaymentElementApplePayDeferredPaymentRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + String? billingAgreement, + DateTime? freeCancellationDate, + String? freeCancellationTimezone, + PaymentElementApplePayDeferredPaymentProperties deferredBilling}); + + @override + $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> + get deferredBilling; +} + +/// @nodoc +class __$$PaymentElementApplePayDeferredPaymentRequestImplCopyWithImpl<$Res> + extends _$PaymentElementApplePayDeferredPaymentRequestCopyWithImpl<$Res, + _$PaymentElementApplePayDeferredPaymentRequestImpl> + implements + _$$PaymentElementApplePayDeferredPaymentRequestImplCopyWith<$Res> { + __$$PaymentElementApplePayDeferredPaymentRequestImplCopyWithImpl( + _$PaymentElementApplePayDeferredPaymentRequestImpl _value, + $Res Function(_$PaymentElementApplePayDeferredPaymentRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? billingAgreement = freezed, + Object? freeCancellationDate = freezed, + Object? freeCancellationTimezone = freezed, + Object? deferredBilling = null, + }) { + return _then(_$PaymentElementApplePayDeferredPaymentRequestImpl( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + billingAgreement: freezed == billingAgreement + ? _value.billingAgreement + : billingAgreement // ignore: cast_nullable_to_non_nullable + as String?, + freeCancellationDate: freezed == freeCancellationDate + ? _value.freeCancellationDate + : freeCancellationDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + freeCancellationTimezone: freezed == freeCancellationTimezone + ? _value.freeCancellationTimezone + : freeCancellationTimezone // ignore: cast_nullable_to_non_nullable + as String?, + deferredBilling: null == deferredBilling + ? _value.deferredBilling + : deferredBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayDeferredPaymentProperties, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementApplePayDeferredPaymentRequestImpl + implements _PaymentElementApplePayDeferredPaymentRequest { + const _$PaymentElementApplePayDeferredPaymentRequestImpl( + {required this.paymentDescription, + required this.managementUrl, + this.billingAgreement, + this.freeCancellationDate, + this.freeCancellationTimezone, + required this.deferredBilling}); + + factory _$PaymentElementApplePayDeferredPaymentRequestImpl.fromJson( + Map json) => + _$$PaymentElementApplePayDeferredPaymentRequestImplFromJson(json); + + /// The description of the payment + @override + final String paymentDescription; + + /// Management url + @override + final String managementUrl; + + /// Billing agreement label + @override + final String? billingAgreement; + + /// The date when you can cancel for free + @override + final DateTime? freeCancellationDate; + + /// The timezone of the free cancellation date + @override + final String? freeCancellationTimezone; + + /// Billing information of the deffered payment + @override + final PaymentElementApplePayDeferredPaymentProperties deferredBilling; + + @override + String toString() { + return 'PaymentElementApplePayDeferredPaymentRequest(paymentDescription: $paymentDescription, managementUrl: $managementUrl, billingAgreement: $billingAgreement, freeCancellationDate: $freeCancellationDate, freeCancellationTimezone: $freeCancellationTimezone, deferredBilling: $deferredBilling)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementApplePayDeferredPaymentRequestImpl && + (identical(other.paymentDescription, paymentDescription) || + other.paymentDescription == paymentDescription) && + (identical(other.managementUrl, managementUrl) || + other.managementUrl == managementUrl) && + (identical(other.billingAgreement, billingAgreement) || + other.billingAgreement == billingAgreement) && + (identical(other.freeCancellationDate, freeCancellationDate) || + other.freeCancellationDate == freeCancellationDate) && + (identical( + other.freeCancellationTimezone, freeCancellationTimezone) || + other.freeCancellationTimezone == freeCancellationTimezone) && + (identical(other.deferredBilling, deferredBilling) || + other.deferredBilling == deferredBilling)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + paymentDescription, + managementUrl, + billingAgreement, + freeCancellationDate, + freeCancellationTimezone, + deferredBilling); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementApplePayDeferredPaymentRequestImplCopyWith< + _$PaymentElementApplePayDeferredPaymentRequestImpl> + get copyWith => + __$$PaymentElementApplePayDeferredPaymentRequestImplCopyWithImpl< + _$PaymentElementApplePayDeferredPaymentRequestImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementApplePayDeferredPaymentRequestImplToJson( + this, + ); + } +} + +abstract class _PaymentElementApplePayDeferredPaymentRequest + implements PaymentElementApplePayDeferredPaymentRequest { + const factory _PaymentElementApplePayDeferredPaymentRequest( + {required final String paymentDescription, + required final String managementUrl, + final String? billingAgreement, + final DateTime? freeCancellationDate, + final String? freeCancellationTimezone, + required final PaymentElementApplePayDeferredPaymentProperties + deferredBilling}) = + _$PaymentElementApplePayDeferredPaymentRequestImpl; + + factory _PaymentElementApplePayDeferredPaymentRequest.fromJson( + Map json) = + _$PaymentElementApplePayDeferredPaymentRequestImpl.fromJson; + + @override + + /// The description of the payment + String get paymentDescription; + @override + + /// Management url + String get managementUrl; + @override + + /// Billing agreement label + String? get billingAgreement; + @override + + /// The date when you can cancel for free + DateTime? get freeCancellationDate; + @override + + /// The timezone of the free cancellation date + String? get freeCancellationTimezone; + @override + + /// Billing information of the deffered payment + PaymentElementApplePayDeferredPaymentProperties get deferredBilling; + @override + @JsonKey(ignore: true) + _$$PaymentElementApplePayDeferredPaymentRequestImplCopyWith< + _$PaymentElementApplePayDeferredPaymentRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementApplePayDeferredPaymentProperties + _$PaymentElementApplePayDeferredPaymentPropertiesFromJson( + Map json) { + return _PaymentElementApplePayDeferredPaymentProperties.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementApplePayDeferredPaymentProperties { + /// The amount of the payment + double get amount => throw _privateConstructorUsedError; + + /// Description label + String get label => throw _privateConstructorUsedError; + + /// The date when the payment will be processed + DateTime get deferredPaymentDate => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementApplePayDeferredPaymentPropertiesCopyWith< + PaymentElementApplePayDeferredPaymentProperties> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> { + factory $PaymentElementApplePayDeferredPaymentPropertiesCopyWith( + PaymentElementApplePayDeferredPaymentProperties value, + $Res Function(PaymentElementApplePayDeferredPaymentProperties) then) = + _$PaymentElementApplePayDeferredPaymentPropertiesCopyWithImpl<$Res, + PaymentElementApplePayDeferredPaymentProperties>; + @useResult + $Res call({double amount, String label, DateTime deferredPaymentDate}); +} + +/// @nodoc +class _$PaymentElementApplePayDeferredPaymentPropertiesCopyWithImpl<$Res, + $Val extends PaymentElementApplePayDeferredPaymentProperties> + implements $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> { + _$PaymentElementApplePayDeferredPaymentPropertiesCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + Object? label = null, + Object? deferredPaymentDate = null, + }) { + return _then(_value.copyWith( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + deferredPaymentDate: null == deferredPaymentDate + ? _value.deferredPaymentDate + : deferredPaymentDate // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWith< + $Res> + implements $PaymentElementApplePayDeferredPaymentPropertiesCopyWith<$Res> { + factory _$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWith( + _$PaymentElementApplePayDeferredPaymentPropertiesImpl value, + $Res Function(_$PaymentElementApplePayDeferredPaymentPropertiesImpl) + then) = + __$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({double amount, String label, DateTime deferredPaymentDate}); +} + +/// @nodoc +class __$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWithImpl<$Res> + extends _$PaymentElementApplePayDeferredPaymentPropertiesCopyWithImpl<$Res, + _$PaymentElementApplePayDeferredPaymentPropertiesImpl> + implements + _$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWith<$Res> { + __$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWithImpl( + _$PaymentElementApplePayDeferredPaymentPropertiesImpl _value, + $Res Function(_$PaymentElementApplePayDeferredPaymentPropertiesImpl) + _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + Object? label = null, + Object? deferredPaymentDate = null, + }) { + return _then(_$PaymentElementApplePayDeferredPaymentPropertiesImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + deferredPaymentDate: null == deferredPaymentDate + ? _value.deferredPaymentDate + : deferredPaymentDate // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementApplePayDeferredPaymentPropertiesImpl + implements _PaymentElementApplePayDeferredPaymentProperties { + const _$PaymentElementApplePayDeferredPaymentPropertiesImpl( + {required this.amount, + required this.label, + required this.deferredPaymentDate}); + + factory _$PaymentElementApplePayDeferredPaymentPropertiesImpl.fromJson( + Map json) => + _$$PaymentElementApplePayDeferredPaymentPropertiesImplFromJson(json); + + /// The amount of the payment + @override + final double amount; + + /// Description label + @override + final String label; + + /// The date when the payment will be processed + @override + final DateTime deferredPaymentDate; + + @override + String toString() { + return 'PaymentElementApplePayDeferredPaymentProperties(amount: $amount, label: $label, deferredPaymentDate: $deferredPaymentDate)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementApplePayDeferredPaymentPropertiesImpl && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.label, label) || other.label == label) && + (identical(other.deferredPaymentDate, deferredPaymentDate) || + other.deferredPaymentDate == deferredPaymentDate)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, amount, label, deferredPaymentDate); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWith< + _$PaymentElementApplePayDeferredPaymentPropertiesImpl> + get copyWith => + __$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWithImpl< + _$PaymentElementApplePayDeferredPaymentPropertiesImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementApplePayDeferredPaymentPropertiesImplToJson( + this, + ); + } +} + +abstract class _PaymentElementApplePayDeferredPaymentProperties + implements PaymentElementApplePayDeferredPaymentProperties { + const factory _PaymentElementApplePayDeferredPaymentProperties( + {required final double amount, + required final String label, + required final DateTime deferredPaymentDate}) = + _$PaymentElementApplePayDeferredPaymentPropertiesImpl; + + factory _PaymentElementApplePayDeferredPaymentProperties.fromJson( + Map json) = + _$PaymentElementApplePayDeferredPaymentPropertiesImpl.fromJson; + + @override + + /// The amount of the payment + double get amount; + @override + + /// Description label + String get label; + @override + + /// The date when the payment will be processed + DateTime get deferredPaymentDate; + @override + @JsonKey(ignore: true) + _$$PaymentElementApplePayDeferredPaymentPropertiesImplCopyWith< + _$PaymentElementApplePayDeferredPaymentPropertiesImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementApplePayAutoReloadPaymentRequest + _$PaymentElementApplePayAutoReloadPaymentRequestFromJson( + Map json) { + return _PaymentElementApplePayAutoReloadPaymentRequest.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementApplePayAutoReloadPaymentRequest { + /// The description of the payment + String get paymentDescription => throw _privateConstructorUsedError; + + /// Management url + String get managementUrl => throw _privateConstructorUsedError; + + /// Billing information of the deffered payment + PaymentElementApplePayReloadPaymentProperties get automaticReloadBilling => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith< + PaymentElementApplePayAutoReloadPaymentRequest> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res> { + factory $PaymentElementApplePayAutoReloadPaymentRequestCopyWith( + PaymentElementApplePayAutoReloadPaymentRequest value, + $Res Function(PaymentElementApplePayAutoReloadPaymentRequest) then) = + _$PaymentElementApplePayAutoReloadPaymentRequestCopyWithImpl<$Res, + PaymentElementApplePayAutoReloadPaymentRequest>; + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + PaymentElementApplePayReloadPaymentProperties automaticReloadBilling}); + + $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> + get automaticReloadBilling; +} + +/// @nodoc +class _$PaymentElementApplePayAutoReloadPaymentRequestCopyWithImpl<$Res, + $Val extends PaymentElementApplePayAutoReloadPaymentRequest> + implements $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res> { + _$PaymentElementApplePayAutoReloadPaymentRequestCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? automaticReloadBilling = null, + }) { + return _then(_value.copyWith( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + automaticReloadBilling: null == automaticReloadBilling + ? _value.automaticReloadBilling + : automaticReloadBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayReloadPaymentProperties, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> + get automaticReloadBilling { + return $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res>( + _value.automaticReloadBilling, (value) { + return _then(_value.copyWith(automaticReloadBilling: value) as $Val); + }); + } +} +/// @nodoc +abstract class _$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWith< + $Res> + implements $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res> { + factory _$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWith( + _$PaymentElementApplePayAutoReloadPaymentRequestImpl value, + $Res Function(_$PaymentElementApplePayAutoReloadPaymentRequestImpl) + then) = + __$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWithImpl<$Res>; @override - PaymentElementFieldRequired get name; + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + PaymentElementApplePayReloadPaymentProperties automaticReloadBilling}); + @override - PaymentElementFieldRequired get email; + $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> + get automaticReloadBilling; +} + +/// @nodoc +class __$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWithImpl<$Res> + extends _$PaymentElementApplePayAutoReloadPaymentRequestCopyWithImpl<$Res, + _$PaymentElementApplePayAutoReloadPaymentRequestImpl> + implements + _$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWith<$Res> { + __$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWithImpl( + _$PaymentElementApplePayAutoReloadPaymentRequestImpl _value, + $Res Function(_$PaymentElementApplePayAutoReloadPaymentRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') @override - PaymentElementFieldRequired get phone; + $Res call({ + Object? paymentDescription = null, + Object? managementUrl = null, + Object? automaticReloadBilling = null, + }) { + return _then(_$PaymentElementApplePayAutoReloadPaymentRequestImpl( + paymentDescription: null == paymentDescription + ? _value.paymentDescription + : paymentDescription // ignore: cast_nullable_to_non_nullable + as String, + managementUrl: null == managementUrl + ? _value.managementUrl + : managementUrl // ignore: cast_nullable_to_non_nullable + as String, + automaticReloadBilling: null == automaticReloadBilling + ? _value.automaticReloadBilling + : automaticReloadBilling // ignore: cast_nullable_to_non_nullable + as PaymentElementApplePayReloadPaymentProperties, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementApplePayAutoReloadPaymentRequestImpl + implements _PaymentElementApplePayAutoReloadPaymentRequest { + const _$PaymentElementApplePayAutoReloadPaymentRequestImpl( + {required this.paymentDescription, + required this.managementUrl, + required this.automaticReloadBilling}); + + factory _$PaymentElementApplePayAutoReloadPaymentRequestImpl.fromJson( + Map json) => + _$$PaymentElementApplePayAutoReloadPaymentRequestImplFromJson(json); + + /// The description of the payment @override - PaymentElementAddressFields get address; + final String paymentDescription; + + /// Management url + @override + final String managementUrl; + + /// Billing information of the deffered payment + @override + final PaymentElementApplePayReloadPaymentProperties automaticReloadBilling; + + @override + String toString() { + return 'PaymentElementApplePayAutoReloadPaymentRequest(paymentDescription: $paymentDescription, managementUrl: $managementUrl, automaticReloadBilling: $automaticReloadBilling)'; + } + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementApplePayAutoReloadPaymentRequestImpl && + (identical(other.paymentDescription, paymentDescription) || + other.paymentDescription == paymentDescription) && + (identical(other.managementUrl, managementUrl) || + other.managementUrl == managementUrl) && + (identical(other.automaticReloadBilling, automaticReloadBilling) || + other.automaticReloadBilling == automaticReloadBilling)); + } + @JsonKey(ignore: true) - _$$BillingDetailsFieldsImplCopyWith<_$BillingDetailsFieldsImpl> + @override + int get hashCode => Object.hash( + runtimeType, paymentDescription, managementUrl, automaticReloadBilling); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWith< + _$PaymentElementApplePayAutoReloadPaymentRequestImpl> + get copyWith => + __$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWithImpl< + _$PaymentElementApplePayAutoReloadPaymentRequestImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementApplePayAutoReloadPaymentRequestImplToJson( + this, + ); + } +} + +abstract class _PaymentElementApplePayAutoReloadPaymentRequest + implements PaymentElementApplePayAutoReloadPaymentRequest { + const factory _PaymentElementApplePayAutoReloadPaymentRequest( + {required final String paymentDescription, + required final String managementUrl, + required final PaymentElementApplePayReloadPaymentProperties + automaticReloadBilling}) = + _$PaymentElementApplePayAutoReloadPaymentRequestImpl; + + factory _PaymentElementApplePayAutoReloadPaymentRequest.fromJson( + Map json) = + _$PaymentElementApplePayAutoReloadPaymentRequestImpl.fromJson; + + @override + + /// The description of the payment + String get paymentDescription; + @override + + /// Management url + String get managementUrl; + @override + + /// Billing information of the deffered payment + PaymentElementApplePayReloadPaymentProperties get automaticReloadBilling; + @override + @JsonKey(ignore: true) + _$$PaymentElementApplePayAutoReloadPaymentRequestImplCopyWith< + _$PaymentElementApplePayAutoReloadPaymentRequestImpl> get copyWith => throw _privateConstructorUsedError; } -PaymentElementAddressFields _$PaymentElementAddressFieldsFromJson( - Map json) { - return _PaymentElementAddressFields.fromJson(json); +PaymentElementApplePayReloadPaymentProperties + _$PaymentElementApplePayReloadPaymentPropertiesFromJson( + Map json) { + return _PaymentElementApplePayReloadPaymentProperties.fromJson(json); } /// @nodoc -mixin _$PaymentElementAddressFields { - PaymentElementFieldRequired get line1 => throw _privateConstructorUsedError; - PaymentElementFieldRequired get line2 => throw _privateConstructorUsedError; - PaymentElementFieldRequired get city => throw _privateConstructorUsedError; - PaymentElementFieldRequired get state => throw _privateConstructorUsedError; - PaymentElementFieldRequired get country => throw _privateConstructorUsedError; - PaymentElementFieldRequired get postalCode => +mixin _$PaymentElementApplePayReloadPaymentProperties { + /// The amount of the payment + double get amount => throw _privateConstructorUsedError; + + /// Description label + String get label => throw _privateConstructorUsedError; + + /// The date when the threshold amount will be reached + DateTime get automaticReloadPaymentThresholdAmount => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PaymentElementAddressFieldsCopyWith + $PaymentElementApplePayReloadPaymentPropertiesCopyWith< + PaymentElementApplePayReloadPaymentProperties> get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PaymentElementAddressFieldsCopyWith<$Res> { - factory $PaymentElementAddressFieldsCopyWith( - PaymentElementAddressFields value, - $Res Function(PaymentElementAddressFields) then) = - _$PaymentElementAddressFieldsCopyWithImpl<$Res, - PaymentElementAddressFields>; +abstract class $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + factory $PaymentElementApplePayReloadPaymentPropertiesCopyWith( + PaymentElementApplePayReloadPaymentProperties value, + $Res Function(PaymentElementApplePayReloadPaymentProperties) then) = + _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl<$Res, + PaymentElementApplePayReloadPaymentProperties>; @useResult $Res call( - {PaymentElementFieldRequired line1, - PaymentElementFieldRequired line2, - PaymentElementFieldRequired city, - PaymentElementFieldRequired state, - PaymentElementFieldRequired country, - PaymentElementFieldRequired postalCode}); + {double amount, + String label, + DateTime automaticReloadPaymentThresholdAmount}); } /// @nodoc -class _$PaymentElementAddressFieldsCopyWithImpl<$Res, - $Val extends PaymentElementAddressFields> - implements $PaymentElementAddressFieldsCopyWith<$Res> { - _$PaymentElementAddressFieldsCopyWithImpl(this._value, this._then); +class _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl<$Res, + $Val extends PaymentElementApplePayReloadPaymentProperties> + implements $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl( + this._value, this._then); // ignore: unused_field final $Val _value; @@ -2002,211 +5248,174 @@ class _$PaymentElementAddressFieldsCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? line1 = null, - Object? line2 = null, - Object? city = null, - Object? state = null, - Object? country = null, - Object? postalCode = null, + Object? amount = null, + Object? label = null, + Object? automaticReloadPaymentThresholdAmount = null, }) { return _then(_value.copyWith( - line1: null == line1 - ? _value.line1 - : line1 // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - line2: null == line2 - ? _value.line2 - : line2 // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - city: null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - country: null == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - postalCode: null == postalCode - ? _value.postalCode - : postalCode // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + automaticReloadPaymentThresholdAmount: null == + automaticReloadPaymentThresholdAmount + ? _value.automaticReloadPaymentThresholdAmount + : automaticReloadPaymentThresholdAmount // ignore: cast_nullable_to_non_nullable + as DateTime, ) as $Val); } } /// @nodoc -abstract class _$$PaymentElementAddressFieldsImplCopyWith<$Res> - implements $PaymentElementAddressFieldsCopyWith<$Res> { - factory _$$PaymentElementAddressFieldsImplCopyWith( - _$PaymentElementAddressFieldsImpl value, - $Res Function(_$PaymentElementAddressFieldsImpl) then) = - __$$PaymentElementAddressFieldsImplCopyWithImpl<$Res>; +abstract class _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith< + $Res> + implements $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + factory _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith( + _$PaymentElementApplePayReloadPaymentPropertiesImpl value, + $Res Function(_$PaymentElementApplePayReloadPaymentPropertiesImpl) + then) = + __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl<$Res>; @override @useResult $Res call( - {PaymentElementFieldRequired line1, - PaymentElementFieldRequired line2, - PaymentElementFieldRequired city, - PaymentElementFieldRequired state, - PaymentElementFieldRequired country, - PaymentElementFieldRequired postalCode}); + {double amount, + String label, + DateTime automaticReloadPaymentThresholdAmount}); } /// @nodoc -class __$$PaymentElementAddressFieldsImplCopyWithImpl<$Res> - extends _$PaymentElementAddressFieldsCopyWithImpl<$Res, - _$PaymentElementAddressFieldsImpl> - implements _$$PaymentElementAddressFieldsImplCopyWith<$Res> { - __$$PaymentElementAddressFieldsImplCopyWithImpl( - _$PaymentElementAddressFieldsImpl _value, - $Res Function(_$PaymentElementAddressFieldsImpl) _then) +class __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl<$Res> + extends _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl<$Res, + _$PaymentElementApplePayReloadPaymentPropertiesImpl> + implements + _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith<$Res> { + __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl( + _$PaymentElementApplePayReloadPaymentPropertiesImpl _value, + $Res Function(_$PaymentElementApplePayReloadPaymentPropertiesImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? line1 = null, - Object? line2 = null, - Object? city = null, - Object? state = null, - Object? country = null, - Object? postalCode = null, + Object? amount = null, + Object? label = null, + Object? automaticReloadPaymentThresholdAmount = null, }) { - return _then(_$PaymentElementAddressFieldsImpl( - line1: null == line1 - ? _value.line1 - : line1 // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - line2: null == line2 - ? _value.line2 - : line2 // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - city: null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - country: null == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, - postalCode: null == postalCode - ? _value.postalCode - : postalCode // ignore: cast_nullable_to_non_nullable - as PaymentElementFieldRequired, + return _then(_$PaymentElementApplePayReloadPaymentPropertiesImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + label: null == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + automaticReloadPaymentThresholdAmount: null == + automaticReloadPaymentThresholdAmount + ? _value.automaticReloadPaymentThresholdAmount + : automaticReloadPaymentThresholdAmount // ignore: cast_nullable_to_non_nullable + as DateTime, )); } } /// @nodoc @JsonSerializable() -class _$PaymentElementAddressFieldsImpl - implements _PaymentElementAddressFields { - const _$PaymentElementAddressFieldsImpl( - {this.line1 = PaymentElementFieldRequired.auto, - this.line2 = PaymentElementFieldRequired.auto, - this.city = PaymentElementFieldRequired.auto, - this.state = PaymentElementFieldRequired.auto, - this.country = PaymentElementFieldRequired.auto, - this.postalCode = PaymentElementFieldRequired.auto}); - - factory _$PaymentElementAddressFieldsImpl.fromJson( +class _$PaymentElementApplePayReloadPaymentPropertiesImpl + implements _PaymentElementApplePayReloadPaymentProperties { + const _$PaymentElementApplePayReloadPaymentPropertiesImpl( + {required this.amount, + required this.label, + required this.automaticReloadPaymentThresholdAmount}); + + factory _$PaymentElementApplePayReloadPaymentPropertiesImpl.fromJson( Map json) => - _$$PaymentElementAddressFieldsImplFromJson(json); + _$$PaymentElementApplePayReloadPaymentPropertiesImplFromJson(json); + /// The amount of the payment @override - @JsonKey() - final PaymentElementFieldRequired line1; - @override - @JsonKey() - final PaymentElementFieldRequired line2; - @override - @JsonKey() - final PaymentElementFieldRequired city; - @override - @JsonKey() - final PaymentElementFieldRequired state; + final double amount; + + /// Description label @override - @JsonKey() - final PaymentElementFieldRequired country; + final String label; + + /// The date when the threshold amount will be reached @override - @JsonKey() - final PaymentElementFieldRequired postalCode; + final DateTime automaticReloadPaymentThresholdAmount; @override String toString() { - return 'PaymentElementAddressFields(line1: $line1, line2: $line2, city: $city, state: $state, country: $country, postalCode: $postalCode)'; + return 'PaymentElementApplePayReloadPaymentProperties(amount: $amount, label: $label, automaticReloadPaymentThresholdAmount: $automaticReloadPaymentThresholdAmount)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PaymentElementAddressFieldsImpl && - (identical(other.line1, line1) || other.line1 == line1) && - (identical(other.line2, line2) || other.line2 == line2) && - (identical(other.city, city) || other.city == city) && - (identical(other.state, state) || other.state == state) && - (identical(other.country, country) || other.country == country) && - (identical(other.postalCode, postalCode) || - other.postalCode == postalCode)); + other is _$PaymentElementApplePayReloadPaymentPropertiesImpl && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.label, label) || other.label == label) && + (identical(other.automaticReloadPaymentThresholdAmount, + automaticReloadPaymentThresholdAmount) || + other.automaticReloadPaymentThresholdAmount == + automaticReloadPaymentThresholdAmount)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, line1, line2, city, state, country, postalCode); + int get hashCode => Object.hash( + runtimeType, amount, label, automaticReloadPaymentThresholdAmount); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PaymentElementAddressFieldsImplCopyWith<_$PaymentElementAddressFieldsImpl> - get copyWith => __$$PaymentElementAddressFieldsImplCopyWithImpl< - _$PaymentElementAddressFieldsImpl>(this, _$identity); + _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith< + _$PaymentElementApplePayReloadPaymentPropertiesImpl> + get copyWith => + __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl< + _$PaymentElementApplePayReloadPaymentPropertiesImpl>( + this, _$identity); @override Map toJson() { - return _$$PaymentElementAddressFieldsImplToJson( + return _$$PaymentElementApplePayReloadPaymentPropertiesImplToJson( this, ); } } -abstract class _PaymentElementAddressFields - implements PaymentElementAddressFields { - const factory _PaymentElementAddressFields( - {final PaymentElementFieldRequired line1, - final PaymentElementFieldRequired line2, - final PaymentElementFieldRequired city, - final PaymentElementFieldRequired state, - final PaymentElementFieldRequired country, - final PaymentElementFieldRequired postalCode}) = - _$PaymentElementAddressFieldsImpl; +abstract class _PaymentElementApplePayReloadPaymentProperties + implements PaymentElementApplePayReloadPaymentProperties { + const factory _PaymentElementApplePayReloadPaymentProperties( + {required final double amount, + required final String label, + required final DateTime automaticReloadPaymentThresholdAmount}) = + _$PaymentElementApplePayReloadPaymentPropertiesImpl; - factory _PaymentElementAddressFields.fromJson(Map json) = - _$PaymentElementAddressFieldsImpl.fromJson; + factory _PaymentElementApplePayReloadPaymentProperties.fromJson( + Map json) = + _$PaymentElementApplePayReloadPaymentPropertiesImpl.fromJson; @override - PaymentElementFieldRequired get line1; - @override - PaymentElementFieldRequired get line2; - @override - PaymentElementFieldRequired get city; - @override - PaymentElementFieldRequired get state; + + /// The amount of the payment + double get amount; @override - PaymentElementFieldRequired get country; + + /// Description label + String get label; @override - PaymentElementFieldRequired get postalCode; + + /// The date when the threshold amount will be reached + DateTime get automaticReloadPaymentThresholdAmount; @override @JsonKey(ignore: true) - _$$PaymentElementAddressFieldsImplCopyWith<_$PaymentElementAddressFieldsImpl> + _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith< + _$PaymentElementApplePayReloadPaymentPropertiesImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/stripe_js/lib/src/api/elements/payment_element_options.g.dart b/packages/stripe_js/lib/src/api/elements/payment_element_options.g.dart index 4bf4f4d66..2b5f79878 100644 --- a/packages/stripe_js/lib/src/api/elements/payment_element_options.g.dart +++ b/packages/stripe_js/lib/src/api/elements/payment_element_options.g.dart @@ -25,9 +25,19 @@ _$PaymentElementOptionsImpl _$$PaymentElementOptionsImplFromJson(Map json) => ? null : PaymentElementFields.fromJson( Map.from(json['fields'] as Map)), - readOnly: json['readOnly'], - terms: json['terms'], - wallets: json['wallets'], + readOnly: json['readOnly'] as bool?, + terms: json['terms'] == null + ? null + : PaymentElementOptionsTerms.fromJson( + Map.from(json['terms'] as Map)), + wallets: json['wallets'] == null + ? null + : PaymentElementWalletOptions.fromJson( + Map.from(json['wallets'] as Map)), + applePay: json['applePay'] == null + ? null + : PaymentElementApplePayOptions.fromJson( + Map.from(json['applePay'] as Map)), ); Map _$$PaymentElementOptionsImplToJson( @@ -46,8 +56,9 @@ Map _$$PaymentElementOptionsImplToJson( writeNotNull('paymentMethodOrder', instance.paymentMethodOrder); writeNotNull('fields', instance.fields?.toJson()); writeNotNull('readOnly', instance.readOnly); - writeNotNull('terms', instance.terms); - writeNotNull('wallets', instance.wallets); + writeNotNull('terms', instance.terms?.toJson()); + writeNotNull('wallets', instance.wallets?.toJson()); + writeNotNull('applePay', instance.applePay?.toJson()); return val; } @@ -57,6 +68,8 @@ _$PaymentElementLayoutImpl _$$PaymentElementLayoutImplFromJson(Map json) => defaultCollapsed: json['defaultCollapsed'] as bool?, radios: json['radios'] as bool?, spacedAccordionItems: json['spacedAccordionItems'] as bool?, + visibleAccordionItemsCount: + (json['visibleAccordionItemsCount'] as num?)?.toInt(), ); Map _$$PaymentElementLayoutImplToJson( @@ -74,6 +87,8 @@ Map _$$PaymentElementLayoutImplToJson( writeNotNull('defaultCollapsed', instance.defaultCollapsed); writeNotNull('radios', instance.radios); writeNotNull('spacedAccordionItems', instance.spacedAccordionItems); + writeNotNull( + 'visibleAccordionItemsCount', instance.visibleAccordionItemsCount); return val; } @@ -89,6 +104,10 @@ _$PaymentElementDefaultValuesImpl _$$PaymentElementDefaultValuesImplFromJson( ? null : PaymentElementBillingDetails.fromJson( Map.from(json['billingDetails'] as Map)), + paymentMethods: json['paymentMethods'] == null + ? null + : PaymentElementPaymentMethodDefaults.fromJson( + Map.from(json['paymentMethods'] as Map)), ); Map _$$PaymentElementDefaultValuesImplToJson( @@ -102,6 +121,107 @@ Map _$$PaymentElementDefaultValuesImplToJson( } writeNotNull('billingDetails', instance.billingDetails?.toJson()); + writeNotNull('paymentMethods', instance.paymentMethods?.toJson()); + return val; +} + +_$PaymentElementPaymentMethodDefaultsImpl + _$$PaymentElementPaymentMethodDefaultsImplFromJson(Map json) => + _$PaymentElementPaymentMethodDefaultsImpl( + ideal: json['ideal'] == null + ? null + : PaymentElementIdealDefaults.fromJson( + Map.from(json['ideal'] as Map)), + card: json['card'] == null + ? null + : PaymentElementCardDefaults.fromJson( + Map.from(json['card'] as Map)), + ); + +Map _$$PaymentElementPaymentMethodDefaultsImplToJson( + _$PaymentElementPaymentMethodDefaultsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('ideal', instance.ideal?.toJson()); + writeNotNull('card', instance.card?.toJson()); + return val; +} + +_$PaymentElementWalletOptionsImpl _$$PaymentElementWalletOptionsImplFromJson( + Map json) => + _$PaymentElementWalletOptionsImpl( + applePay: $enumDecodeNullable( + _$PaymentElementFieldRequiredEnumMap, json['applePay']), + googlePay: $enumDecodeNullable( + _$PaymentElementFieldRequiredEnumMap, json['googlePay']), + ); + +Map _$$PaymentElementWalletOptionsImplToJson( + _$PaymentElementWalletOptionsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull( + 'applePay', _$PaymentElementFieldRequiredEnumMap[instance.applePay]); + writeNotNull( + 'googlePay', _$PaymentElementFieldRequiredEnumMap[instance.googlePay]); + return val; +} + +const _$PaymentElementFieldRequiredEnumMap = { + PaymentElementFieldRequired.never: 'never', + PaymentElementFieldRequired.auto: 'auto', +}; + +_$PaymentElementIdealDefaultsImpl _$$PaymentElementIdealDefaultsImplFromJson( + Map json) => + _$PaymentElementIdealDefaultsImpl( + bank: json['bank'] as String?, + ); + +Map _$$PaymentElementIdealDefaultsImplToJson( + _$PaymentElementIdealDefaultsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('bank', instance.bank); + return val; +} + +_$PaymentElementCardDefaultsImpl _$$PaymentElementCardDefaultsImplFromJson( + Map json) => + _$PaymentElementCardDefaultsImpl( + network: + (json['network'] as List?)?.map((e) => e as String).toList(), + ); + +Map _$$PaymentElementCardDefaultsImplToJson( + _$PaymentElementCardDefaultsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('network', instance.network); return val; } @@ -223,11 +343,6 @@ Map _$$BillingDetailsFieldsImplToJson( 'address': instance.address.toJson(), }; -const _$PaymentElementFieldRequiredEnumMap = { - PaymentElementFieldRequired.never: 'never', - PaymentElementFieldRequired.auto: 'auto', -}; - _$PaymentElementAddressFieldsImpl _$$PaymentElementAddressFieldsImplFromJson( Map json) => _$PaymentElementAddressFieldsImpl( @@ -261,3 +376,281 @@ Map _$$PaymentElementAddressFieldsImplToJson( 'country': _$PaymentElementFieldRequiredEnumMap[instance.country]!, 'postalCode': _$PaymentElementFieldRequiredEnumMap[instance.postalCode]!, }; + +_$PaymentElementOptionsTermsImpl _$$PaymentElementOptionsTermsImplFromJson( + Map json) => + _$PaymentElementOptionsTermsImpl( + applePay: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['applePay']), + auBecsDebit: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['auBecsDebit']), + bancontact: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['bancontact']), + card: $enumDecodeNullable(_$PaymentElementShowTermsEnumMap, json['card']), + cashApp: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['cashApp']), + googlePay: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['googlePay']), + ideal: + $enumDecodeNullable(_$PaymentElementShowTermsEnumMap, json['ideal']), + payPal: + $enumDecodeNullable(_$PaymentElementShowTermsEnumMap, json['payPal']), + sepaDebit: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['sepaDebit']), + sofort: + $enumDecodeNullable(_$PaymentElementShowTermsEnumMap, json['sofort']), + usBankAccount: $enumDecodeNullable( + _$PaymentElementShowTermsEnumMap, json['usBankAccount']), + ); + +Map _$$PaymentElementOptionsTermsImplToJson( + _$PaymentElementOptionsTermsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('applePay', _$PaymentElementShowTermsEnumMap[instance.applePay]); + writeNotNull( + 'auBecsDebit', _$PaymentElementShowTermsEnumMap[instance.auBecsDebit]); + writeNotNull( + 'bancontact', _$PaymentElementShowTermsEnumMap[instance.bancontact]); + writeNotNull('card', _$PaymentElementShowTermsEnumMap[instance.card]); + writeNotNull('cashApp', _$PaymentElementShowTermsEnumMap[instance.cashApp]); + writeNotNull( + 'googlePay', _$PaymentElementShowTermsEnumMap[instance.googlePay]); + writeNotNull('ideal', _$PaymentElementShowTermsEnumMap[instance.ideal]); + writeNotNull('payPal', _$PaymentElementShowTermsEnumMap[instance.payPal]); + writeNotNull( + 'sepaDebit', _$PaymentElementShowTermsEnumMap[instance.sepaDebit]); + writeNotNull('sofort', _$PaymentElementShowTermsEnumMap[instance.sofort]); + writeNotNull('usBankAccount', + _$PaymentElementShowTermsEnumMap[instance.usBankAccount]); + return val; +} + +const _$PaymentElementShowTermsEnumMap = { + PaymentElementShowTerms.never: 'never', + PaymentElementShowTerms.auto: 'auto', + PaymentElementShowTerms.always: 'always', +}; + +_$PaymentElementApplePayOptionsImpl + _$$PaymentElementApplePayOptionsImplFromJson(Map json) => + _$PaymentElementApplePayOptionsImpl( + recurringPaymentRequest: json['recurringPaymentRequest'] == null + ? null + : PaymentElementAppleRecurringRequest.fromJson( + Map.from( + json['recurringPaymentRequest'] as Map)), + deferredPaymentRequest: json['deferredPaymentRequest'] == null + ? null + : PaymentElementApplePayDeferredPaymentRequest.fromJson( + Map.from( + json['deferredPaymentRequest'] as Map)), + automaticReloadPaymentRequest: + json['automaticReloadPaymentRequest'] == null + ? null + : PaymentElementApplePayAutoReloadPaymentRequest.fromJson( + Map.from( + json['automaticReloadPaymentRequest'] as Map)), + ); + +Map _$$PaymentElementApplePayOptionsImplToJson( + _$PaymentElementApplePayOptionsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull( + 'recurringPaymentRequest', instance.recurringPaymentRequest?.toJson()); + writeNotNull( + 'deferredPaymentRequest', instance.deferredPaymentRequest?.toJson()); + writeNotNull('automaticReloadPaymentRequest', + instance.automaticReloadPaymentRequest?.toJson()); + return val; +} + +_$PaymentElementAppleRecurringRequestImpl + _$$PaymentElementAppleRecurringRequestImplFromJson(Map json) => + _$PaymentElementAppleRecurringRequestImpl( + paymentDescription: json['paymentDescription'] as String, + managementUrl: json['managementUrl'] as String, + trialBilling: json['trialBilling'] == null + ? null + : PaymentElementRecurringPaymentProperties.fromJson( + Map.from(json['trialBilling'] as Map)), + regularBilling: json['regularBilling'] == null + ? null + : PaymentElementRecurringPaymentProperties.fromJson( + Map.from(json['regularBilling'] as Map)), + ); + +Map _$$PaymentElementAppleRecurringRequestImplToJson( + _$PaymentElementAppleRecurringRequestImpl instance) { + final val = { + 'paymentDescription': instance.paymentDescription, + 'managementUrl': instance.managementUrl, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('trialBilling', instance.trialBilling?.toJson()); + writeNotNull('regularBilling', instance.regularBilling?.toJson()); + return val; +} + +_$PaymentElementRecurringPaymentPropertiesImpl + _$$PaymentElementRecurringPaymentPropertiesImplFromJson(Map json) => + _$PaymentElementRecurringPaymentPropertiesImpl( + amount: (json['amount'] as num).toDouble(), + label: json['label'] as String, + recurringPaymentStartDate: json['recurringPaymentStartDate'] == null + ? null + : DateTime.parse(json['recurringPaymentStartDate'] as String), + recurringPaymentEndDate: json['recurringPaymentEndDate'] == null + ? null + : DateTime.parse(json['recurringPaymentEndDate'] as String), + recurringPaymentIntervalUnit: $enumDecodeNullable( + _$ApplePayRecurringPaymentTimeInterValEnumMap, + json['recurringPaymentIntervalUnit']), + recurringPaymentIntervalCount: + (json['recurringPaymentIntervalCount'] as num?)?.toInt(), + ); + +Map _$$PaymentElementRecurringPaymentPropertiesImplToJson( + _$PaymentElementRecurringPaymentPropertiesImpl instance) { + final val = { + 'amount': instance.amount, + 'label': instance.label, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('recurringPaymentStartDate', + instance.recurringPaymentStartDate?.toIso8601String()); + writeNotNull('recurringPaymentEndDate', + instance.recurringPaymentEndDate?.toIso8601String()); + writeNotNull( + 'recurringPaymentIntervalUnit', + _$ApplePayRecurringPaymentTimeInterValEnumMap[ + instance.recurringPaymentIntervalUnit]); + writeNotNull( + 'recurringPaymentIntervalCount', instance.recurringPaymentIntervalCount); + return val; +} + +const _$ApplePayRecurringPaymentTimeInterValEnumMap = { + ApplePayRecurringPaymentTimeInterVal.year: 'year', + ApplePayRecurringPaymentTimeInterVal.month: 'month', + ApplePayRecurringPaymentTimeInterVal.day: 'day', + ApplePayRecurringPaymentTimeInterVal.hour: 'hour', + ApplePayRecurringPaymentTimeInterVal.minute: 'minute', +}; + +_$PaymentElementApplePayDeferredPaymentRequestImpl + _$$PaymentElementApplePayDeferredPaymentRequestImplFromJson(Map json) => + _$PaymentElementApplePayDeferredPaymentRequestImpl( + paymentDescription: json['paymentDescription'] as String, + managementUrl: json['managementUrl'] as String, + billingAgreement: json['billingAgreement'] as String?, + freeCancellationDate: json['freeCancellationDate'] == null + ? null + : DateTime.parse(json['freeCancellationDate'] as String), + freeCancellationTimezone: json['freeCancellationTimezone'] as String?, + deferredBilling: + PaymentElementApplePayDeferredPaymentProperties.fromJson( + Map.from(json['deferredBilling'] as Map)), + ); + +Map _$$PaymentElementApplePayDeferredPaymentRequestImplToJson( + _$PaymentElementApplePayDeferredPaymentRequestImpl instance) { + final val = { + 'paymentDescription': instance.paymentDescription, + 'managementUrl': instance.managementUrl, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('billingAgreement', instance.billingAgreement); + writeNotNull( + 'freeCancellationDate', instance.freeCancellationDate?.toIso8601String()); + writeNotNull('freeCancellationTimezone', instance.freeCancellationTimezone); + val['deferredBilling'] = instance.deferredBilling.toJson(); + return val; +} + +_$PaymentElementApplePayDeferredPaymentPropertiesImpl + _$$PaymentElementApplePayDeferredPaymentPropertiesImplFromJson(Map json) => + _$PaymentElementApplePayDeferredPaymentPropertiesImpl( + amount: (json['amount'] as num).toDouble(), + label: json['label'] as String, + deferredPaymentDate: + DateTime.parse(json['deferredPaymentDate'] as String), + ); + +Map + _$$PaymentElementApplePayDeferredPaymentPropertiesImplToJson( + _$PaymentElementApplePayDeferredPaymentPropertiesImpl instance) => + { + 'amount': instance.amount, + 'label': instance.label, + 'deferredPaymentDate': instance.deferredPaymentDate.toIso8601String(), + }; + +_$PaymentElementApplePayAutoReloadPaymentRequestImpl + _$$PaymentElementApplePayAutoReloadPaymentRequestImplFromJson(Map json) => + _$PaymentElementApplePayAutoReloadPaymentRequestImpl( + paymentDescription: json['paymentDescription'] as String, + managementUrl: json['managementUrl'] as String, + automaticReloadBilling: + PaymentElementApplePayReloadPaymentProperties.fromJson( + Map.from( + json['automaticReloadBilling'] as Map)), + ); + +Map + _$$PaymentElementApplePayAutoReloadPaymentRequestImplToJson( + _$PaymentElementApplePayAutoReloadPaymentRequestImpl instance) => + { + 'paymentDescription': instance.paymentDescription, + 'managementUrl': instance.managementUrl, + 'automaticReloadBilling': instance.automaticReloadBilling.toJson(), + }; + +_$PaymentElementApplePayReloadPaymentPropertiesImpl + _$$PaymentElementApplePayReloadPaymentPropertiesImplFromJson(Map json) => + _$PaymentElementApplePayReloadPaymentPropertiesImpl( + amount: (json['amount'] as num).toDouble(), + label: json['label'] as String, + automaticReloadPaymentThresholdAmount: DateTime.parse( + json['automaticReloadPaymentThresholdAmount'] as String), + ); + +Map _$$PaymentElementApplePayReloadPaymentPropertiesImplToJson( + _$PaymentElementApplePayReloadPaymentPropertiesImpl instance) => + { + 'amount': instance.amount, + 'label': instance.label, + 'automaticReloadPaymentThresholdAmount': + instance.automaticReloadPaymentThresholdAmount.toIso8601String(), + }; diff --git a/packages/stripe_js/lib/src/api/elements/payment_intent_shipping_information.freezed.dart b/packages/stripe_js/lib/src/api/elements/payment_intent_shipping_information.freezed.dart index 01d89cb4f..3ff69eaf5 100644 --- a/packages/stripe_js/lib/src/api/elements/payment_intent_shipping_information.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/payment_intent_shipping_information.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_intent_shipping_information.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); PaymentElementShippingDetails _$PaymentElementShippingDetailsFromJson( Map json) { @@ -128,7 +128,7 @@ class _$PaymentElementShippingDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementShippingDetailsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_data.freezed.dart index 89a1739f4..37d6223df 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_acss_debit_payment_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ConfirmAcssDebitPaymentData _$ConfirmAcssDebitPaymentDataFromJson( Map json) { @@ -129,7 +129,7 @@ class _$ConfirmAcssDebitPaymentDataImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmAcssDebitPaymentDataImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_options.freezed.dart index b9b8a6e30..183599fdb 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_acss_debit_payment_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_acss_debit_payment_options.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ConfirmAcssDebitPaymentOptions _$ConfirmAcssDebitPaymentOptionsFromJson( Map json) { @@ -123,7 +123,7 @@ class _$ConfirmAcssDebitPaymentOptionsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmAcssDebitPaymentOptionsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart index 2c53088bc..bb566f45c 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart @@ -10,21 +10,21 @@ _$PaymentIntentImpl _$$PaymentIntentImplFromJson(Map json) => _$PaymentIntentImpl( id: json['id'] as String, object: json['object'] as String? ?? "payment_intent", - amount: json['amount'] as int, - amountCapturable: json['amount_capturable'] as int?, + amount: (json['amount'] as num).toInt(), + amountCapturable: (json['amount_capturable'] as num?)?.toInt(), amountDetails: json['amount_details'] == null ? const PaymentIntentAmountDetails() : PaymentIntentAmountDetails.fromJson( Map.from(json['amount_details'] as Map)), - amountReceived: json['amount_received'] as int?, + amountReceived: (json['amount_received'] as num?)?.toInt(), application: json['application'] as String?, - applicationFeeAmount: json['application_fee_amount'] as int?, + applicationFeeAmount: (json['application_fee_amount'] as num?)?.toInt(), automaticPaymentMethods: json['automatic_payment_methods'] == null ? null : PaymentIntentAutomaticPaymentMethods.fromJson( Map.from( json['automatic_payment_methods'] as Map)), - canceledAt: json['canceled_at'] as int?, + canceledAt: (json['canceled_at'] as num?)?.toInt(), cancellationReason: $enumDecodeNullable( _$PaymentIntentCancellationReasonEnumMap, json['cancellation_reason']), @@ -36,7 +36,7 @@ _$PaymentIntentImpl _$$PaymentIntentImplFromJson(Map json) => _$PaymentIntentConfirmationMethodEnumMap, json['confirmation_method']) ?? PaymentIntentConfirmationMethod.automatic, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), currency: json['currency'] as String, customer: json['customer'] as String?, description: json['description'] as String?, @@ -231,7 +231,7 @@ Map _$$PaymentIntentAmountDetailsImplToJson( _$PaymentIntentTipImpl _$$PaymentIntentTipImplFromJson(Map json) => _$PaymentIntentTipImpl( - amount: json['amount'] as int?, + amount: (json['amount'] as num?)?.toInt(), ); Map _$$PaymentIntentTipImplToJson( diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method.g.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method.g.dart index 29a49eaa9..1658020c6 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method.g.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method.g.dart @@ -20,7 +20,7 @@ _$PaymentMethodImpl _$$PaymentMethodImplFromJson(Map json) => ) ?? const {}, livemode: json['livemode'] as bool? ?? true, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), card: json['card'] == null ? null : CardPaymentMethod.fromJson( @@ -167,8 +167,8 @@ _$CardPaymentMethodImpl _$$CardPaymentMethodImplFromJson(Map json) => _$CardPaymentMethodImpl( brand: json['brand'] as String?, country: json['country'] as String?, - expYear: json['expYear'] as int?, - expMonth: json['expMonth'] as int?, + expYear: (json['expYear'] as num?)?.toInt(), + expMonth: (json['expMonth'] as num?)?.toInt(), funding: json['funding'] as String?, last4: json['last4'] as String?, preferredNetwork: json['preferredNetwork'] as String?, diff --git a/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_options.freezed.dart b/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_options.freezed.dart index d67665be3..111173984 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_card_setup_options.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ConfirmCardSetupOptions _$ConfirmCardSetupOptionsFromJson( Map json) { @@ -123,7 +123,7 @@ class _$ConfirmCardSetupOptionsImpl implements _ConfirmCardSetupOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmCardSetupOptionsImpl && diff --git a/packages/stripe_js/lib/src/api/setup_intents/confirm_sepa_debit_setup_data.freezed.dart b/packages/stripe_js/lib/src/api/setup_intents/confirm_sepa_debit_setup_data.freezed.dart index baf91f391..9cad1262f 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/confirm_sepa_debit_setup_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/confirm_sepa_debit_setup_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_sepa_debit_setup_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ConfirmSepaDebitSetupData _$ConfirmSepaDebitSetupDataFromJson( Map json) { @@ -119,7 +119,7 @@ class _$ConfirmCardSetupDataImpl implements _ConfirmCardSetupData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmCardSetupDataImpl && diff --git a/packages/stripe_js/lib/src/api/setup_intents/setup_intent.g.dart b/packages/stripe_js/lib/src/api/setup_intents/setup_intent.g.dart index 297f94623..35a5752cd 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/setup_intent.g.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/setup_intent.g.dart @@ -14,7 +14,7 @@ _$SetupIntentImpl _$$SetupIntentImplFromJson(Map json) => _$SetupIntentImpl( cancellationReason: $enumDecodeNullable( _$SetupIntentCancellationReasonEnumMap, json['cancellation_reason']), clientSecret: json['client_secret'] as String, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), customer: json['customer'] as String?, description: json['description'] as String?, flowDirections: (json['flow_directions'] as List?) diff --git a/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart b/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart index f984ec2b8..db8c6dd8e 100644 --- a/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_token_card_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CreateTokenCardData _$CreateTokenCardDataFromJson(Map json) { return _CreateTokenCardData.fromJson(json); @@ -278,7 +278,7 @@ class _$CreateTokenCardDataImpl implements _CreateTokenCardData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreateTokenCardDataImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart b/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart index 6e2165533..3162f1e5f 100644 --- a/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_token_pii_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CreateTokenPIIData _$CreateTokenPIIDataFromJson(Map json) { return _CreateTokenPIIData.fromJson(json); @@ -114,7 +114,7 @@ class _$CreateTokenPIIDataImpl implements _CreateTokenPIIData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreateTokenPIIDataImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/token.freezed.dart b/packages/stripe_js/lib/src/api/tokens/token.freezed.dart index 50c635d7c..21b06bc8b 100644 --- a/packages/stripe_js/lib/src/api/tokens/token.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/token.freezed.dart @@ -12,7 +12,7 @@ part of 'token.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Token _$TokenFromJson(Map json) { return _Token.fromJson(json); @@ -320,7 +320,7 @@ class _$TokenImpl implements _Token { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TokenImpl && @@ -809,7 +809,7 @@ class _$BankAccountTokenImpl implements _BankAccountToken { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BankAccountTokenImpl && @@ -1613,7 +1613,7 @@ class _$CardTokenImpl implements _CardToken { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardTokenImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/token.g.dart b/packages/stripe_js/lib/src/api/tokens/token.g.dart index 0b9d15656..696e6d82c 100644 --- a/packages/stripe_js/lib/src/api/tokens/token.g.dart +++ b/packages/stripe_js/lib/src/api/tokens/token.g.dart @@ -17,7 +17,7 @@ _$TokenImpl _$$TokenImplFromJson(Map json) => _$TokenImpl( ? null : CardToken.fromJson(Map.from(json['card'] as Map)), clientIP: json['client_ip'] as String?, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), livemode: json['livemode'] as bool? ?? true, type: $enumDecode(_$TokenTypeEnumMap, json['type']), used: json['used'] as bool? ?? false, @@ -129,8 +129,8 @@ _$CardTokenImpl _$$CardTokenImplFromJson(Map json) => _$CardTokenImpl( cvcCheck: $enumDecodeNullable(_$VerificationCheckEnumMap, json['cvc_check']), dynamicLast4: json['dynamic_last4'] as String?, - expMonth: json['exp_month'] as int?, - expYear: json['exp_year'] as int?, + expMonth: (json['exp_month'] as num?)?.toInt(), + expYear: (json['exp_year'] as num?)?.toInt(), fingerprint: json['fingerprint'] as String?, funding: $enumDecodeNullable(_$CardFundingTypeEnumMap, json['funding']), last4: json['last4'] as String?, diff --git a/packages/stripe_js/lib/src/js/core/core.dart b/packages/stripe_js/lib/src/js/core/core.dart deleted file mode 100644 index b39f9cf4f..000000000 --- a/packages/stripe_js/lib/src/js/core/core.dart +++ /dev/null @@ -1 +0,0 @@ -export 'promise.dart'; diff --git a/packages/stripe_js/lib/src/js/core/promise.dart b/packages/stripe_js/lib/src/js/core/promise.dart deleted file mode 100644 index 55bf361b4..000000000 --- a/packages/stripe_js/lib/src/js/core/promise.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:js/js.dart'; - -@JS() -abstract class Promise { - external factory Promise( - void executor(void resolve(T result), Function reject)); - external Promise then(void onFulfilled(T result), [Function onRejected]); -} diff --git a/packages/stripe_js/lib/src/js/elements/element_base.dart b/packages/stripe_js/lib/src/js/elements/element_base.dart index 990049d82..32a3d9f2b 100644 --- a/packages/stripe_js/lib/src/js/elements/element_base.dart +++ b/packages/stripe_js/lib/src/js/elements/element_base.dart @@ -1,21 +1,14 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; +import 'dart:js_interop'; +import '../utils/utils.dart'; typedef EventCallback = void Function(T event); -@anonymous -@JS() -abstract class StripeElement implements Element { +extension type const StripeElement(JSObject o) implements JSObject, Element { /// HTMLElement keeps giving this error for some reason: /// Cannot find name 'HTMLElement' - external void mount(dynamic domElement); - /*external void on('blur'|'change'|'focus'|'ready' event, handler handler);*/ - /*external void on('click' event, void handler({ preventDefault: () => void } response));*/ + external void mount(JSAny domElement); - /*external void addEventJsArrayener('blur'|'change'|'focus'|'ready' event, handler handler);*/ - /*external void addEventJsArrayener('click' event, void handler({ preventDefault: () => void } response));*/ - external void addEventJsArrayener( - String event, EventCallback handler); external void focus(); external void blur(); external void clear(); @@ -23,25 +16,13 @@ abstract class StripeElement implements Element { external void destroy(); @JS("on") - external void on(String event, EventCallback handler); -} - -extension ElementExtension on StripeElement { - void onFocus(EventCallback onEvent) { - return on("focus", allowInterop((e) { - onEvent(e); - })); - } + external void _on(String event, JSExportedDartFunction handler); - void onReady(EventCallback onEvent) { - return on("ready", allowInterop((e) { - onEvent(e); - })); + void on(String event, EventCallback handler) { + return _on(event, handler.toJS); } - void onBlur(EventCallback onEvent) { - return on("blur", allowInterop((e) { - onEvent(e); - })); - } + void onFocus(EventCallback onEvent) => on("focus", onEvent); + void onReady(EventCallback onEvent) => on("ready", onEvent); + void onBlur(EventCallback onEvent) => on("blur", onEvent); } diff --git a/packages/stripe_js/lib/src/js/elements/element_card.dart b/packages/stripe_js/lib/src/js/elements/element_card.dart index dc373a2ac..54189db11 100644 --- a/packages/stripe_js/lib/src/js/elements/element_card.dart +++ b/packages/stripe_js/lib/src/js/elements/element_card.dart @@ -1,20 +1,11 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; + import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; -@anonymous -@JS() -abstract class CardPaymentElement extends StripeElement {} - -@anonymous -@JS() -abstract class _JS { - external void update(dynamic options); - external void on(String event, EventCallback handler); -} - -extension CardPaymentExtension on CardPaymentElement { - _JS get js => this as _JS; +extension type CardPaymentElement(StripeElement o) implements StripeElement { + @JS('update') + external void _update(JSAny? options); /// Updates the options the Element was initialized with. /// Updates are merged into the existing configuration. @@ -27,20 +18,19 @@ extension CardPaymentExtension on CardPaymentElement { /// This method can be used to simulate CSS media queries that automatically /// adjust the size of elements when viewed on different devices. void update(CardElementOptions options) { - return js.update(jsify(options.toJson())); + return _update(options.toJson().jsify()); } void onChange(EventCallback onEvent) { - return on("change", allowInterop((e) { - final value = dartify(e) as Map; - final json = value.cast(); - onEvent(CardElementChangeEvent.fromJson(json)); - })); + return on("change", (event) { + onEvent(CardElementChangeEvent.fromJson(event.toDart)); + }); } } extension ElementsExtension on StripeElements { CardPaymentElement createCard([CardElementOptions? options]) { - return create('card', jsify(options?.toJson() ?? {})) as CardPaymentElement; + return create('card', (options?.toJson() ?? {}).jsify()) + as CardPaymentElement; } } diff --git a/packages/stripe_js/lib/src/js/elements/element_creation_options.dart b/packages/stripe_js/lib/src/js/elements/element_creation_options.dart index 1a3a2051e..1a1ff6033 100644 --- a/packages/stripe_js/lib/src/js/elements/element_creation_options.dart +++ b/packages/stripe_js/lib/src/js/elements/element_creation_options.dart @@ -1,39 +1,47 @@ // Module elements -import 'dart:js'; -import 'package:js/js.dart'; import 'package:stripe_js/stripe_js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class JsElementsCreateOptions { - @JS("ElementsCreateOptions") +extension type JsElementsCreateOptions._(JSObject o) { external factory JsElementsCreateOptions({ - JsArray? fonts, + JSArray? fonts, String? locale, String? clientSecret, JsElementAppearance? appearance, - String loader = "auto", + String loader, }); - external JsArray fonts; + external JSArray fonts; external String locale; external String clientSecret; external JsElementAppearance appearance; } -@anonymous -@JS() -class JsElementAppearance { - external String? theme; - external Map? variables; - external Map>? rules; - external String? labels; - @JS("ElementAppearance") - external factory JsElementAppearance({ +extension type JsElementAppearance._(JSObject o) { + factory JsElementAppearance({ String? theme, Map? variables, Map>? rules, String? labels, + }) { + return JsElementAppearance.__( + theme: theme, + variables: variables.jsify(), + rules: rules.jsify(), + labels: labels, + ); + } + + external JsElementAppearance.__({ + String? theme, + JSAny? variables, + JSAny? rules, + String? labels, }); + + external String? theme; + external JSAny? variables; + external JSAny? rules; + external String? labels; } diff --git a/packages/stripe_js/lib/src/js/elements/element_payment.dart b/packages/stripe_js/lib/src/js/elements/element_payment.dart index e6bd150f2..3943cb4fd 100644 --- a/packages/stripe_js/lib/src/js/elements/element_payment.dart +++ b/packages/stripe_js/lib/src/js/elements/element_payment.dart @@ -1,4 +1,5 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; + import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; @@ -6,7 +7,8 @@ extension ElementsPaymentExtension on StripeElements { /// This method creates an instance of the Payment Element. /// [options] : Options for creating the Payment Element. PaymentElement createPayment([PaymentElementOptions? options]) { - return create('payment', jsify(options?.toJson() ?? {})) as PaymentElement; + return create('payment', (options?.toJson() ?? {}).jsify()) + as PaymentElement; } PaymentElement? getPayment([PaymentElementOptions? options]) { @@ -14,28 +16,21 @@ extension ElementsPaymentExtension on StripeElements { } } -@anonymous -@JS() -abstract class PaymentElement extends StripeElement { +extension type PaymentElement(StripeElement o) implements StripeElement { /// Updates the options the Payment Element was initialized with. /// Updates are merged into the existing configuration. + @JS('update') + external void _update([JSAny? options]); - external void update([dynamic options]); - - external void collapse(); -} - -extension ExtendedPaymentElement on PaymentElement { - PaymentElement get js => this; void update([PaymentElementOptions? options]) { - return update(jsify(options?.toJson() ?? {})); + return _update((options?.toJson() ?? {}).jsify()); } + external void collapse(); + void onChange(EventCallback onEvent) { - return on("change", allowInterop((e) { - final value = dartify(e) as Map; - final json = value.cast(); - onEvent(PaymentElementChangeEvent.fromJson(json)); - })); + return on("change", (event) { + onEvent(PaymentElementChangeEvent.fromJson(event.toDart)); + }); } } diff --git a/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart b/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart index 3ac331c33..dd36697e9 100644 --- a/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart +++ b/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart @@ -1,10 +1,8 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; import 'package:stripe_js/stripe_js.dart'; -@anonymous -@JS() -abstract class JsPaymentRequestButtonElementCreateOptions { - @JS("PaymentRequestButtonElementCreateOptions") +extension type JsPaymentRequestButtonElementCreateOptions._(JSObject o) + implements JSObject { external factory JsPaymentRequestButtonElementCreateOptions({ JsPaymentRequest? paymentRequest, JsPaymentRequestButtonElementStyle? style, @@ -13,47 +11,22 @@ abstract class JsPaymentRequestButtonElementCreateOptions { external JsPaymentRequest paymentRequest; } -@anonymous -@JS() -abstract class JsPaymentRequestButtonElementStyle { - @JS("PaymentRequestButtonElementStyle") +extension type JsPaymentRequestButtonElementStyle._(JSObject o) + implements JSObject { external factory JsPaymentRequestButtonElementStyle({ - JsPaymentRequestButtonElementStyleProps? paymentRequestButton, + PaymentRequestButtonStyleOptions? paymentRequestButton, }); - external JsPaymentRequestButtonElementStyleProps? paymentRequestButton; + external PaymentRequestButtonStyleOptions? paymentRequestButton; } -@anonymous -@JS() -abstract class JsPaymentRequestButtonElementStyleProps { - @JS("PaymentRequestButtonElementStyleProps") - external factory JsPaymentRequestButtonElementStyleProps({ - String? theme, - String? type, - String? height, - }); - - /// One of 'dark', 'light', or 'light-outline' - /// Defaults to 'dark' - external String? theme; - - /// One of 'default', 'book', 'buy', or 'donate' - /// Defaults to 'default' - external String? type; - - /// Defaults to '40px'. The width is always '100%'. - external String? height; -} - -@anonymous -@JS() -abstract class PaymentRequestButtonElement extends StripeElement {} +extension type PaymentRequestButtonElement(StripeElement o) + implements StripeElement {} extension ElementsPaymentRequestExtension on StripeElements { PaymentRequestButtonElement createPaymentRequestButton( JsPaymentRequestButtonElementCreateOptions options) { - return create('paymentRequestButton', options) + return create('paymentRequestButton', options.jsify()) as PaymentRequestButtonElement; } } diff --git a/packages/stripe_js/lib/src/js/elements/elements_base.dart b/packages/stripe_js/lib/src/js/elements/elements_base.dart index 6f8978238..256502ea8 100644 --- a/packages/stripe_js/lib/src/js/elements/elements_base.dart +++ b/packages/stripe_js/lib/src/js/elements/elements_base.dart @@ -1,57 +1,38 @@ -import 'dart:js'; - -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class StripeElements implements Elements { - external StripeElement create(String type, [dynamic options]); - +extension type StripeElements(JSObject o) implements JSObject, Elements { + external StripeElement create(String type, [JSAny? options]); external StripeElement? getElement(String type); } -@anonymous -@JS() -abstract class ElementChangeResponse { - external String get elementType; - external set elementType(String v); - external String get brand; - external set brand(String v); - external bool get complete; - external set complete(bool v); - external bool get empty; - external set empty(bool v); - /*{ postalCode: string | number }|String*/ - external dynamic /*{ postalCode: string | number }|String*/ get value; - external set value(dynamic /*{ postalCode: string | number }|String*/ v); - external String get country; - external set country(String v); - external String get bankName; - external set bankName(String v); - external dynamic get error; - external set error(dynamic v); - external factory ElementChangeResponse({ +extension type ElementChangeResponse._(JSObject o) { + external ElementChangeResponse({ String elementType, String brand, bool complete, bool empty, - dynamic /*{ postalCode: string | number }|String*/ value, + JSAny /*{ postalCode: string | number }|String*/ value, String country, String bankName, - dynamic error, + JSAny error, }); + external String elementType; + external String brand; + external bool complete; + external bool empty; + external JSAny /*{ postalCode: string | number }|String*/ get value; + external String country; + external String bankName; + external JSAny error; } -@anonymous -@JS() -abstract class ElementOptions { - external JsArray get fonts; - external set fonts(JsArray v); - external String get locale; - external set locale(String v); - external factory ElementOptions({JsArray fonts, String locale}); +extension type ElementOptions._(JSObject o) { + external ElementOptions({JSArray fonts, String locale}); + + external JSArray fonts; + external String locale; } enum ElementsType { diff --git a/packages/stripe_js/lib/src/js/elements/styles.dart b/packages/stripe_js/lib/src/js/elements/styles.dart index 5608c0958..8a1b0a28b 100644 --- a/packages/stripe_js/lib/src/js/elements/styles.dart +++ b/packages/stripe_js/lib/src/js/elements/styles.dart @@ -1,22 +1,6 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class Style implements StyleOptions { - /*external StyleOptions get :hover;*/ - /*external set :hover(StyleOptions v);*/ - /*external StyleOptions get :focus;*/ - /*external set :focus(StyleOptions v);*/ - /*external StyleOptions get ::placeholder;*/ - /*external set ::placeholder(StyleOptions v);*/ - /*external StyleOptions get ::selection;*/ - /*external set ::selection(StyleOptions v);*/ - /*external StyleOptions get :-webkit-autofill;*/ - /*external set :-webkit-autofill(StyleOptions v);*/ - /*external StyleOptions get :disabled;*/ - /*external set :disabled(StyleOptions v);*/ - /*external StyleOptions get ::-ms-clear;*/ - /*external set ::-ms-clear(StyleOptions v);*/ +extension type Style._(StyleOptions o) implements StyleOptions { external factory Style({ StyleOptions hover, StyleOptions focus, @@ -28,7 +12,7 @@ abstract class Style implements StyleOptions { String fontSmoothing, String fontStyle, String fontVariant, - dynamic /*String|num*/ fontWeight, + JSAny /*String|num*/ fontWeight, String iconColor, String lineHeight, String letterSpacing, @@ -37,26 +21,27 @@ abstract class Style implements StyleOptions { String textShadow, String textTransform, }); + @JS(':hover:') + external StyleOptions hover; + + @JS(':focus') + external StyleOptions focus; + + @JS(':disabled:') + external StyleOptions disabled; + + /*external StyleOptions get ::placeholder;*/ + /*external set ::placeholder(StyleOptions v);*/ + /*external StyleOptions get ::selection;*/ + /*external set ::selection(StyleOptions v);*/ + /*external StyleOptions get :-webkit-autofill;*/ + /*external set :-webkit-autofill(StyleOptions v);*/ + /*external StyleOptions get ::-ms-clear;*/ + /*external set ::-ms-clear(StyleOptions v);*/ } -@anonymous -@JS() -abstract class Font { - external String get family; - external set family(String v); - external String get src; - external set src(String v); - external String get display; - external set display(String v); - external String get style; - external set style(String v); - external String get unicodeRange; - external set unicodeRange(String v); - external String get weight; - external set weight(String v); - external String get cssSrc; - external set cssSrc(String v); - external factory Font({ +extension type Font._(JSObject o) implements JSObject { + external Font({ String family, String src, String display, @@ -65,42 +50,33 @@ abstract class Font { String weight, String cssSrc, }); + + external String family; + external String src; + external String display; + external String style; + external String unicodeRange; + external String weight; + external String cssSrc; } -@anonymous -@JS() -abstract class StyleOptions { +extension type StyleOptions._(JSObject o) implements JSObject { external String get color; - external set color(String v); external String get backgroundColor; - external set backgroundColor(String v); external String get fontFamily; - external set fontFamily(String v); external String get fontSize; - external set fontSize(String v); external String get fontSmoothing; - external set fontSmoothing(String v); external String get fontStyle; - external set fontStyle(String v); external String get fontVariant; - external set fontVariant(String v); - external dynamic /*String|num*/ get fontWeight; - external set fontWeight(dynamic /*String|num*/ v); + external JSAny /*String|num*/ get fontWeight; external String get iconColor; - external set iconColor(String v); external String get lineHeight; - external set lineHeight(String v); external String get letterSpacing; - external set letterSpacing(String v); external String get textAlign; - external set textAlign(String v); external String get textDecoration; - external set textDecoration(String v); external String get textShadow; - external set textShadow(String v); external String get textTransform; - external set textTransform(String v); - external factory StyleOptions({ + external StyleOptions({ String color, String backgroundColor, String fontFamily, @@ -108,7 +84,7 @@ abstract class StyleOptions { String fontSmoothing, String fontStyle, String fontVariant, - dynamic /*String|num*/ fontWeight, + JSAny /*String|num*/ fontWeight, String iconColor, String lineHeight, String letterSpacing, @@ -119,18 +95,31 @@ abstract class StyleOptions { }); } -@anonymous -@JS() -abstract class PaymentRequestButtonStyleOptions { - external String /*'default'|'donate'|'buy'*/ get type; - external set type(String /*'default'|'donate'|'buy'*/ v); - external String /*'dark'|'light'|'light-outline'*/ get theme; - external set theme(String /*'dark'|'light'|'light-outline'*/ v); - external String get height; - external set height(String v); - external factory PaymentRequestButtonStyleOptions({ - String /*'default'|'donate'|'buy'*/ type, - String /*'dark'|'light'|'light-outline'*/ theme, +extension type PaymentRequestButtonStyleOptions._(JSObject o) { + external PaymentRequestButtonStyleOptions({ + PaymentRequestButtonType type, + PaymentRequestButtonTheme theme, String height, }); + + /// One of 'default', 'book', 'buy', or 'donate' + external PaymentRequestButtonType type; + + /// One of 'dark', 'light', or 'light-outline' + external PaymentRequestButtonTheme theme; + + /// Defaults to '40px'. The width is always '100%'. + external String height; +} + +extension type const PaymentRequestButtonType._(String o) { + static const donate = PaymentRequestButtonType._('donate'); + static const buy = PaymentRequestButtonType._('buy'); + static const book = PaymentRequestButtonType._('book'); + static const defaultType = PaymentRequestButtonType._('default'); +} +extension type const PaymentRequestButtonTheme._(String o) { + static const dark = PaymentRequestButtonTheme._('dark'); + static const light = PaymentRequestButtonTheme._('light'); + static const lightOutline = PaymentRequestButtonTheme._('light-outline'); } diff --git a/packages/stripe_js/lib/src/js/js.dart b/packages/stripe_js/lib/src/js/js.dart index 9dbbd0d78..241ff37e7 100644 --- a/packages/stripe_js/lib/src/js/js.dart +++ b/packages/stripe_js/lib/src/js/js.dart @@ -6,4 +6,3 @@ export 'payment_methods/payment_methods.dart'; export 'payment_intents/payment_intents.dart'; export 'payment_requests/payment_requests.dart'; export 'elements/elements.dart'; -export 'core/core.dart'; diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_acss_debit_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_acss_debit_payment.dart index 21d29e3c0..eddc6a0c9 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_acss_debit_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_acss_debit_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; +import 'package:stripe_js/src/js/utils/utils.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; -import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionAcssDebitPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmAcssDebitPayment in the Accept a payment flow for the /// Canadian pre-authorized debit payment method when the customer submits /// your payment form. When called, it will automatically load an on-page @@ -32,21 +30,18 @@ extension ExtensionAcssDebitPayment on Stripe { String clientSecret, { ConfirmAcssDebitPaymentData? data, ConfirmAcssDebitPaymentOptions? options, - }) { - final jsData = jsify(data?.toJson() ?? {}); - final jsOptions = jsify(options?.toJson() ?? {}); - return parseIntentResponse( - js.confirmAcssDebitPayment(clientSecret, jsData, jsOptions), - ); + }) async { + final jsData = (data?.toJson() ?? {}).jsify(); + final jsOptions = (options?.toJson() ?? {}).jsify(); + return _confirmAcssDebitPayment(clientSecret, jsData, jsOptions) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmAcssDebitPayment( + @JS('confirmAcssDebitPayment') + external JSPromise _confirmAcssDebitPayment( String clientSecret, [ - dynamic data, - dynamic options, + JSAny? data, + JSAny? options, ]); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_alipay_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_alipay_payment.dart index ddb9df2da..48318c878 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_alipay_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_alipay_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionAlipayPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmAlipayPayment in the Alipay payment method /// creation flow when the customer submits your payment form. /// When called, it will confirm the PaymentIntent with data you provide, @@ -31,20 +29,17 @@ extension ExtensionAlipayPayment on Stripe { ConfirmAlipayPaymentData? data, ConfirmAlipayPaymentOptions? options, }) { - final jsData = jsify(data?.toJson() ?? {}); - final jsOptions = jsify(options?.toJson() ?? {}); - return parseIntentResponse( - js.confirmAlipayPayment(clientSecret, jsData, jsOptions), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + final jsOptions = (options?.toJson() ?? {}).jsify(); + return _confirmAlipayPayment(clientSecret, jsData, jsOptions) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmAlipayPayment( + @JS('confirmAlipayPayment') + external JSPromise _confirmAlipayPayment( String clientSecret, [ - dynamic data, - dynamic options, + JSAny? data, + JSAny? options, ]); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_card_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_card_payment.dart index 33a990713..051adceb5 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_card_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_card_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionCardPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmCardPayment when the customer submits your payment form. /// When called, it will confirm the PaymentIntent with data you provide and /// carry out 3DS or other next actions if they are required. @@ -28,25 +26,17 @@ extension ExtensionCardPayment on Stripe { ConfirmCardPaymentData? data, ConfirmCardPaymentOptions? options, }) { - print(data?.toJson()); - final jsData = jsify(data?.toJson() ?? {}); - final jsOptions = jsify(options?.toJson() ?? {}); - return parseIntentResponse( - js.confirmCardPayment( - clientSecret, - jsData, - jsOptions, - ), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + final jsOptions = (options?.toJson() ?? {}).jsify(); + return _confirmCardPayment(clientSecret, jsData, jsOptions) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmCardPayment( + @JS('confirmCardPayment') + external JSPromise _confirmCardPayment( String clientSecret, [ - dynamic data, - dynamic options, + JSAny? data, + JSAny? options, ]); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_ideal_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_ideal_payment.dart index 617c9cbd7..2290dfe1e 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_ideal_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_ideal_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionIdealPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmIdealPayment in the iDEAL Payments with Payment /// Methods flow when the customer submits your payment form. /// When called, it will confirm the PaymentIntent with data you provide, @@ -31,20 +29,17 @@ extension ExtensionIdealPayment on Stripe { ConfirmIdealPaymentData? data, ConfirmIdealPaymentOptions? options, }) { - final jsData = jsify(data?.toJson() ?? {}); - final jsOptions = jsify(options?.toJson() ?? {}); - return parseIntentResponse( - js.confirmIdealPayment(clientSecret, jsData, jsOptions), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + final jsOptions = (options?.toJson() ?? {}).jsify(); + return _confirmIdealPayment(clientSecret, jsData, jsOptions) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmIdealPayment( + @JS('confirmIdealPayment') + external JSPromise _confirmIdealPayment( String clientSecret, [ - dynamic data, - dynamic options, + JSAny? data, + JSAny? options, ]); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_payment.dart index 038975baf..f0af62c12 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionConfirmPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmPayment to confirm a PaymentIntent using /// data collected by the Payment Element. /// When called, stripe.confirmPayment will attempt to complete any @@ -43,21 +41,11 @@ extension ExtensionConfirmPayment on Stripe { Future confirmPayment( ConfirmPaymentOptions options, ) { - return parseIntentResponse(js.confirmPayment(jsify(options.toJson()))); + return _confirmPayment(options.toJson().jsify()) + .toDart + .then((response) => response.toDart); } -} - -@anonymous -@JS() -abstract class _JS { - external Promise confirmPayment( - dynamic options, - ); -} -@anonymous -@JS() -abstract class PaymentElementResponse { - external dynamic get error; - external dynamic get PaymentIntent; + @JS('confirmPayment') + external JSPromise _confirmPayment(JSAny? options); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_sepa_debit_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_sepa_debit_payment.dart index 23374d486..720a70c5c 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/confirm_sepa_debit_payment.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_sepa_debit_payment.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionSepaDebitPayment on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmSepaDebitPayment in the SEPA Direct Debit Payments with /// Payment Methods flow when the customer submits your payment form. /// When called, it will confirm the PaymentIntent with data you provide. @@ -31,18 +29,15 @@ extension ExtensionSepaDebitPayment on Stripe { String clientSecret, { ConfirmSepaDebitPaymentData? data, }) { - final jsData = jsify(data?.toJson() ?? {}); - return parseIntentResponse( - js.confirmSepaDebitPayment(clientSecret, jsData), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + return _confirmSepaDebitPayment(clientSecret, jsData) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmSepaDebitPayment( + @JS('confirmSepaDebitPayment') + external JSPromise _confirmSepaDebitPayment( String clientSecret, [ - dynamic data, + JSAny? data, ]); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/handle_card_action.dart b/packages/stripe_js/lib/src/js/payment_intents/handle_card_action.dart index eeb87230d..68ce5dd92 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/handle_card_action.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/handle_card_action.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionHandleCardAction on Stripe { - _JS get js => this as _JS; - /// Use stripe.handleCardAction in the Payment Intents API manual confirmation /// flow to handle a PaymentIntent with the requires_action status. /// It will throw an error if the PaymentIntent has a different status. @@ -24,12 +22,11 @@ extension ExtensionHandleCardAction on Stripe { /// Ensure that your form is accessible by ensuring that success or /// error messages are clearly read out. Future handleCardAction(String clientSecret) { - return parseIntentResponse(js.handleCardAction(clientSecret)); + return _handleCardAction(clientSecret) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise handleCardAction(dynamic clientSecret); + @JS('handleCardAction') + external JSPromise _handleCardAction(String clientSecret); } diff --git a/packages/stripe_js/lib/src/js/payment_intents/retrieve_payment_intent.dart b/packages/stripe_js/lib/src/js/payment_intents/retrieve_payment_intent.dart index d53b7b18f..0d6f0712c 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/retrieve_payment_intent.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/retrieve_payment_intent.dart @@ -1,22 +1,18 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; -extension ExtensionRetreivePaymentIntent on Stripe { - _JS get js => this as _JS; - +extension ExtensionRetrievePaymentIntent on Stripe { /// Retrieve a PaymentIntent using its client secret. /// https://stripe.com/docs/js/payment_intents/retrieve_payment_intent Future retrievePaymentIntent(String clientSecret) { - return parseIntentResponse(js.retrievePaymentIntent(clientSecret)); + return _retrievePaymentIntent(clientSecret) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise retrievePaymentIntent( - String clientSecret, - ); + @JS('retrievePaymentIntent') + external JSPromise _retrievePaymentIntent( + String clientSecret); } diff --git a/packages/stripe_js/lib/src/js/payment_methods/create_payment_method.dart b/packages/stripe_js/lib/src/js/payment_methods/create_payment_method.dart index eacf0826b..9ca8e1dcd 100644 --- a/packages/stripe_js/lib/src/js/payment_methods/create_payment_method.dart +++ b/packages/stripe_js/lib/src/js/payment_methods/create_payment_method.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionCreatePaymentMethod on Stripe { - _JS get js => this as _JS; - /// Use stripe.createPaymentMethod to convert payment information /// collected by elements into a PaymentMethod object that you safely pass /// to your server to use in an API call. @@ -17,17 +15,12 @@ extension ExtensionCreatePaymentMethod on Stripe { /// https://stripe.com/docs/js/payment_methods/create_payment_method Future createPaymentMethod( CreatePaymentMethodData data) { - final jsData = jsify(data.toJson()); - return parsePaymentMethodResponse( - js.createPaymentMethod(jsData), - ); + final jsData = data.toJson().jsify(); + return _createPaymentMethod(jsData) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise createPaymentMethod( - dynamic data, - ); + @JS('createPaymentMethod') + external JSPromise _createPaymentMethod(JSAny? data); } diff --git a/packages/stripe_js/lib/src/js/payment_requests/payment_item.dart b/packages/stripe_js/lib/src/js/payment_requests/payment_item.dart index 36fa5f1c7..2d0ad52cd 100644 --- a/packages/stripe_js/lib/src/js/payment_requests/payment_item.dart +++ b/packages/stripe_js/lib/src/js/payment_requests/payment_item.dart @@ -1,8 +1,6 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class PaymentItem { +extension type PaymentItem._(JSObject o) { external factory PaymentItem({ required num amount, required String label, diff --git a/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart b/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart index e70c77fe3..eb0190acd 100644 --- a/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart +++ b/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart @@ -1,7 +1,7 @@ -import 'package:js/js.dart'; import 'package:stripe_js/src/js/utils/parse_intent_response.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; +import 'dart:js_interop'; extension PaymentRequestExtension on Stripe { _JS get _js => this as _JS; @@ -22,21 +22,20 @@ class PaymentRequest { JsPaymentRequest get js => _js; Future canMakePayment() => - promiseToFuture(_js.canMakePayment()); + _js.canMakePayment().toDart; show() { _js.show(); } void onPaymentMethod(void Function(PaymentResponse) callback) { - _js.on( - 'paymentmethod', - allowInterop((JsPaymentResponse jsResponse) => - callback(PaymentResponse.of(jsResponse)))); + _js.on('paymentmethod', (JsPaymentResponse response) { + callback(PaymentResponse.of(response)); + }); } void onCancel(void Function() callback) { - _js.on('cancel', allowInterop(callback)); + _js.on('cancel', ([_]) => callback); } } @@ -46,39 +45,39 @@ class PaymentResponse { PaymentResponse.of(this._js); PaymentMethod get paymentMethod => - PaymentMethod.fromJson(jsToJsonMap(_js.paymentMethod)); + PaymentMethod.fromJson(_js.paymentMethod.toDart); String get walletName => _js.walletName; Function(String complete) get complete => _js.complete; } -@anonymous -@JS() -abstract class _JS { +extension type _JS._(JSObject o) { external JsPaymentRequest paymentRequest( PaymentRequestCreateOptions options, ); } -@anonymous -@JS() -abstract class JsPaymentResponse { - external dynamic get paymentMethod; +extension type JsPaymentResponse._(JSObject o) { + external JSMap get paymentMethod; external String get walletName; - external void Function(String) get complete; + @JS('complete') + external JSFunction get _complete; + void Function(String) get complete { + return (String val) => _complete.callAsFunction(val.toJS); + } } -@anonymous -@JS() -abstract class JsPaymentRequest { +extension type JsPaymentRequest._(JSObject o) { external String get id; - external Promise canMakePayment(); + external JSPromise canMakePayment(); external void show(); - external void on(String event, dynamic callback); + @JS('on') + external void _on(String event, JSExportedDartFunction callback); + void on(String event, void Function(T v) callback) { + return _on(event, callback.toJS); + } } -@anonymous -@JS() -abstract class CanMakePaymentResponse { +extension type CanMakePaymentResponse._(JSObject o) implements JSObject { external bool get applePay; external bool get googlePay; external bool get link; diff --git a/packages/stripe_js/lib/src/js/payment_requests/payment_request_creation_options.dart b/packages/stripe_js/lib/src/js/payment_requests/payment_request_creation_options.dart index 2ec2bfb10..4e00de631 100644 --- a/packages/stripe_js/lib/src/js/payment_requests/payment_request_creation_options.dart +++ b/packages/stripe_js/lib/src/js/payment_requests/payment_request_creation_options.dart @@ -1,10 +1,7 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class PaymentRequestCreateOptions { - @JS("PaymentRequestCreateOptions") +extension type PaymentRequestCreateOptions._(JSObject o) { external factory PaymentRequestCreateOptions({ required String country, required String currency, @@ -13,8 +10,8 @@ abstract class PaymentRequestCreateOptions { bool requestPayerEmail, bool requestPayerPhone, bool requestShipping, - List shippingOptions, - List disableWallets, + JSArray shippingOptions, + JSArray disableWallets, }); external String country; @@ -24,6 +21,6 @@ abstract class PaymentRequestCreateOptions { external bool requestPayerEmail; external bool requestPayerPhone; external bool requestShipping; - external ShippingOption shippingOptions; - external List disableWallets; + external JSArray shippingOptions; + external JSArray disableWallets; } diff --git a/packages/stripe_js/lib/src/js/payment_requests/shipping_option.dart b/packages/stripe_js/lib/src/js/payment_requests/shipping_option.dart index da61d3820..65ed2d85d 100644 --- a/packages/stripe_js/lib/src/js/payment_requests/shipping_option.dart +++ b/packages/stripe_js/lib/src/js/payment_requests/shipping_option.dart @@ -1,8 +1,6 @@ -import 'package:js/js.dart'; +import 'dart:js_interop'; -@anonymous -@JS() -abstract class ShippingOption { +extension type ShippingOption._(JSObject o) implements JSObject { external factory ShippingOption({ required String id, required String label, diff --git a/packages/stripe_js/lib/src/js/setup_intents/confirm_card_setup.dart b/packages/stripe_js/lib/src/js/setup_intents/confirm_card_setup.dart index c3f6baa38..2b68035c4 100644 --- a/packages/stripe_js/lib/src/js/setup_intents/confirm_card_setup.dart +++ b/packages/stripe_js/lib/src/js/setup_intents/confirm_card_setup.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionConfirmCardSetup on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmCardSetup in the Setup Intents API flow when the /// customer submits your payment form. /// When called, it will confirm the SetupIntent with data you provide and @@ -25,20 +23,17 @@ extension ExtensionConfirmCardSetup on Stripe { ConfirmCardSetupData? data, ConfirmCardSetupOptions? options, }) { - final jsData = jsify(data?.toJson() ?? {}); - final jsOptions = jsify(options?.toJson() ?? {}); - return parseSetupIntentResponse( - js.confirmCardSetup(clientSecret, jsData, jsOptions), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + final jsOptions = (options?.toJson() ?? {}).jsify(); + return _confirmCardSetup(clientSecret, jsData, jsOptions) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmCardSetup( + @JS('confirmCardSetup') + external JSPromise _confirmCardSetup( String clientSecret, [ - dynamic data, - dynamic options, + JSAny? data, + JSAny? options, ]); } diff --git a/packages/stripe_js/lib/src/js/setup_intents/confirm_sepa_debit_setup.dart b/packages/stripe_js/lib/src/js/setup_intents/confirm_sepa_debit_setup.dart index 9f9bcc07b..6cf26712f 100644 --- a/packages/stripe_js/lib/src/js/setup_intents/confirm_sepa_debit_setup.dart +++ b/packages/stripe_js/lib/src/js/setup_intents/confirm_sepa_debit_setup.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionConfirmSepaDebitSetup on Stripe { - _JS get js => this as _JS; - /// Use stripe.confirmSepaDebitSetup in the SEPA Direct Debit with Setup Intents flow when the customer submits your payment form. When called, it will confirm the SetupIntent with data you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our integration guide for more details. /// When you confirm a SetupIntent, it needs to have an attached PaymentMethod. /// In addition to confirming the SetupIntent, this method can automatically @@ -19,18 +17,15 @@ extension ExtensionConfirmSepaDebitSetup on Stripe { String clientSecret, { ConfirmSepaDebitSetupData? data, }) { - final jsData = dartify(data?.toJson() ?? {}); - return parseSetupIntentResponse( - js.confirmSepaDebitSetup(clientSecret, jsData), - ); + final jsData = (data?.toJson() ?? {}).jsify(); + return _confirmSepaDebitSetup(clientSecret, jsData) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise confirmSepaDebitSetup( + @JS('confirmSepaDebitSetup') + external JSPromise _confirmSepaDebitSetup( String clientSecret, [ - dynamic data, + JSAny? data, ]); } diff --git a/packages/stripe_js/lib/src/js/setup_intents/retrieve_setup_intent.dart b/packages/stripe_js/lib/src/js/setup_intents/retrieve_setup_intent.dart index 737d1a5ba..1427c45ba 100644 --- a/packages/stripe_js/lib/src/js/setup_intents/retrieve_setup_intent.dart +++ b/packages/stripe_js/lib/src/js/setup_intents/retrieve_setup_intent.dart @@ -1,22 +1,18 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionRetrieveSetupIntent on Stripe { - _JS get js => this as _JS; - /// Retrieve a SetupIntent using its client secret. /// https://stripe.com/docs/js/setup_intents/retrieve_setup_intent Future retrieveSetupIntent(String clientSecret) { - return parseSetupIntentResponse(js.retrieveSetupIntent(clientSecret)); + return _retrieveSetupIntent(clientSecret) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise retrieveSetupIntent( - String clientSecret, - ); + @JS('retrieveSetupIntent') + external JSPromise _retrieveSetupIntent( + String clientSecret); } diff --git a/packages/stripe_js/lib/src/js/stripe.dart b/packages/stripe_js/lib/src/js/stripe.dart index 909ec7833..81f70ed54 100644 --- a/packages/stripe_js/lib/src/js/stripe.dart +++ b/packages/stripe_js/lib/src/js/stripe.dart @@ -3,14 +3,10 @@ @JS() library types; -import 'package:js/js.dart'; - +import 'dart:js_interop'; import 'package:stripe_js/stripe_js.dart'; -export 'package:js/js_util.dart'; - -@JS() -class Stripe { +extension type Stripe.__(JSObject o) { @JS("Stripe") external Stripe._(String publicKey, [StripeOptions? options]); factory Stripe(String publicKey, [StripeOptions? options]) { @@ -24,18 +20,11 @@ class Stripe { external set stripeAccount(String? stripeAccount); } -@anonymous -@JS() -abstract class StripeOptions { +extension type StripeOptions._(JSObject o) implements JSObject { + external StripeOptions( + {String? stripeAccount, String? apiVersion, String locale}); + external String? stripeAccount; - external String apiVersion; - external List betas; + external String? apiVersion; external String locale; - - external factory StripeOptions({ - String? stripeAccount, - String apiVersion, - List betas, - String locale, - }); } diff --git a/packages/stripe_js/lib/src/js/tokens/create_token.dart b/packages/stripe_js/lib/src/js/tokens/create_token.dart index 969b691eb..ec587c766 100644 --- a/packages/stripe_js/lib/src/js/tokens/create_token.dart +++ b/packages/stripe_js/lib/src/js/tokens/create_token.dart @@ -1,11 +1,9 @@ -import 'package:js/js.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import '../utils/utils.dart'; +import 'dart:js_interop'; extension ExtensionCreateTokenMethod on Stripe { - _JS get js => this as _JS; - /// Use createCardElementToken to convert information collected by card /// elements into a single-use Token that you safely pass to your /// server to use in an API call. @@ -28,20 +26,20 @@ extension ExtensionCreateTokenMethod on Stripe { CardPaymentElement element, [ CreateTokenCardData? data, ]) { - final jsData = data != null ? jsify(data.toJson()) : null; - return parseTokenResponse( - js.createToken(element, jsData), - ); + final jsData = data != null ? data.toJson().jsify() : null; + return _createToken(element, jsData) + .toDart + .then((response) => response.toDart); } /// Use createBankAccountToken to convert bank account information into a /// single-use token that you safely pass to your server to use in an API call. Future createBankAccountToken( CreateTokenBankAccountData data) { - final jsData = jsify(data.toJson()); - return parseTokenResponse( - js.createToken('bank_account', jsData), - ); + final jsData = data.toJson().jsify(); + return _createToken('bank_account'.toJS, jsData) + .toDart + .then((response) => response.toDart); } /// Use createPIIToken to convert personally identifiable information (PII) @@ -49,18 +47,12 @@ extension ExtensionCreateTokenMethod on Stripe { Future createPIIToken( CreateTokenPIIData data, ) { - final jsData = jsify(data.toJson()); - return parseTokenResponse( - js.createToken('pii', jsData), - ); + final jsData = data.toJson().jsify(); + return _createToken('pii'.toJS, jsData) + .toDart + .then((response) => response.toDart); } -} -@anonymous -@JS() -abstract class _JS { - external Promise createToken( - dynamic value, - dynamic data, - ); + @JS('createToken') + external JSPromise _createToken(JSAny? value, JSAny? data); } diff --git a/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart b/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart index bc3a3c494..d69122357 100644 --- a/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart +++ b/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart @@ -1,40 +1,38 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stripe_js/stripe_api.dart'; -import 'package:stripe_js/stripe_js.dart'; +import 'dart:js_interop'; -Future> _parsePromise(Promise promise) async { - return jsToJsonMap(await promiseToFuture(promise)); +extension type JSMap._(JSAny o) implements JSAny { + Map get toDart { + final value = dartify() as Map; + return value.cast(); + } } -@internal -Map jsToJsonMap(dynamic jsObject) { - final value = dartify(jsObject) as Map; - return value.cast(); +extension type JSIntentResponse._(JSMap o) implements JSMap { + @redeclare + PaymentIntentResponse get toDart { + return PaymentIntentResponse.fromJson(o.toDart); + } } -@internal -Future parseIntentResponse( - Promise promise) async { - final response = await _parsePromise(promise); - return PaymentIntentResponse.fromJson(response); +extension type JSSetupIntentResponse._(JSMap o) implements JSMap { + @redeclare + SetupIntentResponse get toDart { + return SetupIntentResponse.fromJson(o.toDart); + } } -@internal -Future parseSetupIntentResponse( - Promise promise) async { - final response = await _parsePromise(promise); - return SetupIntentResponse.fromJson(response); +extension type JSPaymentMethodResponse._(JSMap o) implements JSMap { + @redeclare + PaymentMethodResponse get toDart { + return PaymentMethodResponse.fromJson(o.toDart); + } } -@internal -Future parsePaymentMethodResponse( - Promise promise) async { - final response = await _parsePromise(promise); - return PaymentMethodResponse.fromJson(response); -} - -@internal -Future parseTokenResponse(Promise promise) async { - final response = await _parsePromise(promise); - return TokenResponse.fromJson(response); +extension type JSTokenResponse._(JSMap o) implements JSMap { + @redeclare + TokenResponse get toDart { + return TokenResponse.fromJson(o.toDart); + } } diff --git a/packages/stripe_js/lib/src/loader/stripe_loader.dart b/packages/stripe_js/lib/src/loader/stripe_loader.dart index 7f11389fe..c01c40e71 100644 --- a/packages/stripe_js/lib/src/loader/stripe_loader.dart +++ b/packages/stripe_js/lib/src/loader/stripe_loader.dart @@ -1,13 +1,14 @@ import 'dart:async'; -import 'dart:html'; -import 'dart:js'; +import 'dart:js_interop'; +import 'package:web/web.dart'; +import 'dart:js_interop_unsafe'; const String _version = "v3"; /// Injects a `script` with a `src` dynamically into the head of the current /// document. Future _injectSrcScript(String src, String windowVar) async { - ScriptElement script = ScriptElement(); + HTMLScriptElement script = HTMLScriptElement(); script.type = 'text/javascript'; script.crossOrigin = 'anonymous'; script.text = ''' @@ -20,13 +21,14 @@ Future _injectSrcScript(String src, String windowVar) async { document.head!.append(script); Completer completer = Completer(); - context.callMethod('ff_trigger_$windowVar', [ - (module) { - context[windowVar] = module; - context.deleteProperty('ff_trigger_$windowVar'); + globalContext.callMethod( + 'ff_trigger_$windowVar'.toJS, + ((JSAny? module) { + globalContext[windowVar] = module; + globalContext.delete('ff_trigger_$windowVar'.toJS); completer.complete(); - } - ]); + }).toJS, + ); await completer.future; } @@ -36,7 +38,7 @@ Future _injectSrcScript(String src, String windowVar) async { Future loadStripe() async { // If Stripe is already available, Stripe has already been initialized // (or the user has added the scripts to their html file). - if (context['Stripe'] != null) { + if (globalContext['Stripe'] != null) { return; } diff --git a/packages/stripe_js/pubspec.yaml b/packages/stripe_js/pubspec.yaml index d84fc3ff3..0c6c711bc 100644 --- a/packages/stripe_js/pubspec.yaml +++ b/packages/stripe_js/pubspec.yaml @@ -1,16 +1,17 @@ name: stripe_js description: Stripe.js bindings for dart. This package is used by Stripe web so that the Stripe js sdk can be invoked directly. -version: 3.4.0 +version: 6.0.0-dev.0 homepage: https://github.com/flutter-stripe/flutter_stripe environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" + dependencies: freezed_annotation: ^2.2.0 - js: ^0.6.3 json_annotation: ^4.8.1 meta: ^1.0.0 + web: ^0.5.1 dev_dependencies: build_runner: ^2.3.2 diff --git a/packages/stripe_js/test/src/api/payment_intents/confirm_acss_debit_payment_data_test.dart b/packages/stripe_js/test/src/api/payment_intents/confirm_acss_debit_payment_data_test.dart index eeaa01510..2facbefe2 100644 --- a/packages/stripe_js/test/src/api/payment_intents/confirm_acss_debit_payment_data_test.dart +++ b/packages/stripe_js/test/src/api/payment_intents/confirm_acss_debit_payment_data_test.dart @@ -1,8 +1,6 @@ import 'package:stripe_js/stripe_api.dart'; import 'package:test/test.dart'; -class FakeElement extends Element {} - void main() { group('ConfirmAcssDebitPaymentData', () { test('expected default value', () { diff --git a/packages/stripe_js/test/src/api/payment_intents/confirm_card_payment_data_test.dart b/packages/stripe_js/test/src/api/payment_intents/confirm_card_payment_data_test.dart index 702dbade0..466039dc5 100644 --- a/packages/stripe_js/test/src/api/payment_intents/confirm_card_payment_data_test.dart +++ b/packages/stripe_js/test/src/api/payment_intents/confirm_card_payment_data_test.dart @@ -1,7 +1,9 @@ import 'package:stripe_js/stripe_api.dart'; import 'package:test/test.dart'; -class FakeElement extends Element {} +extension type FakeElement._(Object o) implements Element { + FakeElement() : o = 1; +} void main() { group('ConfirmCardPaymentData', () { diff --git a/packages/stripe_js/test/src/api/payment_intents/confirm_ideal_payment_data_test.dart b/packages/stripe_js/test/src/api/payment_intents/confirm_ideal_payment_data_test.dart index 3eed6db38..bb07d1894 100644 --- a/packages/stripe_js/test/src/api/payment_intents/confirm_ideal_payment_data_test.dart +++ b/packages/stripe_js/test/src/api/payment_intents/confirm_ideal_payment_data_test.dart @@ -1,7 +1,9 @@ import 'package:stripe_js/stripe_api.dart'; import 'package:test/test.dart'; -class FakeElement extends Element {} +extension type FakeElement._(Object o) implements Element { + FakeElement() : o = 1; +} void main() { group('ConfirmIdealPaymentData', () { diff --git a/packages/stripe_js/test/src/api/payment_intents/confirm_sepa_debit_payment_data_test.dart b/packages/stripe_js/test/src/api/payment_intents/confirm_sepa_debit_payment_data_test.dart index eaef9fc79..9e19ff5cd 100644 --- a/packages/stripe_js/test/src/api/payment_intents/confirm_sepa_debit_payment_data_test.dart +++ b/packages/stripe_js/test/src/api/payment_intents/confirm_sepa_debit_payment_data_test.dart @@ -1,8 +1,10 @@ import 'package:stripe_js/stripe_api.dart'; -import 'package:test/test.dart'; -class FakeElement extends Element {} +import 'package:test/test.dart'; +extension type FakeElement._(Object o) implements Element { + FakeElement() : o = 1; +} void main() { group('ConfirmSepaDebitPaymentData', () { test('with sepaDebit element parses correctly', () { diff --git a/packages/stripe_js/test/src/js/elements/element_card_test.dart b/packages/stripe_js/test/src/js/elements/element_card_test.dart index d3b1f47b1..efb929bda 100644 --- a/packages/stripe_js/test/src/js/elements/element_card_test.dart +++ b/packages/stripe_js/test/src/js/elements/element_card_test.dart @@ -2,10 +2,11 @@ @Tags(["browser"]) import 'dart:async'; -import 'dart:html'; + import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import 'package:test/test.dart'; +import 'package:web/web.dart'; import '../helpers/helpers.dart'; @@ -29,21 +30,21 @@ void main() { test('can be mounted', () { expect( - document.getElementsByClassName('__PrivateStripeElement'), - isEmpty, + document.getElementsByClassName('__PrivateStripeElement').length, + 0, ); - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createCard(); card.mount(child); expect( - document.getElementsByClassName('__PrivateStripeElement'), - isNotNull, + document.getElementsByClassName('__PrivateStripeElement').length, + isNot(0), ); }); test('calls on ready', () async { - final child = DivElement(); + final child = HTMLDivElement(); ; document.body!.append(child); await Future.delayed(Duration(seconds: 4)); @@ -59,7 +60,7 @@ void main() { }); test('can listen to focus', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createCard(); card.mount(child); @@ -75,7 +76,7 @@ void main() { expect(onFocusCompleter.future, completes); }); test('can listen to blur', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createCard(); card.mount(child); diff --git a/packages/stripe_js/test/src/js/elements/element_payment_test.dart b/packages/stripe_js/test/src/js/elements/element_payment_test.dart index 71a3bb62f..ac4cd5067 100644 --- a/packages/stripe_js/test/src/js/elements/element_payment_test.dart +++ b/packages/stripe_js/test/src/js/elements/element_payment_test.dart @@ -1,10 +1,12 @@ @TestOn('browser') +@Tags(["browser"]) import 'dart:async'; -import 'dart:html'; + import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import 'package:test/test.dart'; +import 'package:web/web.dart'; import '../helpers/helpers.dart'; @@ -34,21 +36,21 @@ void main() { test('can be mounted', () { expect( - document.getElementsByClassName('__PrivateStripeElement'), - isEmpty, + document.getElementsByClassName('__PrivateStripeElement').length, + 0, ); - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createCard(); card.mount(child); expect( - document.getElementsByClassName('__PrivateStripeElement'), - isNotNull, + document.getElementsByClassName('__PrivateStripeElement').length, + isNot(0), ); }); test('calls on ready', () async { - final child = DivElement(); + final child = HTMLDivElement(); ; document.body!.append(child); await Future.delayed(Duration(seconds: 4)); @@ -64,7 +66,7 @@ void main() { }); test('can listen to focus', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createPayment(); card.mount(child); @@ -80,7 +82,7 @@ void main() { expect(onFocusCompleter.future, completes); }); test('can listen to blur', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = elements.createPayment(); card.mount(child); diff --git a/packages/stripe_js/test/src/js/helpers/stripe_element_helper.dart b/packages/stripe_js/test/src/js/helpers/stripe_element_helper.dart index aa1696c37..b530ea065 100644 --- a/packages/stripe_js/test/src/js/helpers/stripe_element_helper.dart +++ b/packages/stripe_js/test/src/js/helpers/stripe_element_helper.dart @@ -1,15 +1,12 @@ import 'dart:async'; -import 'dart:html' as html; -import 'dart:html'; -import 'package:js/js.dart'; + import 'package:stripe_js/stripe_js.dart'; -@JS() -@staticInterop -class JSIFrameElement {} +import 'dart:js_interop'; +import 'package:web/web.dart' as web; -extension Extension on JSIFrameElement { - external Document get contentDocument; +extension type JSIFrameElement(JSObject element) { + external web.Document get contentDocument; } extension WaitStripeElement on StripeElement { @@ -24,34 +21,35 @@ extension WaitStripeElement on StripeElement { } } -extension ElementWaitFor on html.Element { - Future waitFor( +extension ElementWaitFor on web.Element { + Future waitFor( String selectors, { Duration timeout = const Duration(seconds: 2), }) async { - window.console.log(this.innerHtml); + web.console.log(this.innerHTML.toJS); final element = this.querySelector(selectors); if (element != null) { return element; } - final completer = Completer(); + final completer = Completer(); late final mutationObserver; - mutationObserver = MutationObserver((entries, observer) { - window.console.log("${this.innerHtml}"); + mutationObserver = web.MutationObserver( + (JSArray entries, web.MutationObserver observer) { + web.console.log("${this.innerHTML}".toJS); final element = this.querySelector(selectors); if (element != null) { - window.console.log("found"); + web.console.log("found".toJS); mutationObserver.disconnect(); completer.complete(element); } - }); - window.console.log("searching"); + }.toJS); + web.console.log("searching".toJS); mutationObserver.observe(this, childList: true, subtree: true); - this.append(DivElement()); + this.append(web.HTMLDivElement()); await Future.delayed(Duration(seconds: 2)); - this.append(DivElement()); + this.append(web.HTMLDivElement()); return completer.future.timeout(timeout, onTimeout: () { mutationObserver.disconnect(); throw TimeoutException('Could not find element $selectors'); diff --git a/packages/stripe_js/test/src/js/payment_methods/create_payment_method_test.dart b/packages/stripe_js/test/src/js/payment_methods/create_payment_method_test.dart index 9057c9ac7..ef1cee6ce 100644 --- a/packages/stripe_js/test/src/js/payment_methods/create_payment_method_test.dart +++ b/packages/stripe_js/test/src/js/payment_methods/create_payment_method_test.dart @@ -1,11 +1,10 @@ @TestOn('browser') @Tags(["browser"]) -import 'dart:html'; - import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import 'package:test/test.dart'; +import 'package:web/web.dart'; import '../helpers/helpers.dart'; @@ -18,7 +17,7 @@ void main() { }); test('can be called', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = stripe.elements().createCard(); card.mount(child); @@ -33,7 +32,7 @@ void main() { }); test('returns error when no filled', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = stripe.elements().createCard(); card.mount(child); diff --git a/packages/stripe_js/test/src/js/stripe_test.dart b/packages/stripe_js/test/src/js/stripe_test.dart index ae91f36c7..ece552970 100644 --- a/packages/stripe_js/test/src/js/stripe_test.dart +++ b/packages/stripe_js/test/src/js/stripe_test.dart @@ -1,4 +1,5 @@ @TestOn('browser') +@Tags(["browser"]) import 'package:stripe_js/stripe_js.dart'; import 'package:test/test.dart'; @@ -15,7 +16,6 @@ void main() { test('can be initialized with options', () { final options = StripeOptions( stripeAccount: "stripeAccount", - betas: [], apiVersion: "v3", locale: "en", ); diff --git a/packages/stripe_js/test/src/js/tokens/create_token_test.dart b/packages/stripe_js/test/src/js/tokens/create_token_test.dart index 064de08f3..72f9857a2 100644 --- a/packages/stripe_js/test/src/js/tokens/create_token_test.dart +++ b/packages/stripe_js/test/src/js/tokens/create_token_test.dart @@ -1,8 +1,7 @@ @TestOn('browser') @Tags(["browser"]) -import 'dart:html'; - +import 'package:web/web.dart'; import 'package:stripe_js/stripe_api.dart'; import 'package:stripe_js/stripe_js.dart'; import 'package:test/test.dart'; @@ -19,7 +18,7 @@ void main() { group('createCardElementToken', () { test('can be called', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = stripe.elements().createCard(); card.mount(child); @@ -44,7 +43,7 @@ void main() { }); test('returns error when no filled', () async { - final child = DivElement(); + final child = HTMLDivElement(); document.body!.append(child); final card = stripe.elements().createCard(); card.mount(child); diff --git a/packages/stripe_web/lib/src/models/confirm_payment_options.freezed.dart b/packages/stripe_web/lib/src/models/confirm_payment_options.freezed.dart index 96b267ee4..8f3cca8be 100644 --- a/packages/stripe_web/lib/src/models/confirm_payment_options.freezed.dart +++ b/packages/stripe_web/lib/src/models/confirm_payment_options.freezed.dart @@ -98,12 +98,12 @@ class _$ConfirmPaymentElementOptionsCopyWithImpl<$Res, } /// @nodoc -abstract class _$$_ConfirmPaymentElementOptionsCopyWith<$Res> +abstract class _$$ConfirmPaymentElementOptionsImplCopyWith<$Res> implements $ConfirmPaymentElementOptionsCopyWith<$Res> { - factory _$$_ConfirmPaymentElementOptionsCopyWith( - _$_ConfirmPaymentElementOptions value, - $Res Function(_$_ConfirmPaymentElementOptions) then) = - __$$_ConfirmPaymentElementOptionsCopyWithImpl<$Res>; + factory _$$ConfirmPaymentElementOptionsImplCopyWith( + _$ConfirmPaymentElementOptionsImpl value, + $Res Function(_$ConfirmPaymentElementOptionsImpl) then) = + __$$ConfirmPaymentElementOptionsImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -115,13 +115,13 @@ abstract class _$$_ConfirmPaymentElementOptionsCopyWith<$Res> } /// @nodoc -class __$$_ConfirmPaymentElementOptionsCopyWithImpl<$Res> +class __$$ConfirmPaymentElementOptionsImplCopyWithImpl<$Res> extends _$ConfirmPaymentElementOptionsCopyWithImpl<$Res, - _$_ConfirmPaymentElementOptions> - implements _$$_ConfirmPaymentElementOptionsCopyWith<$Res> { - __$$_ConfirmPaymentElementOptionsCopyWithImpl( - _$_ConfirmPaymentElementOptions _value, - $Res Function(_$_ConfirmPaymentElementOptions) _then) + _$ConfirmPaymentElementOptionsImpl> + implements _$$ConfirmPaymentElementOptionsImplCopyWith<$Res> { + __$$ConfirmPaymentElementOptionsImplCopyWithImpl( + _$ConfirmPaymentElementOptionsImpl _value, + $Res Function(_$ConfirmPaymentElementOptionsImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -130,7 +130,7 @@ class __$$_ConfirmPaymentElementOptionsCopyWithImpl<$Res> Object? confirmParams = null, Object? redirect = freezed, }) { - return _then(_$_ConfirmPaymentElementOptions( + return _then(_$ConfirmPaymentElementOptionsImpl( confirmParams: null == confirmParams ? _value.confirmParams : confirmParams // ignore: cast_nullable_to_non_nullable @@ -145,12 +145,14 @@ class __$$_ConfirmPaymentElementOptionsCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$_ConfirmPaymentElementOptions implements _ConfirmPaymentElementOptions { - const _$_ConfirmPaymentElementOptions( +class _$ConfirmPaymentElementOptionsImpl + implements _ConfirmPaymentElementOptions { + const _$ConfirmPaymentElementOptionsImpl( {required this.confirmParams, this.redirect}); - factory _$_ConfirmPaymentElementOptions.fromJson(Map json) => - _$$_ConfirmPaymentElementOptionsFromJson(json); + factory _$ConfirmPaymentElementOptionsImpl.fromJson( + Map json) => + _$$ConfirmPaymentElementOptionsImplFromJson(json); /// Parameters that will be passed on to the Stripe API. /// Refer to the Payment Intents API for a full list of parameters. @@ -179,7 +181,7 @@ class _$_ConfirmPaymentElementOptions implements _ConfirmPaymentElementOptions { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_ConfirmPaymentElementOptions && + other is _$ConfirmPaymentElementOptionsImpl && (identical(other.confirmParams, confirmParams) || other.confirmParams == confirmParams) && (identical(other.redirect, redirect) || @@ -193,13 +195,14 @@ class _$_ConfirmPaymentElementOptions implements _ConfirmPaymentElementOptions { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_ConfirmPaymentElementOptionsCopyWith<_$_ConfirmPaymentElementOptions> - get copyWith => __$$_ConfirmPaymentElementOptionsCopyWithImpl< - _$_ConfirmPaymentElementOptions>(this, _$identity); + _$$ConfirmPaymentElementOptionsImplCopyWith< + _$ConfirmPaymentElementOptionsImpl> + get copyWith => __$$ConfirmPaymentElementOptionsImplCopyWithImpl< + _$ConfirmPaymentElementOptionsImpl>(this, _$identity); @override Map toJson() { - return _$$_ConfirmPaymentElementOptionsToJson( + return _$$ConfirmPaymentElementOptionsImplToJson( this, ); } @@ -210,10 +213,10 @@ abstract class _ConfirmPaymentElementOptions const factory _ConfirmPaymentElementOptions( {required final ConfirmPaymentParams confirmParams, final PaymentConfirmationRedirect? redirect}) = - _$_ConfirmPaymentElementOptions; + _$ConfirmPaymentElementOptionsImpl; factory _ConfirmPaymentElementOptions.fromJson(Map json) = - _$_ConfirmPaymentElementOptions.fromJson; + _$ConfirmPaymentElementOptionsImpl.fromJson; @override @@ -235,6 +238,7 @@ abstract class _ConfirmPaymentElementOptions PaymentConfirmationRedirect? get redirect; @override @JsonKey(ignore: true) - _$$_ConfirmPaymentElementOptionsCopyWith<_$_ConfirmPaymentElementOptions> + _$$ConfirmPaymentElementOptionsImplCopyWith< + _$ConfirmPaymentElementOptionsImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/stripe_web/lib/src/models/confirm_payment_options.g.dart b/packages/stripe_web/lib/src/models/confirm_payment_options.g.dart index 03f120f05..c2d2df858 100644 --- a/packages/stripe_web/lib/src/models/confirm_payment_options.g.dart +++ b/packages/stripe_web/lib/src/models/confirm_payment_options.g.dart @@ -6,17 +6,17 @@ part of 'confirm_payment_options.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_ConfirmPaymentElementOptions _$$_ConfirmPaymentElementOptionsFromJson( +_$ConfirmPaymentElementOptionsImpl _$$ConfirmPaymentElementOptionsImplFromJson( Map json) => - _$_ConfirmPaymentElementOptions( + _$ConfirmPaymentElementOptionsImpl( confirmParams: ConfirmPaymentParams.fromJson( Map.from(json['confirmParams'] as Map)), redirect: $enumDecodeNullable( _$PaymentConfirmationRedirectEnumMap, json['redirect']), ); -Map _$$_ConfirmPaymentElementOptionsToJson( - _$_ConfirmPaymentElementOptions instance) { +Map _$$ConfirmPaymentElementOptionsImplToJson( + _$ConfirmPaymentElementOptionsImpl instance) { final val = { 'confirmParams': instance.confirmParams.toJson(), }; @@ -34,5 +34,5 @@ Map _$$_ConfirmPaymentElementOptionsToJson( const _$PaymentConfirmationRedirectEnumMap = { PaymentConfirmationRedirect.always: 'always', - PaymentConfirmationRedirect.ifRequired: 'ifRequired', + PaymentConfirmationRedirect.ifRequired: 'if_required', }; diff --git a/packages/stripe_web/lib/src/parser/payment_request.dart b/packages/stripe_web/lib/src/parser/payment_request.dart index dad737d26..0fd3d025d 100644 --- a/packages/stripe_web/lib/src/parser/payment_request.dart +++ b/packages/stripe_web/lib/src/parser/payment_request.dart @@ -1,3 +1,5 @@ +import 'dart:js_interop'; + import 'package:flutter_stripe_web/flutter_stripe_web.dart'; import 'package:stripe_js/stripe_js.dart' as js; @@ -12,14 +14,15 @@ extension PaymentRequestCreateOptionsExtension requestPayerEmail: requestPayerEmail, requestPayerPhone: requestPayerPhone, requestShipping: requestShipping, - shippingOptions: shippingOptions.map((option) => option.toJS()).toList(), - disableWallets: disableWallets.map((type) => type.toJS()).toList(), + shippingOptions: + shippingOptions.map((option) => option.toJS).toList().toJS, + disableWallets: disableWallets.map((type) => type.toJS).toList().toJS, ); } } extension ShippingOptionExtension on PlatformPayWebShippingOption { - js.ShippingOption toJS() => js.ShippingOption( + js.ShippingOption get toJS => js.ShippingOption( id: id, label: label, detail: detail, @@ -36,5 +39,5 @@ extension PaymentItemExtension on PlatformPayWebPaymentItem { } extension WalletTypeExtension on PlatformPayWebWalletType { - String toJS() => name; + JSString get toJS => name.toJS; } diff --git a/packages/stripe_web/lib/src/utils.dart b/packages/stripe_web/lib/src/utils.dart deleted file mode 100644 index f07eb4952..000000000 --- a/packages/stripe_web/lib/src/utils.dart +++ /dev/null @@ -1,5 +0,0 @@ -/// Utility function used to provide backwards support for flutter 2 for places -/// where code which can be nullable (flutter 2) is not nullable (flutter 3). -/// -/// ref: https://docs.flutter.dev/development/tools/sdk/release-notes/release-notes-3.0.0#your-code -T? ambiguate(T? value) => value; diff --git a/packages/stripe_web/lib/src/web_stripe.dart b/packages/stripe_web/lib/src/web_stripe.dart index a33f01f55..2679d7dd9 100644 --- a/packages/stripe_web/lib/src/web_stripe.dart +++ b/packages/stripe_web/lib/src/web_stripe.dart @@ -1,7 +1,7 @@ //@dart=2.12 import 'dart:async'; import 'dart:developer' as dev; -import 'dart:html'; +import 'package:web/web.dart' as web; import 'dart:ui' as ui; import 'package:flutter/widgets.dart'; @@ -43,7 +43,7 @@ class WebStripe extends StripePlatform { String? _urlScheme; - String get urlScheme => _urlScheme ?? window.location.href; + String get urlScheme => _urlScheme ?? web.window.location.href; @override Future initialise({ @@ -161,7 +161,7 @@ class WebStripe extends StripePlatform { return js.confirmAlipayPayment( paymentIntentClientSecret, data: stripe_js.ConfirmAlipayPaymentData( - returnUrl: window.location.href, + returnUrl: web.window.location.href, ), ); }, diff --git a/packages/stripe_web/lib/src/widgets/card_field.dart b/packages/stripe_web/lib/src/widgets/card_field.dart index b79d178a3..e2b59fab3 100644 --- a/packages/stripe_web/lib/src/widgets/card_field.dart +++ b/packages/stripe_web/lib/src/widgets/card_field.dart @@ -1,15 +1,15 @@ import 'dart:developer' as dev; -import 'dart:html'; -import 'dart:ui' as ui; +import 'dart:js_interop'; +import 'dart:ui_web' as ui; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_stripe_web/src/utils.dart'; +import 'package:stripe_js/stripe_api.dart' as js; +import 'package:stripe_js/stripe_js.dart' as js; +import 'package:web/web.dart' as web; import '../../flutter_stripe_web.dart'; -import 'package:stripe_js/stripe_js.dart' as js; -import 'package:stripe_js/stripe_api.dart' as js; const kCardFieldDefaultHeight = 10.0; const kCardFieldDefaultFontSize = 17.0; @@ -53,35 +53,13 @@ class WebCardField extends StatefulWidget { class WebStripeCardState extends State with CardFieldContext { CardEditController get controller => widget.controller; - late MutationObserver mutationObserver; - - @override void initState() { - // ignore: undefined_prefixed_name ui.platformViewRegistry.registerViewFactory( 'stripe_card', - (int viewId) => DivElement() + (int viewId) => web.HTMLDivElement() ..id = 'card-element' ..style.border = 'none', ); - mutationObserver = MutationObserver((entries, observer) { - if (document.getElementById('card-element') != null) { - mutationObserver.disconnect(); - - updateCardDetails( - const CardFieldInputDetails(complete: false), - controller, - ); - element = WebStripe.js - .elements(createElementOptions()) - .createCard(createOptions()) - ..mount('#card-element') - ..onBlur(requestBlur) - ..onFocus(requestFocus) - ..onChange(onCardChanged); - } - }); - mutationObserver.observe(document, childList: true, subtree: true); initStripe(); super.initState(); } @@ -92,7 +70,7 @@ class WebStripeCardState extends State with CardFieldContext { void initStripe() { attachController(controller); - ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((timeStamp) { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { if (!widget.dangerouslyUpdateFullCardDetails) { if (kDebugMode && controller.details != @@ -100,6 +78,19 @@ class WebStripeCardState extends State with CardFieldContext { dev.log('WARNING! Initial card data value has been ignored. \n' '$kDebugPCIMessage'); } + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + updateCardDetails( + const CardFieldInputDetails(complete: false), + controller, + ); + element = WebStripe.js + .elements(createElementOptions()) + .createCard(createOptions()) + ..mount('#card-element'.toJS) + ..onBlur(requestBlur) + ..onFocus(requestFocus) + ..onChange(onCardChanged); + }); } }); } @@ -149,14 +140,12 @@ class WebStripeCardState extends State with CardFieldContext { js.JsElementsCreateOptions createElementOptions() { final textColor = widget.style?.textColor; return js.JsElementsCreateOptions( - appearance: js.jsify( - js.ElementAppearance( - theme: js.ElementTheme.stripe, - variables: { - if (textColor != null) 'colorText': colorToCssString(textColor), - }, - ).toJson(), - ) as js.JsElementAppearance, + appearance: js.ElementAppearance( + theme: js.ElementTheme.stripe, + variables: { + if (textColor != null) 'colorText': colorToCssString(textColor), + }, + ).toJson().jsify() as js.JsElementAppearance, ); } @@ -197,7 +186,6 @@ class WebStripeCardState extends State with CardFieldContext { void dispose() { detachController(controller); element?.unmount(); - mutationObserver.disconnect(); super.dispose(); } diff --git a/packages/stripe_web/lib/src/widgets/payment_element.dart b/packages/stripe_web/lib/src/widgets/payment_element.dart index 4d9eb4c4d..80002913f 100644 --- a/packages/stripe_web/lib/src/widgets/payment_element.dart +++ b/packages/stripe_web/lib/src/widgets/payment_element.dart @@ -1,4 +1,6 @@ -import 'dart:html'; +import 'dart:js_interop'; + +import 'package:web/web.dart' as web; import 'dart:ui_web' as ui; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -46,51 +48,57 @@ class PaymentElement extends StatefulWidget { } class PaymentElementState extends State { - DivElement _divElement = DivElement(); + web.HTMLDivElement _divElement = web.HTMLDivElement(); // 2 is the first size generated by the iframe, O will not work. double height = 2.0; - late MutationObserver? mutationObserver = - MutationObserver((entries, observer) { - if (document.getElementById('payment-element') != null) { - mutationObserver?.disconnect(); - element = elements!.createPayment(elementOptions()) - ..mount('#payment-element') - ..onBlur(requestBlur) - ..onFocus(requestFocus) - ..onChange(onCardChanged); - mutationObserver = MutationObserver((entries, observer) { - final stripeElements = - document.getElementsByClassName('__PrivateStripeElement'); - if (stripeElements.isNotEmpty) { - mutationObserver?.disconnect(); - final element = stripeElements.first as HtmlElement; - resizeObserver.observe(element); - } - }); - mutationObserver!.observe(document, childList: true, subtree: true); - } - }); + late web.MutationObserver? mutationObserver = web.MutationObserver( + ((JSArray entries, web.MutationObserver observer) { + if (web.document.getElementById('payment-element') != null) { + mutationObserver?.disconnect(); + element = elements!.createPayment(elementOptions()) + ..mount('#payment-element'.toJS) + ..onBlur(requestBlur) + ..onFocus(requestFocus) + ..onChange(onCardChanged); + mutationObserver = web.MutationObserver( + (JSArray entries, + web.MutationObserver observer) { + final stripeElements = + web.document.getElementsByClassName('__PrivateStripeElement'); + if (stripeElements.length != 0) { + mutationObserver?.disconnect(); + final element = stripeElements.item(0) as web.HTMLElement; + resizeObserver.observe(element); + } + }.toJS); + mutationObserver!.observe( + web.document, + web.MutationObserverInit(childList: true, subtree: true), + ); + } + }.toJS), + ); - late final resizeObserver = ResizeObserver((entries, observer) { - if (widget.height == null) { - for (final entry in entries) { - if (entry.contentRect is DomRectReadOnly) { + late final resizeObserver = web.ResizeObserver( + ((JSArray entries, web.ResizeObserver observer) { + if (widget.height == null) { + for (final entry in entries.toDart) { final cr = entry.contentRect; setState(() { - height = cr.height; + height = cr.height.toDouble(); _divElement.style.height = '${height}px'; }); } } - } - }); + }).toJS, + ); @override void initState() { height = widget.height ?? height; - _divElement = DivElement() + _divElement = web.HTMLDivElement() ..id = 'payment-element' ..style.border = 'none' ..style.width = '100%' @@ -99,7 +107,10 @@ class PaymentElementState extends State { ..style.overflowX = 'hidden'; elements = WebStripe.js.elements(createOptions()); - mutationObserver!.observe(document, childList: true, subtree: true); + mutationObserver!.observe( + web.document, + web.MutationObserverInit(childList: true, subtree: true), + ); ui.platformViewRegistry.registerViewFactory( 'stripe_payment_element', (int viewId) => _divElement, @@ -158,7 +169,7 @@ class PaymentElementState extends State { final appearance = widget.appearance ?? js.ElementAppearance(); return js.JsElementsCreateOptions( clientSecret: widget.clientSecret, - appearance: js.jsify(appearance.toJson()) as js.JsElementAppearance, + appearance: appearance.toJson().jsify() as js.JsElementAppearance, ); } diff --git a/packages/stripe_web/lib/src/widgets/platform_pay_button.dart b/packages/stripe_web/lib/src/widgets/platform_pay_button.dart index 7cc1daaa6..b169d64cd 100644 --- a/packages/stripe_web/lib/src/widgets/platform_pay_button.dart +++ b/packages/stripe_web/lib/src/widgets/platform_pay_button.dart @@ -1,10 +1,12 @@ -import 'dart:html'; +import 'dart:js_interop'; + +import 'package:web/web.dart' as web; import 'dart:ui' as ui; -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_stripe_web/flutter_stripe_web.dart'; import 'package:flutter_stripe_web/src/parser/payment_request.dart'; -import 'package:flutter_stripe_web/src/utils.dart'; + import 'package:stripe_js/stripe_js.dart'; const kPlatformPayButtonDefaultHeight = 40.0; @@ -40,7 +42,7 @@ class _WebPlatformPayButtonState extends State { void initState() { // ignore: undefined_prefixed_name ui.platformViewRegistry.registerViewFactory('stripe_platform_pay_button', - (int viewId) => DivElement()..id = 'platform-pay-button'); + (int viewId) => web.HTMLDivElement()..id = 'platform-pay-button'); _initButton(); super.initState(); } @@ -59,7 +61,7 @@ class _WebPlatformPayButtonState extends State { } _initButton() { - ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((timeStamp) { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { PaymentRequest paymentRequest = WebStripe.js .paymentRequest((widget.paymentRequestCreateOptions).toJS()); @@ -68,48 +70,50 @@ class _WebPlatformPayButtonState extends State { JsPaymentRequestButtonElementCreateOptions( paymentRequest: paymentRequest.js, style: JsPaymentRequestButtonElementStyle( - paymentRequestButton: - JsPaymentRequestButtonElementStyleProps( - theme: theme, + paymentRequestButton: PaymentRequestButtonStyleOptions( + theme: theme(Theme.of(context).brightness), type: type, height: '${constraints.maxHeight}px', )))) - ..on('click', allowInterop((event) { - callMethod(event, 'preventDefault', []); + ..on('click', (event) { + //callMethod(event, 'preventDefault', []); widget.onPressed(); - })) - ..mount('#platform-pay-button'); + }) + ..mount('#platform-pay-button'.toJS); }); }); } - String get type { + PaymentRequestButtonType get type { switch (widget.type) { case PlatformButtonType.buy: - return 'buy'; + return PaymentRequestButtonType.buy; case PlatformButtonType.book: - return 'book'; + return PaymentRequestButtonType.book; case PlatformButtonType.donate: - return 'donate'; + return PaymentRequestButtonType.donate; case PlatformButtonType.plain: + case null: + return PaymentRequestButtonType.defaultType; default: - if (widget.type != null && widget.type != PlatformButtonType.plain) { - window.console.warn( - 'PlatformPayButton: ${widget.type} is not supported on web - defaulting to plain presentation'); - } - return 'default'; + web.console.warn( + 'PlatformPayButton: ${widget.type} is not supported on web - ' + 'defaulting to plain presentation' + .toJS, + ); + return PaymentRequestButtonType.defaultType; } } - String get theme { - switch (widget.style) { - case PlatformButtonStyle.white: - return 'light'; - case PlatformButtonStyle.whiteOutline: - return 'light-outline'; - case PlatformButtonStyle.black: - default: - return 'dark'; - } + PaymentRequestButtonTheme theme(Brightness brightness) { + return switch (widget.style) { + PlatformButtonStyle.white => PaymentRequestButtonTheme.light, + PlatformButtonStyle.whiteOutline => + PaymentRequestButtonTheme.lightOutline, + PlatformButtonStyle.black => PaymentRequestButtonTheme.dark, + PlatformButtonStyle.automatic || null => brightness == Brightness.light + ? PaymentRequestButtonTheme.light + : PaymentRequestButtonTheme.dark, + }; } } diff --git a/packages/stripe_web/pubspec.yaml b/packages/stripe_web/pubspec.yaml index 31f5dc7aa..2b7c725fa 100644 --- a/packages/stripe_web/pubspec.yaml +++ b/packages/stripe_web/pubspec.yaml @@ -1,10 +1,10 @@ name: flutter_stripe_web description: Stripe sdk bindings for the Flutter web platform. This package contains the implementation of the platform interface for web. -version: 5.2.0 +version: 6.0.0-dev.0 homepage: https://github.com/flutter-stripe/flutter_stripe environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" dependencies: @@ -14,8 +14,8 @@ dependencies: sdk: flutter freezed_annotation: ^2.0.3 stripe_platform_interface: ^10.1.1 - js: ^0.6.3 - stripe_js: ^3.4.0 + stripe_js: ^6.0.0-dev.0 + web: ^0.5.1 dev_dependencies: flutter_test: