From c39e3629a686a8257094a27fecb706c80422f5e1 Mon Sep 17 00:00:00 2001 From: Remon Date: Thu, 6 Jun 2024 20:50:44 +0100 Subject: [PATCH 1/4] feat: implement default values and new layout porperties web element --- .../src/api/core/billing_details.freezed.dart | 6 +- .../lib/src/api/core/error.freezed.dart | 4 +- .../api/core/shipping_details.freezed.dart | 6 +- .../card_element_options.freezed.dart | 6 +- .../elements/element_appearance.freezed.dart | 4 +- .../payment_element_change_event.freezed.dart | 6 +- .../api/elements/payment_element_options.dart | 55 +- .../payment_element_options.freezed.dart | 702 +++++++++++++++++- .../elements/payment_element_options.g.dart | 80 +- ...t_intent_shipping_information.freezed.dart | 4 +- ...nfirm_acss_debit_payment_data.freezed.dart | 4 +- ...rm_acss_debit_payment_options.freezed.dart | 4 +- .../api/payment_intents/payment_intent.g.dart | 14 +- .../api/payment_methods/payment_method.g.dart | 6 +- .../confirm_card_setup_options.freezed.dart | 4 +- ...confirm_sepa_debit_setup_data.freezed.dart | 4 +- .../src/api/setup_intents/setup_intent.g.dart | 2 +- .../create_token_card_data.freezed.dart | 4 +- .../tokens/create_token_pii_data.freezed.dart | 4 +- .../lib/src/api/tokens/token.freezed.dart | 8 +- .../stripe_js/lib/src/api/tokens/token.g.dart | 6 +- .../confirm_payment_options.freezed.dart | 52 +- .../src/models/confirm_payment_options.g.dart | 10 +- 23 files changed, 881 insertions(+), 114 deletions(-) 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_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..4a71bda41 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,7 +37,7 @@ class PaymentElementOptions with _$PaymentElementOptions { /// be rejected. PaymentElementFields? fields, - dynamic readOnly, + bool? readOnly, dynamic terms, dynamic wallets, }) = _PaymentElementOptions; @@ -78,6 +78,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 +102,59 @@ 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 +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({ 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..319da7fd8 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,7 +50,7 @@ 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; + bool? get readOnly => throw _privateConstructorUsedError; dynamic get terms => throw _privateConstructorUsedError; dynamic get wallets => throw _privateConstructorUsedError; @@ -72,7 +72,7 @@ abstract class $PaymentElementOptionsCopyWith<$Res> { PaymentElementBusiness? business, dynamic paymentMethodOrder, PaymentElementFields? fields, - dynamic readOnly, + bool? readOnly, dynamic terms, dynamic wallets}); @@ -129,7 +129,7 @@ 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 @@ -206,7 +206,7 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> PaymentElementBusiness? business, dynamic paymentMethodOrder, PaymentElementFields? fields, - dynamic readOnly, + bool? readOnly, dynamic terms, dynamic wallets}); @@ -265,7 +265,7 @@ 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 @@ -328,7 +328,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { @override final PaymentElementFields? fields; @override - final dynamic readOnly; + final bool? readOnly; @override final dynamic terms; @override @@ -340,7 +340,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementOptionsImpl && @@ -352,7 +352,8 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { const DeepCollectionEquality() .equals(other.paymentMethodOrder, paymentMethodOrder) && (identical(other.fields, fields) || other.fields == fields) && - const DeepCollectionEquality().equals(other.readOnly, readOnly) && + (identical(other.readOnly, readOnly) || + other.readOnly == readOnly) && const DeepCollectionEquality().equals(other.terms, terms) && const DeepCollectionEquality().equals(other.wallets, wallets)); } @@ -366,7 +367,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { business, const DeepCollectionEquality().hash(paymentMethodOrder), fields, - const DeepCollectionEquality().hash(readOnly), + readOnly, const DeepCollectionEquality().hash(terms), const DeepCollectionEquality().hash(wallets)); @@ -392,7 +393,7 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { final PaymentElementBusiness? business, final dynamic paymentMethodOrder, final PaymentElementFields? fields, - final dynamic readOnly, + final bool? readOnly, final dynamic terms, final dynamic wallets}) = _$PaymentElementOptionsImpl; @@ -433,7 +434,7 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { /// be rejected. PaymentElementFields? get fields; @override - dynamic get readOnly; + bool? get readOnly; @override dynamic get terms; @override @@ -472,6 +473,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 +495,8 @@ abstract class $PaymentElementLayoutCopyWith<$Res> { {PaymentElementLayoutType type, bool? defaultCollapsed, bool? radios, - bool? spacedAccordionItems}); + bool? spacedAccordionItems, + int? visibleAccordionItemsCount}); } /// @nodoc @@ -509,6 +517,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 +536,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 +556,8 @@ abstract class _$$PaymentElementLayoutImplCopyWith<$Res> {PaymentElementLayoutType type, bool? defaultCollapsed, bool? radios, - bool? spacedAccordionItems}); + bool? spacedAccordionItems, + int? visibleAccordionItemsCount}); } /// @nodoc @@ -561,6 +575,7 @@ class __$$PaymentElementLayoutImplCopyWithImpl<$Res> Object? defaultCollapsed = freezed, Object? radios = freezed, Object? spacedAccordionItems = freezed, + Object? visibleAccordionItemsCount = freezed, }) { return _then(_$PaymentElementLayoutImpl( type: null == type @@ -579,6 +594,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 +609,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 +641,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 +663,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 +696,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 +729,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 +756,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 +775,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 +798,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 +824,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 +848,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 +872,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 +891,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 +906,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 +949,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,11 +965,560 @@ 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; } +PaymentElementPaymentMethodDefaults + _$PaymentElementPaymentMethodDefaultsFromJson(Map json) { + return _PaymentElementPaymentMethodDefaults.fromJson(json); +} + +/// @nodoc +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) + $PaymentElementPaymentMethodDefaultsCopyWith< + PaymentElementPaymentMethodDefaults> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + factory $PaymentElementPaymentMethodDefaultsCopyWith( + PaymentElementPaymentMethodDefaults value, + $Res Function(PaymentElementPaymentMethodDefaults) then) = + _$PaymentElementPaymentMethodDefaultsCopyWithImpl<$Res, + PaymentElementPaymentMethodDefaults>; + @useResult + $Res call( + {PaymentElementIdealDefaults? ideal, PaymentElementCardDefaults? card}); + + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal; + $PaymentElementCardDefaultsCopyWith<$Res>? get card; +} + +/// @nodoc +class _$PaymentElementPaymentMethodDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementPaymentMethodDefaults> + implements $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + _$PaymentElementPaymentMethodDefaultsCopyWithImpl(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? ideal = freezed, + Object? card = freezed, + }) { + return _then(_value.copyWith( + 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') + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal { + if (_value.ideal == null) { + return null; + } + + 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 _$$PaymentElementPaymentMethodDefaultsImplCopyWith<$Res> + implements $PaymentElementPaymentMethodDefaultsCopyWith<$Res> { + factory _$$PaymentElementPaymentMethodDefaultsImplCopyWith( + _$PaymentElementPaymentMethodDefaultsImpl value, + $Res Function(_$PaymentElementPaymentMethodDefaultsImpl) then) = + __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementIdealDefaults? ideal, PaymentElementCardDefaults? card}); + + @override + $PaymentElementIdealDefaultsCopyWith<$Res>? get ideal; + @override + $PaymentElementCardDefaultsCopyWith<$Res>? get card; +} + +/// @nodoc +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? ideal = freezed, + Object? card = freezed, + }) { + 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 _$PaymentElementPaymentMethodDefaultsImpl + implements _PaymentElementPaymentMethodDefaults { + const _$PaymentElementPaymentMethodDefaultsImpl({this.ideal, this.card}); + + factory _$PaymentElementPaymentMethodDefaultsImpl.fromJson( + Map json) => + _$$PaymentElementPaymentMethodDefaultsImplFromJson(json); + + /// Defaults for ideal + @override + final PaymentElementIdealDefaults? ideal; + + /// Defaults for card payment method + @override + final PaymentElementCardDefaults? card; + + @override + String toString() { + return 'PaymentElementPaymentMethodDefaults(ideal: $ideal, card: $card)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + 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, ideal, card); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementPaymentMethodDefaultsImplCopyWith< + _$PaymentElementPaymentMethodDefaultsImpl> + get copyWith => __$$PaymentElementPaymentMethodDefaultsImplCopyWithImpl< + _$PaymentElementPaymentMethodDefaultsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementPaymentMethodDefaultsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementPaymentMethodDefaults + implements PaymentElementPaymentMethodDefaults { + const factory _PaymentElementPaymentMethodDefaults( + {final PaymentElementIdealDefaults? ideal, + final PaymentElementCardDefaults? card}) = + _$PaymentElementPaymentMethodDefaultsImpl; + + factory _PaymentElementPaymentMethodDefaults.fromJson( + Map json) = + _$PaymentElementPaymentMethodDefaultsImpl.fromJson; + + @override + + /// Defaults for ideal + PaymentElementIdealDefaults? get ideal; + @override + + /// Defaults for card payment method + PaymentElementCardDefaults? get card; + @override + @JsonKey(ignore: true) + _$$PaymentElementPaymentMethodDefaultsImplCopyWith< + _$PaymentElementPaymentMethodDefaultsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementIdealDefaults _$PaymentElementIdealDefaultsFromJson( + Map json) { + return _PaymentElementIdealDefaults.fromJson(json); +} + +/// @nodoc +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) + $PaymentElementIdealDefaultsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementIdealDefaultsCopyWith<$Res> { + factory $PaymentElementIdealDefaultsCopyWith( + PaymentElementIdealDefaults value, + $Res Function(PaymentElementIdealDefaults) then) = + _$PaymentElementIdealDefaultsCopyWithImpl<$Res, + PaymentElementIdealDefaults>; + @useResult + $Res call({String? bank}); +} + +/// @nodoc +class _$PaymentElementIdealDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementIdealDefaults> + implements $PaymentElementIdealDefaultsCopyWith<$Res> { + _$PaymentElementIdealDefaultsCopyWithImpl(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? bank = freezed, + }) { + return _then(_value.copyWith( + bank: freezed == bank + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementIdealDefaultsImplCopyWith<$Res> + implements $PaymentElementIdealDefaultsCopyWith<$Res> { + factory _$$PaymentElementIdealDefaultsImplCopyWith( + _$PaymentElementIdealDefaultsImpl value, + $Res Function(_$PaymentElementIdealDefaultsImpl) then) = + __$$PaymentElementIdealDefaultsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? bank}); +} + +/// @nodoc +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? bank = freezed, + }) { + return _then(_$PaymentElementIdealDefaultsImpl( + bank: freezed == bank + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementIdealDefaultsImpl + implements _PaymentElementIdealDefaults { + const _$PaymentElementIdealDefaultsImpl({this.bank}); + + 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? bank; + + @override + String toString() { + return 'PaymentElementIdealDefaults(bank: $bank)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementIdealDefaultsImpl && + (identical(other.bank, bank) || other.bank == bank)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, bank); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementIdealDefaultsImplCopyWith<_$PaymentElementIdealDefaultsImpl> + get copyWith => __$$PaymentElementIdealDefaultsImplCopyWithImpl< + _$PaymentElementIdealDefaultsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementIdealDefaultsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementIdealDefaults + implements PaymentElementIdealDefaults { + const factory _PaymentElementIdealDefaults({final String? bank}) = + _$PaymentElementIdealDefaultsImpl; + + factory _PaymentElementIdealDefaults.fromJson(Map json) = + _$PaymentElementIdealDefaultsImpl.fromJson; + + @override + + /// 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) + _$$PaymentElementIdealDefaultsImplCopyWith<_$PaymentElementIdealDefaultsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +PaymentElementCardDefaults _$PaymentElementCardDefaultsFromJson( + Map json) { + return _PaymentElementCardDefaults.fromJson(json); +} + +/// @nodoc +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) + $PaymentElementCardDefaultsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementCardDefaultsCopyWith<$Res> { + factory $PaymentElementCardDefaultsCopyWith(PaymentElementCardDefaults value, + $Res Function(PaymentElementCardDefaults) then) = + _$PaymentElementCardDefaultsCopyWithImpl<$Res, + PaymentElementCardDefaults>; + @useResult + $Res call({List? network}); +} + +/// @nodoc +class _$PaymentElementCardDefaultsCopyWithImpl<$Res, + $Val extends PaymentElementCardDefaults> + implements $PaymentElementCardDefaultsCopyWith<$Res> { + _$PaymentElementCardDefaultsCopyWithImpl(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? network = freezed, + }) { + return _then(_value.copyWith( + network: freezed == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementCardDefaultsImplCopyWith<$Res> + implements $PaymentElementCardDefaultsCopyWith<$Res> { + factory _$$PaymentElementCardDefaultsImplCopyWith( + _$PaymentElementCardDefaultsImpl value, + $Res Function(_$PaymentElementCardDefaultsImpl) then) = + __$$PaymentElementCardDefaultsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({List? network}); +} + +/// @nodoc +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? network = freezed, + }) { + return _then(_$PaymentElementCardDefaultsImpl( + network: freezed == network + ? _value._network + : network // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementCardDefaultsImpl implements _PaymentElementCardDefaults { + const _$PaymentElementCardDefaultsImpl({final List? network}) + : _network = network; + + 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 'PaymentElementCardDefaults(network: $network)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementCardDefaultsImpl && + const DeepCollectionEquality().equals(other._network, _network)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_network)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementCardDefaultsImplCopyWith<_$PaymentElementCardDefaultsImpl> + get copyWith => __$$PaymentElementCardDefaultsImplCopyWithImpl< + _$PaymentElementCardDefaultsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementCardDefaultsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementCardDefaults + implements PaymentElementCardDefaults { + const factory _PaymentElementCardDefaults({final List? network}) = + _$PaymentElementCardDefaultsImpl; + + factory _PaymentElementCardDefaults.fromJson(Map json) = + _$PaymentElementCardDefaultsImpl.fromJson; + + @override + + /// 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) + _$$PaymentElementCardDefaultsImplCopyWith<_$PaymentElementCardDefaultsImpl> + get copyWith => throw _privateConstructorUsedError; +} + PaymentElementBillingDetails _$PaymentElementBillingDetailsFromJson( Map json) { return _PaymentElementBillingDetails.fromJson(json); @@ -1060,7 +1692,7 @@ class _$PaymentElementBillingDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsImpl && @@ -1331,7 +1963,7 @@ class _$PaymentElementBillingDetailsAddressImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsAddressImpl && @@ -1514,7 +2146,7 @@ class _$PaymentElementBusinessImpl implements _PaymentElementBusiness { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBusinessImpl && @@ -1680,7 +2312,7 @@ class _$PaymentElementFieldsImpl implements _PaymentElementFields { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementFieldsImpl && @@ -1896,7 +2528,7 @@ class _$BillingDetailsFieldsImpl implements _BillingDetailsFields { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BillingDetailsFieldsImpl && @@ -2146,7 +2778,7 @@ class _$PaymentElementAddressFieldsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementAddressFieldsImpl && 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..bb023502e 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,7 +25,7 @@ _$PaymentElementOptionsImpl _$$PaymentElementOptionsImplFromJson(Map json) => ? null : PaymentElementFields.fromJson( Map.from(json['fields'] as Map)), - readOnly: json['readOnly'], + readOnly: json['readOnly'] as bool?, terms: json['terms'], wallets: json['wallets'], ); @@ -57,6 +57,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 +76,8 @@ Map _$$PaymentElementLayoutImplToJson( writeNotNull('defaultCollapsed', instance.defaultCollapsed); writeNotNull('radios', instance.radios); writeNotNull('spacedAccordionItems', instance.spacedAccordionItems); + writeNotNull( + 'visibleAccordionItemsCount', instance.visibleAccordionItemsCount); return val; } @@ -89,6 +93,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 +110,76 @@ 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; +} + +_$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; } 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 91f9bbe0a..cb8be0fd9 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?, @@ -230,7 +230,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_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', }; From 8e9514bad71d5897890438eb68648e6e08ee7c79 Mon Sep 17 00:00:00 2001 From: Remon Date: Thu, 6 Jun 2024 21:16:41 +0100 Subject: [PATCH 2/4] feat: add apple pay recurring payment options --- .../api/elements/payment_element_options.dart | 107 +- .../payment_element_options.freezed.dart | 1238 ++++++++++++++++- .../elements/payment_element_options.g.dart | 178 ++- 3 files changed, 1510 insertions(+), 13 deletions(-) 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 4a71bda41..75143f532 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 @@ -38,7 +38,7 @@ class PaymentElementOptions with _$PaymentElementOptions { PaymentElementFields? fields, bool? readOnly, - dynamic terms, + PaymentElementOptionsTerms? terms, dynamic wallets, }) = _PaymentElementOptions; @@ -208,6 +208,8 @@ class PaymentElementBusiness with _$PaymentElementBusiness { enum PaymentElementFieldRequired { never, auto } +enum PaymentElementShowTerms { never, auto, always } + @freezed class PaymentElementFields with _$PaymentElementFields { const factory PaymentElementFields({ @@ -263,3 +265,106 @@ 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 + }) = _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); +} + +enum ApplePayRecurringPaymentTimeInterVal{year, month, day, hour, minute} \ No newline at end of file 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 319da7fd8..6f344e5cb 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 @@ -51,7 +51,7 @@ mixin _$PaymentElementOptions { /// be rejected. PaymentElementFields? get fields => throw _privateConstructorUsedError; bool? get readOnly => throw _privateConstructorUsedError; - dynamic get terms => throw _privateConstructorUsedError; + PaymentElementOptionsTerms? get terms => throw _privateConstructorUsedError; dynamic get wallets => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -73,13 +73,14 @@ abstract class $PaymentElementOptionsCopyWith<$Res> { dynamic paymentMethodOrder, PaymentElementFields? fields, bool? readOnly, - dynamic terms, + PaymentElementOptionsTerms? terms, dynamic wallets}); $PaymentElementLayoutCopyWith<$Res>? get layout; $PaymentElementDefaultValuesCopyWith<$Res>? get defaultValues; $PaymentElementBusinessCopyWith<$Res>? get business; $PaymentElementFieldsCopyWith<$Res>? get fields; + $PaymentElementOptionsTermsCopyWith<$Res>? get terms; } /// @nodoc @@ -133,7 +134,7 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, 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 @@ -189,6 +190,18 @@ 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); + }); + } } /// @nodoc @@ -207,7 +220,7 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> dynamic paymentMethodOrder, PaymentElementFields? fields, bool? readOnly, - dynamic terms, + PaymentElementOptionsTerms? terms, dynamic wallets}); @override @@ -218,6 +231,8 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> $PaymentElementBusinessCopyWith<$Res>? get business; @override $PaymentElementFieldsCopyWith<$Res>? get fields; + @override + $PaymentElementOptionsTermsCopyWith<$Res>? get terms; } /// @nodoc @@ -269,7 +284,7 @@ class __$$PaymentElementOptionsImplCopyWithImpl<$Res> 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 @@ -330,7 +345,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { @override final bool? readOnly; @override - final dynamic terms; + final PaymentElementOptionsTerms? terms; @override final dynamic wallets; @@ -354,7 +369,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { (identical(other.fields, fields) || other.fields == fields) && (identical(other.readOnly, readOnly) || other.readOnly == readOnly) && - const DeepCollectionEquality().equals(other.terms, terms) && + (identical(other.terms, terms) || other.terms == terms) && const DeepCollectionEquality().equals(other.wallets, wallets)); } @@ -368,7 +383,7 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { const DeepCollectionEquality().hash(paymentMethodOrder), fields, readOnly, - const DeepCollectionEquality().hash(terms), + terms, const DeepCollectionEquality().hash(wallets)); @JsonKey(ignore: true) @@ -394,7 +409,7 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { final dynamic paymentMethodOrder, final PaymentElementFields? fields, final bool? readOnly, - final dynamic terms, + final PaymentElementOptionsTerms? terms, final dynamic wallets}) = _$PaymentElementOptionsImpl; factory _PaymentElementOptions.fromJson(Map json) = @@ -436,7 +451,7 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { @override bool? get readOnly; @override - dynamic get terms; + PaymentElementOptionsTerms? get terms; @override dynamic get wallets; @override @@ -2842,3 +2857,1206 @@ abstract class _PaymentElementAddressFields _$$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; + + 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}); + + $PaymentElementAppleRecurringRequestCopyWith<$Res>? + get recurringPaymentRequest; +} + +/// @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, + }) { + return _then(_value.copyWith( + recurringPaymentRequest: freezed == recurringPaymentRequest + ? _value.recurringPaymentRequest + : recurringPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementAppleRecurringRequest?, + ) 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); + }); + } +} + +/// @nodoc +abstract class _$$PaymentElementApplePayOptionsImplCopyWith<$Res> + implements $PaymentElementApplePayOptionsCopyWith<$Res> { + factory _$$PaymentElementApplePayOptionsImplCopyWith( + _$PaymentElementApplePayOptionsImpl value, + $Res Function(_$PaymentElementApplePayOptionsImpl) then) = + __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({PaymentElementAppleRecurringRequest? recurringPaymentRequest}); + + @override + $PaymentElementAppleRecurringRequestCopyWith<$Res>? + get recurringPaymentRequest; +} + +/// @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, + }) { + return _then(_$PaymentElementApplePayOptionsImpl( + recurringPaymentRequest: freezed == recurringPaymentRequest + ? _value.recurringPaymentRequest + : recurringPaymentRequest // ignore: cast_nullable_to_non_nullable + as PaymentElementAppleRecurringRequest?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentElementApplePayOptionsImpl + implements _PaymentElementApplePayOptions { + const _$PaymentElementApplePayOptionsImpl({this.recurringPaymentRequest}); + + factory _$PaymentElementApplePayOptionsImpl.fromJson( + Map json) => + _$$PaymentElementApplePayOptionsImplFromJson(json); + + /// Information about a recurring payment with ApplePay + @override + final PaymentElementAppleRecurringRequest? recurringPaymentRequest; + + @override + String toString() { + return 'PaymentElementApplePayOptions(recurringPaymentRequest: $recurringPaymentRequest)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentElementApplePayOptionsImpl && + (identical( + other.recurringPaymentRequest, recurringPaymentRequest) || + other.recurringPaymentRequest == recurringPaymentRequest)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, recurringPaymentRequest); + + @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}) = _$PaymentElementApplePayOptionsImpl; + + factory _PaymentElementApplePayOptions.fromJson(Map json) = + _$PaymentElementApplePayOptionsImpl.fromJson; + + @override + + /// Information about a recurring payment with ApplePay + PaymentElementAppleRecurringRequest? get recurringPaymentRequest; + @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; +} 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 bb023502e..446384dd6 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 @@ -26,7 +26,10 @@ _$PaymentElementOptionsImpl _$$PaymentElementOptionsImplFromJson(Map json) => : PaymentElementFields.fromJson( Map.from(json['fields'] as Map)), readOnly: json['readOnly'] as bool?, - terms: json['terms'], + terms: json['terms'] == null + ? null + : PaymentElementOptionsTerms.fromJson( + Map.from(json['terms'] as Map)), wallets: json['wallets'], ); @@ -46,7 +49,7 @@ Map _$$PaymentElementOptionsImplToJson( writeNotNull('paymentMethodOrder', instance.paymentMethodOrder); writeNotNull('fields', instance.fields?.toJson()); writeNotNull('readOnly', instance.readOnly); - writeNotNull('terms', instance.terms); + writeNotNull('terms', instance.terms?.toJson()); writeNotNull('wallets', instance.wallets); return val; } @@ -339,3 +342,174 @@ 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)), + ); + +Map _$$PaymentElementApplePayOptionsImplToJson( + _$PaymentElementApplePayOptionsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull( + 'recurringPaymentRequest', instance.recurringPaymentRequest?.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', +}; From 5a272e734bd486de50aa567c642089cf09eba07d Mon Sep 17 00:00:00 2001 From: Remon Date: Thu, 6 Jun 2024 21:26:56 +0100 Subject: [PATCH 3/4] feat: add apple pay deferred payment to web element --- .../api/elements/payment_element_options.dart | 127 ++- .../payment_element_options.freezed.dart | 889 +++++++++++++++++- .../elements/payment_element_options.g.dart | 109 ++- 3 files changed, 1064 insertions(+), 61 deletions(-) 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 75143f532..68d18b223 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 @@ -39,7 +39,8 @@ class PaymentElementOptions with _$PaymentElementOptions { PaymentElementFields? fields, bool? readOnly, PaymentElementOptionsTerms? terms, - dynamic wallets, + PaymentElementWalletOptions? wallets, + PaymentElementApplePayOptions? applePay, }) = _PaymentElementOptions; factory PaymentElementOptions.fromJson(Map json) => @@ -128,6 +129,25 @@ class PaymentElementPaymentMethodDefaults _$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({ @@ -312,17 +332,21 @@ class PaymentElementOptionsTerms with _$PaymentElementOptionsTerms { @freezed class PaymentElementApplePayOptions with _$PaymentElementApplePayOptions { - const factory PaymentElementApplePayOptions({ - /// Information about a recurring payment with ApplePay - PaymentElementAppleRecurringRequest? recurringPaymentRequest - }) = _PaymentElementApplePayOptions; + const factory PaymentElementApplePayOptions( + { + /// Information about a recurring payment with ApplePay + PaymentElementAppleRecurringRequest? recurringPaymentRequest, + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest + }) = _PaymentElementApplePayOptions; factory PaymentElementApplePayOptions.fromJson(Map json) => _$PaymentElementApplePayOptionsFromJson(json); } @freezed -class PaymentElementAppleRecurringRequest with _$PaymentElementAppleRecurringRequest { +class PaymentElementAppleRecurringRequest + with _$PaymentElementAppleRecurringRequest { const factory PaymentElementAppleRecurringRequest({ /// The description of the payment required String paymentDescription, @@ -330,41 +354,90 @@ class PaymentElementAppleRecurringRequest with _$PaymentElementAppleRecurringReq /// Management url required String managementUrl, - /// Information in case of a trial billing - PaymentElementRecurringPaymentProperties? trialBilling, + /// Information in case of a trial billing + PaymentElementRecurringPaymentProperties? trialBilling, - /// Information in case of a regular billing - PaymentElementRecurringPaymentProperties? regularBilling, - + /// Information in case of a regular billing + PaymentElementRecurringPaymentProperties? regularBilling, }) = _PaymentElementAppleRecurringRequest; - factory PaymentElementAppleRecurringRequest.fromJson(Map json) => + factory PaymentElementAppleRecurringRequest.fromJson( + Map json) => _$PaymentElementAppleRecurringRequestFromJson(json); } + @freezed -class PaymentElementRecurringPaymentProperties with _$PaymentElementRecurringPaymentProperties { +class PaymentElementRecurringPaymentProperties + with _$PaymentElementRecurringPaymentProperties { const factory PaymentElementRecurringPaymentProperties({ - /// The amount of the payment - required double amount, + /// The amount of the payment + required double amount, - /// Description label - required String label, + /// Description label + required String label, - /// The startdate of the recurring payment - DateTime? recurringPaymentStartDate, + /// The startdate of the recurring payment + DateTime? recurringPaymentStartDate, - /// The enddate of the recurring payment - DateTime? recurringPaymentEndDate, + /// The enddate of the recurring payment + DateTime? recurringPaymentEndDate, - /// The interval of payment - ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, + /// The interval of payment + ApplePayRecurringPaymentTimeInterVal? recurringPaymentIntervalUnit, - /// The amount of intervals - int? recurringPaymentIntervalCount, + /// The amount of intervals + int? recurringPaymentIntervalCount, }) = _PaymentElementRecurringPaymentProperties; - factory PaymentElementRecurringPaymentProperties.fromJson(Map json) => + factory PaymentElementRecurringPaymentProperties.fromJson( + Map json) => _$PaymentElementRecurringPaymentPropertiesFromJson(json); } -enum ApplePayRecurringPaymentTimeInterVal{year, month, day, hour, minute} \ No newline at end of file +@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); +} + +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 6f344e5cb..8b7ef2c2c 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 @@ -52,7 +52,10 @@ mixin _$PaymentElementOptions { PaymentElementFields? get fields => throw _privateConstructorUsedError; bool? get readOnly => throw _privateConstructorUsedError; PaymentElementOptionsTerms? get terms => throw _privateConstructorUsedError; - dynamic get wallets => throw _privateConstructorUsedError; + PaymentElementWalletOptions? get wallets => + throw _privateConstructorUsedError; + PaymentElementApplePayOptions? get applePay => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -74,13 +77,16 @@ abstract class $PaymentElementOptionsCopyWith<$Res> { PaymentElementFields? fields, bool? readOnly, PaymentElementOptionsTerms? terms, - dynamic wallets}); + 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 @@ -105,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 @@ -138,7 +145,11 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, 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); } @@ -202,6 +213,31 @@ class _$PaymentElementOptionsCopyWithImpl<$Res, 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 @@ -221,7 +257,8 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> PaymentElementFields? fields, bool? readOnly, PaymentElementOptionsTerms? terms, - dynamic wallets}); + PaymentElementWalletOptions? wallets, + PaymentElementApplePayOptions? applePay}); @override $PaymentElementLayoutCopyWith<$Res>? get layout; @@ -233,6 +270,10 @@ abstract class _$$PaymentElementOptionsImplCopyWith<$Res> $PaymentElementFieldsCopyWith<$Res>? get fields; @override $PaymentElementOptionsTermsCopyWith<$Res>? get terms; + @override + $PaymentElementWalletOptionsCopyWith<$Res>? get wallets; + @override + $PaymentElementApplePayOptionsCopyWith<$Res>? get applePay; } /// @nodoc @@ -255,6 +296,7 @@ class __$$PaymentElementOptionsImplCopyWithImpl<$Res> Object? readOnly = freezed, Object? terms = freezed, Object? wallets = freezed, + Object? applePay = freezed, }) { return _then(_$PaymentElementOptionsImpl( layout: freezed == layout @@ -288,7 +330,11 @@ class __$$PaymentElementOptionsImplCopyWithImpl<$Res> 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?, )); } } @@ -304,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); @@ -347,11 +394,13 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { @override 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 @@ -370,7 +419,9 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { (identical(other.readOnly, readOnly) || other.readOnly == readOnly) && (identical(other.terms, terms) || other.terms == terms) && - const DeepCollectionEquality().equals(other.wallets, wallets)); + (identical(other.wallets, wallets) || other.wallets == wallets) && + (identical(other.applePay, applePay) || + other.applePay == applePay)); } @JsonKey(ignore: true) @@ -384,7 +435,8 @@ class _$PaymentElementOptionsImpl implements _PaymentElementOptions { fields, readOnly, terms, - const DeepCollectionEquality().hash(wallets)); + wallets, + applePay); @JsonKey(ignore: true) @override @@ -403,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 bool? readOnly, - final PaymentElementOptionsTerms? 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; @@ -453,7 +507,9 @@ abstract class _PaymentElementOptions implements PaymentElementOptions { @override PaymentElementOptionsTerms? get terms; @override - dynamic get wallets; + PaymentElementWalletOptions? get wallets; + @override + PaymentElementApplePayOptions? get applePay; @override @JsonKey(ignore: true) _$$PaymentElementOptionsImplCopyWith<_$PaymentElementOptionsImpl> @@ -1204,6 +1260,190 @@ abstract class _PaymentElementPaymentMethodDefaults get copyWith => throw _privateConstructorUsedError; } +PaymentElementWalletOptions _$PaymentElementWalletOptionsFromJson( + Map json) { + return _PaymentElementWalletOptions.fromJson(json); +} + +/// @nodoc +mixin _$PaymentElementWalletOptions { + /// Apple pay required options + PaymentElementFieldRequired? get applePay => + throw _privateConstructorUsedError; + + /// Google pay required options + PaymentElementFieldRequired? get googlePay => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentElementWalletOptionsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementWalletOptionsCopyWith<$Res> { + factory $PaymentElementWalletOptionsCopyWith( + PaymentElementWalletOptions value, + $Res Function(PaymentElementWalletOptions) then) = + _$PaymentElementWalletOptionsCopyWithImpl<$Res, + PaymentElementWalletOptions>; + @useResult + $Res call( + {PaymentElementFieldRequired? applePay, + PaymentElementFieldRequired? googlePay}); +} + +/// @nodoc +class _$PaymentElementWalletOptionsCopyWithImpl<$Res, + $Val extends PaymentElementWalletOptions> + implements $PaymentElementWalletOptionsCopyWith<$Res> { + _$PaymentElementWalletOptionsCopyWithImpl(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? googlePay = freezed, + }) { + return _then(_value.copyWith( + 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 _$$PaymentElementWalletOptionsImplCopyWith<$Res> + implements $PaymentElementWalletOptionsCopyWith<$Res> { + factory _$$PaymentElementWalletOptionsImplCopyWith( + _$PaymentElementWalletOptionsImpl value, + $Res Function(_$PaymentElementWalletOptionsImpl) then) = + __$$PaymentElementWalletOptionsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentElementFieldRequired? applePay, + PaymentElementFieldRequired? googlePay}); +} + +/// @nodoc +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? applePay = freezed, + Object? googlePay = freezed, + }) { + 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 _$PaymentElementWalletOptionsImpl + implements _PaymentElementWalletOptions { + const _$PaymentElementWalletOptionsImpl({this.applePay, this.googlePay}); + + factory _$PaymentElementWalletOptionsImpl.fromJson( + Map json) => + _$$PaymentElementWalletOptionsImplFromJson(json); + + /// Apple pay required options + @override + final PaymentElementFieldRequired? applePay; + + /// Google pay required options + @override + final PaymentElementFieldRequired? googlePay; + + @override + String toString() { + return 'PaymentElementWalletOptions(applePay: $applePay, googlePay: $googlePay)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + 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, applePay, googlePay); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementWalletOptionsImplCopyWith<_$PaymentElementWalletOptionsImpl> + get copyWith => __$$PaymentElementWalletOptionsImplCopyWithImpl< + _$PaymentElementWalletOptionsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementWalletOptionsImplToJson( + this, + ); + } +} + +abstract class _PaymentElementWalletOptions + implements PaymentElementWalletOptions { + const factory _PaymentElementWalletOptions( + {final PaymentElementFieldRequired? applePay, + final PaymentElementFieldRequired? googlePay}) = + _$PaymentElementWalletOptionsImpl; + + factory _PaymentElementWalletOptions.fromJson(Map json) = + _$PaymentElementWalletOptionsImpl.fromJson; + + @override + + /// Apple pay required options + PaymentElementFieldRequired? get applePay; + @override + + /// Google pay required options + PaymentElementFieldRequired? get googlePay; + @override + @JsonKey(ignore: true) + _$$PaymentElementWalletOptionsImplCopyWith<_$PaymentElementWalletOptionsImpl> + get copyWith => throw _privateConstructorUsedError; +} + PaymentElementIdealDefaults _$PaymentElementIdealDefaultsFromJson( Map json) { return _PaymentElementIdealDefaults.fromJson(json); @@ -3303,6 +3543,10 @@ mixin _$PaymentElementApplePayOptions { PaymentElementAppleRecurringRequest? get recurringPaymentRequest => throw _privateConstructorUsedError; + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? get deferredPaymentRequest => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $PaymentElementApplePayOptionsCopyWith @@ -3317,10 +3561,14 @@ abstract class $PaymentElementApplePayOptionsCopyWith<$Res> { _$PaymentElementApplePayOptionsCopyWithImpl<$Res, PaymentElementApplePayOptions>; @useResult - $Res call({PaymentElementAppleRecurringRequest? recurringPaymentRequest}); + $Res call( + {PaymentElementAppleRecurringRequest? recurringPaymentRequest, + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest}); $PaymentElementAppleRecurringRequestCopyWith<$Res>? get recurringPaymentRequest; + $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? + get deferredPaymentRequest; } /// @nodoc @@ -3338,12 +3586,17 @@ class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, @override $Res call({ Object? recurringPaymentRequest = freezed, + Object? deferredPaymentRequest = 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?, ) as $Val); } @@ -3360,6 +3613,20 @@ class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, 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); + }); + } } /// @nodoc @@ -3371,11 +3638,16 @@ abstract class _$$PaymentElementApplePayOptionsImplCopyWith<$Res> __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res>; @override @useResult - $Res call({PaymentElementAppleRecurringRequest? recurringPaymentRequest}); + $Res call( + {PaymentElementAppleRecurringRequest? recurringPaymentRequest, + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest}); @override $PaymentElementAppleRecurringRequestCopyWith<$Res>? get recurringPaymentRequest; + @override + $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? + get deferredPaymentRequest; } /// @nodoc @@ -3392,12 +3664,17 @@ class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> @override $Res call({ Object? recurringPaymentRequest = freezed, + Object? deferredPaymentRequest = 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?, )); } } @@ -3406,7 +3683,8 @@ class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> @JsonSerializable() class _$PaymentElementApplePayOptionsImpl implements _PaymentElementApplePayOptions { - const _$PaymentElementApplePayOptionsImpl({this.recurringPaymentRequest}); + const _$PaymentElementApplePayOptionsImpl( + {this.recurringPaymentRequest, this.deferredPaymentRequest}); factory _$PaymentElementApplePayOptionsImpl.fromJson( Map json) => @@ -3416,9 +3694,13 @@ class _$PaymentElementApplePayOptionsImpl @override final PaymentElementAppleRecurringRequest? recurringPaymentRequest; + /// Information about a deferred payment with ApplePay + @override + final PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest; + @override String toString() { - return 'PaymentElementApplePayOptions(recurringPaymentRequest: $recurringPaymentRequest)'; + return 'PaymentElementApplePayOptions(recurringPaymentRequest: $recurringPaymentRequest, deferredPaymentRequest: $deferredPaymentRequest)'; } @override @@ -3428,12 +3710,15 @@ class _$PaymentElementApplePayOptionsImpl other is _$PaymentElementApplePayOptionsImpl && (identical( other.recurringPaymentRequest, recurringPaymentRequest) || - other.recurringPaymentRequest == recurringPaymentRequest)); + other.recurringPaymentRequest == recurringPaymentRequest) && + (identical(other.deferredPaymentRequest, deferredPaymentRequest) || + other.deferredPaymentRequest == deferredPaymentRequest)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, recurringPaymentRequest); + int get hashCode => + Object.hash(runtimeType, recurringPaymentRequest, deferredPaymentRequest); @JsonKey(ignore: true) @override @@ -3454,8 +3739,9 @@ class _$PaymentElementApplePayOptionsImpl abstract class _PaymentElementApplePayOptions implements PaymentElementApplePayOptions { const factory _PaymentElementApplePayOptions( - {final PaymentElementAppleRecurringRequest? - recurringPaymentRequest}) = _$PaymentElementApplePayOptionsImpl; + {final PaymentElementAppleRecurringRequest? recurringPaymentRequest, + final PaymentElementApplePayDeferredPaymentRequest? + deferredPaymentRequest}) = _$PaymentElementApplePayOptionsImpl; factory _PaymentElementApplePayOptions.fromJson(Map json) = _$PaymentElementApplePayOptionsImpl.fromJson; @@ -3465,6 +3751,10 @@ abstract class _PaymentElementApplePayOptions /// Information about a recurring payment with ApplePay PaymentElementAppleRecurringRequest? get recurringPaymentRequest; @override + + /// Information about a deferred payment with ApplePay + PaymentElementApplePayDeferredPaymentRequest? get deferredPaymentRequest; + @override @JsonKey(ignore: true) _$$PaymentElementApplePayOptionsImplCopyWith< _$PaymentElementApplePayOptionsImpl> @@ -4060,3 +4350,548 @@ abstract class _PaymentElementRecurringPaymentProperties _$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; +} 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 446384dd6..b6e8efa5b 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 @@ -30,7 +30,14 @@ _$PaymentElementOptionsImpl _$$PaymentElementOptionsImplFromJson(Map json) => ? null : PaymentElementOptionsTerms.fromJson( Map.from(json['terms'] as Map)), - wallets: json['wallets'], + 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( @@ -50,7 +57,8 @@ Map _$$PaymentElementOptionsImplToJson( writeNotNull('fields', instance.fields?.toJson()); writeNotNull('readOnly', instance.readOnly); writeNotNull('terms', instance.terms?.toJson()); - writeNotNull('wallets', instance.wallets); + writeNotNull('wallets', instance.wallets?.toJson()); + writeNotNull('applePay', instance.applePay?.toJson()); return val; } @@ -145,6 +153,37 @@ Map _$$PaymentElementPaymentMethodDefaultsImplToJson( 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( @@ -304,11 +343,6 @@ Map _$$BillingDetailsFieldsImplToJson( 'address': instance.address.toJson(), }; -const _$PaymentElementFieldRequiredEnumMap = { - PaymentElementFieldRequired.never: 'never', - PaymentElementFieldRequired.auto: 'auto', -}; - _$PaymentElementAddressFieldsImpl _$$PaymentElementAddressFieldsImplFromJson( Map json) => _$PaymentElementAddressFieldsImpl( @@ -412,6 +446,11 @@ _$PaymentElementApplePayOptionsImpl : PaymentElementAppleRecurringRequest.fromJson( Map.from( json['recurringPaymentRequest'] as Map)), + deferredPaymentRequest: json['deferredPaymentRequest'] == null + ? null + : PaymentElementApplePayDeferredPaymentRequest.fromJson( + Map.from( + json['deferredPaymentRequest'] as Map)), ); Map _$$PaymentElementApplePayOptionsImplToJson( @@ -426,6 +465,8 @@ Map _$$PaymentElementApplePayOptionsImplToJson( writeNotNull( 'recurringPaymentRequest', instance.recurringPaymentRequest?.toJson()); + writeNotNull( + 'deferredPaymentRequest', instance.deferredPaymentRequest?.toJson()); return val; } @@ -513,3 +554,57 @@ const _$ApplePayRecurringPaymentTimeInterValEnumMap = { 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(), + }; From 457a031f677b44858e7b901a74b349fbc0415f19 Mon Sep 17 00:00:00 2001 From: Remon Date: Thu, 6 Jun 2024 21:31:05 +0100 Subject: [PATCH 4/4] feat add auto reload paymentoptions --- .../api/elements/payment_element_options.dart | 62 +- .../payment_element_options.freezed.dart | 540 +++++++++++++++++- .../elements/payment_element_options.g.dart | 46 ++ 3 files changed, 631 insertions(+), 17 deletions(-) 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 68d18b223..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 @@ -332,13 +332,17 @@ class PaymentElementOptionsTerms with _$PaymentElementOptionsTerms { @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 - }) = _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); @@ -414,7 +418,7 @@ class PaymentElementApplePayDeferredPaymentRequest String? freeCancellationTimezone, /// Billing information of the deffered payment - required PaymentElementApplePayDeferredPaymentProperties deferredBilling, + required PaymentElementApplePayDeferredPaymentProperties deferredBilling, }) = _PaymentElementApplePayDeferredPaymentRequest; factory PaymentElementApplePayDeferredPaymentRequest.fromJson( @@ -423,7 +427,8 @@ class PaymentElementApplePayDeferredPaymentRequest } @freezed -class PaymentElementApplePayDeferredPaymentProperties with _$PaymentElementApplePayDeferredPaymentProperties { +class PaymentElementApplePayDeferredPaymentProperties + with _$PaymentElementApplePayDeferredPaymentProperties { const factory PaymentElementApplePayDeferredPaymentProperties({ /// The amount of the payment required double amount, @@ -440,4 +445,43 @@ class PaymentElementApplePayDeferredPaymentProperties with _$PaymentElementApple _$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 8b7ef2c2c..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 @@ -3547,6 +3547,10 @@ mixin _$PaymentElementApplePayOptions { 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 @@ -3563,12 +3567,16 @@ abstract class $PaymentElementApplePayOptionsCopyWith<$Res> { @useResult $Res call( {PaymentElementAppleRecurringRequest? recurringPaymentRequest, - PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest}); + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest, + PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}); $PaymentElementAppleRecurringRequestCopyWith<$Res>? get recurringPaymentRequest; $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? get deferredPaymentRequest; + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>? + get automaticReloadPaymentRequest; } /// @nodoc @@ -3587,6 +3595,7 @@ class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, $Res call({ Object? recurringPaymentRequest = freezed, Object? deferredPaymentRequest = freezed, + Object? automaticReloadPaymentRequest = freezed, }) { return _then(_value.copyWith( recurringPaymentRequest: freezed == recurringPaymentRequest @@ -3597,6 +3606,10 @@ class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, ? _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); } @@ -3627,6 +3640,21 @@ class _$PaymentElementApplePayOptionsCopyWithImpl<$Res, 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 @@ -3640,7 +3668,9 @@ abstract class _$$PaymentElementApplePayOptionsImplCopyWith<$Res> @useResult $Res call( {PaymentElementAppleRecurringRequest? recurringPaymentRequest, - PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest}); + PaymentElementApplePayDeferredPaymentRequest? deferredPaymentRequest, + PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}); @override $PaymentElementAppleRecurringRequestCopyWith<$Res>? @@ -3648,6 +3678,9 @@ abstract class _$$PaymentElementApplePayOptionsImplCopyWith<$Res> @override $PaymentElementApplePayDeferredPaymentRequestCopyWith<$Res>? get deferredPaymentRequest; + @override + $PaymentElementApplePayAutoReloadPaymentRequestCopyWith<$Res>? + get automaticReloadPaymentRequest; } /// @nodoc @@ -3665,6 +3698,7 @@ class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> $Res call({ Object? recurringPaymentRequest = freezed, Object? deferredPaymentRequest = freezed, + Object? automaticReloadPaymentRequest = freezed, }) { return _then(_$PaymentElementApplePayOptionsImpl( recurringPaymentRequest: freezed == recurringPaymentRequest @@ -3675,6 +3709,10 @@ class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> ? _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?, )); } } @@ -3684,7 +3722,9 @@ class __$$PaymentElementApplePayOptionsImplCopyWithImpl<$Res> class _$PaymentElementApplePayOptionsImpl implements _PaymentElementApplePayOptions { const _$PaymentElementApplePayOptionsImpl( - {this.recurringPaymentRequest, this.deferredPaymentRequest}); + {this.recurringPaymentRequest, + this.deferredPaymentRequest, + this.automaticReloadPaymentRequest}); factory _$PaymentElementApplePayOptionsImpl.fromJson( Map json) => @@ -3698,9 +3738,14 @@ class _$PaymentElementApplePayOptionsImpl @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)'; + return 'PaymentElementApplePayOptions(recurringPaymentRequest: $recurringPaymentRequest, deferredPaymentRequest: $deferredPaymentRequest, automaticReloadPaymentRequest: $automaticReloadPaymentRequest)'; } @override @@ -3712,13 +3757,17 @@ class _$PaymentElementApplePayOptionsImpl other.recurringPaymentRequest, recurringPaymentRequest) || other.recurringPaymentRequest == recurringPaymentRequest) && (identical(other.deferredPaymentRequest, deferredPaymentRequest) || - 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); + int get hashCode => Object.hash(runtimeType, recurringPaymentRequest, + deferredPaymentRequest, automaticReloadPaymentRequest); @JsonKey(ignore: true) @override @@ -3741,7 +3790,9 @@ abstract class _PaymentElementApplePayOptions const factory _PaymentElementApplePayOptions( {final PaymentElementAppleRecurringRequest? recurringPaymentRequest, final PaymentElementApplePayDeferredPaymentRequest? - deferredPaymentRequest}) = _$PaymentElementApplePayOptionsImpl; + deferredPaymentRequest, + final PaymentElementApplePayAutoReloadPaymentRequest? + automaticReloadPaymentRequest}) = _$PaymentElementApplePayOptionsImpl; factory _PaymentElementApplePayOptions.fromJson(Map json) = _$PaymentElementApplePayOptionsImpl.fromJson; @@ -3755,6 +3806,11 @@ abstract class _PaymentElementApplePayOptions /// 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> @@ -4895,3 +4951,471 @@ abstract class _PaymentElementApplePayDeferredPaymentProperties _$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 + @useResult + $Res call( + {String paymentDescription, + String managementUrl, + PaymentElementApplePayReloadPaymentProperties automaticReloadBilling}); + + @override + $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 + $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 + 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) + @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; +} + +PaymentElementApplePayReloadPaymentProperties + _$PaymentElementApplePayReloadPaymentPropertiesFromJson( + Map json) { + return _PaymentElementApplePayReloadPaymentProperties.fromJson(json); +} + +/// @nodoc +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) + $PaymentElementApplePayReloadPaymentPropertiesCopyWith< + PaymentElementApplePayReloadPaymentProperties> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + factory $PaymentElementApplePayReloadPaymentPropertiesCopyWith( + PaymentElementApplePayReloadPaymentProperties value, + $Res Function(PaymentElementApplePayReloadPaymentProperties) then) = + _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl<$Res, + PaymentElementApplePayReloadPaymentProperties>; + @useResult + $Res call( + {double amount, + String label, + DateTime automaticReloadPaymentThresholdAmount}); +} + +/// @nodoc +class _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl<$Res, + $Val extends PaymentElementApplePayReloadPaymentProperties> + implements $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + _$PaymentElementApplePayReloadPaymentPropertiesCopyWithImpl( + 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? automaticReloadPaymentThresholdAmount = 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, + automaticReloadPaymentThresholdAmount: null == + automaticReloadPaymentThresholdAmount + ? _value.automaticReloadPaymentThresholdAmount + : automaticReloadPaymentThresholdAmount // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith< + $Res> + implements $PaymentElementApplePayReloadPaymentPropertiesCopyWith<$Res> { + factory _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith( + _$PaymentElementApplePayReloadPaymentPropertiesImpl value, + $Res Function(_$PaymentElementApplePayReloadPaymentPropertiesImpl) + then) = + __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {double amount, + String label, + DateTime automaticReloadPaymentThresholdAmount}); +} + +/// @nodoc +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? amount = null, + Object? label = null, + Object? automaticReloadPaymentThresholdAmount = null, + }) { + 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 _$PaymentElementApplePayReloadPaymentPropertiesImpl + implements _PaymentElementApplePayReloadPaymentProperties { + const _$PaymentElementApplePayReloadPaymentPropertiesImpl( + {required this.amount, + required this.label, + required this.automaticReloadPaymentThresholdAmount}); + + factory _$PaymentElementApplePayReloadPaymentPropertiesImpl.fromJson( + Map json) => + _$$PaymentElementApplePayReloadPaymentPropertiesImplFromJson(json); + + /// The amount of the payment + @override + final double amount; + + /// Description label + @override + final String label; + + /// The date when the threshold amount will be reached + @override + final DateTime automaticReloadPaymentThresholdAmount; + + @override + String toString() { + return 'PaymentElementApplePayReloadPaymentProperties(amount: $amount, label: $label, automaticReloadPaymentThresholdAmount: $automaticReloadPaymentThresholdAmount)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + 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, amount, label, automaticReloadPaymentThresholdAmount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWith< + _$PaymentElementApplePayReloadPaymentPropertiesImpl> + get copyWith => + __$$PaymentElementApplePayReloadPaymentPropertiesImplCopyWithImpl< + _$PaymentElementApplePayReloadPaymentPropertiesImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PaymentElementApplePayReloadPaymentPropertiesImplToJson( + this, + ); + } +} + +abstract class _PaymentElementApplePayReloadPaymentProperties + implements PaymentElementApplePayReloadPaymentProperties { + const factory _PaymentElementApplePayReloadPaymentProperties( + {required final double amount, + required final String label, + required final DateTime automaticReloadPaymentThresholdAmount}) = + _$PaymentElementApplePayReloadPaymentPropertiesImpl; + + factory _PaymentElementApplePayReloadPaymentProperties.fromJson( + Map json) = + _$PaymentElementApplePayReloadPaymentPropertiesImpl.fromJson; + + @override + + /// The amount of the payment + double get amount; + @override + + /// Description label + String get label; + @override + + /// The date when the threshold amount will be reached + DateTime get automaticReloadPaymentThresholdAmount; + @override + @JsonKey(ignore: true) + _$$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 b6e8efa5b..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 @@ -451,6 +451,12 @@ _$PaymentElementApplePayOptionsImpl : PaymentElementApplePayDeferredPaymentRequest.fromJson( Map.from( json['deferredPaymentRequest'] as Map)), + automaticReloadPaymentRequest: + json['automaticReloadPaymentRequest'] == null + ? null + : PaymentElementApplePayAutoReloadPaymentRequest.fromJson( + Map.from( + json['automaticReloadPaymentRequest'] as Map)), ); Map _$$PaymentElementApplePayOptionsImplToJson( @@ -467,6 +473,8 @@ Map _$$PaymentElementApplePayOptionsImplToJson( 'recurringPaymentRequest', instance.recurringPaymentRequest?.toJson()); writeNotNull( 'deferredPaymentRequest', instance.deferredPaymentRequest?.toJson()); + writeNotNull('automaticReloadPaymentRequest', + instance.automaticReloadPaymentRequest?.toJson()); return val; } @@ -608,3 +616,41 @@ Map '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(), + };