From be2839f1c1f6016d126aeae9468b9a1b86b261f4 Mon Sep 17 00:00:00 2001 From: Slowline Date: Wed, 24 Jul 2024 15:03:23 +0200 Subject: [PATCH 1/2] Add Klarna Support for Web --- .../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_change_event.freezed.dart | 6 +- .../card_element_options.freezed.dart | 6 +- .../elements/element_appearance.freezed.dart | 4 +- .../payment_element_change_event.freezed.dart | 6 +- .../payment_element_options.freezed.dart | 20 +- ...t_intent_shipping_information.freezed.dart | 4 +- ...nfirm_acss_debit_payment_data.freezed.dart | 4 +- ...rm_acss_debit_payment_options.freezed.dart | 4 +- .../confirm_alipay_payment_data.freezed.dart | 4 +- ...onfirm_alipay_payment_options.freezed.dart | 4 +- .../confirm_card_payment_data.freezed.dart | 4 +- .../confirm_card_payment_options.freezed.dart | 4 +- .../confirm_ideal_payment_data.freezed.dart | 4 +- ...confirm_ideal_payment_options.freezed.dart | 4 +- .../confirm_klarna_payment_data.dart | 21 + .../confirm_klarna_payment_data.freezed.dart | 226 +++++++++ .../confirm_klarna_payment_data.g.dart | 33 ++ .../confirm_klarna_payment_options.dart | 16 + ...onfirm_klarna_payment_options.freezed.dart | 172 +++++++ .../confirm_klarna_payment_options.g.dart | 27 ++ .../confirm_payment_options.freezed.dart | 6 +- ...nfirm_sepa_debit_payment_data.freezed.dart | 14 +- .../payment_intent.freezed.dart | 10 +- .../api/payment_intents/payment_intent.g.dart | 14 +- .../payment_intent_response.freezed.dart | 4 +- .../api/payment_intents/payment_intents.dart | 2 + .../create_payment_method_data.freezed.dart | 4 +- .../payment_method.freezed.dart | 22 +- .../api/payment_methods/payment_method.g.dart | 6 +- .../payment_method_details.dart | 25 + .../payment_method_details.freezed.dart | 454 +++++++++++++++++- .../payment_method_details.g.dart | 39 ++ .../payment_method_params.freezed.dart | 62 +-- .../payment_method_response.freezed.dart | 4 +- .../confirm_card_setup_data.freezed.dart | 4 +- .../confirm_card_setup_options.freezed.dart | 4 +- ...confirm_sepa_debit_setup_data.freezed.dart | 4 +- .../setup_intents/setup_intent.freezed.dart | 4 +- .../src/api/setup_intents/setup_intent.g.dart | 2 +- .../setup_intent_response.freezed.dart | 4 +- ...reate_token_bank_account_data.freezed.dart | 4 +- .../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 +- .../api/tokens/token_response.freezed.dart | 4 +- .../confirm_klarna_payment.dart | 52 ++ .../js/payment_intents/payment_intents.dart | 1 + packages/stripe_web/lib/src/web_stripe.dart | 24 + 52 files changed, 1229 insertions(+), 155 deletions(-) create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.dart create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.freezed.dart create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.g.dart create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.dart create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.freezed.dart create mode 100644 packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.g.dart create mode 100644 packages/stripe_js/lib/src/js/payment_intents/confirm_klarna_payment.dart 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_change_event.freezed.dart b/packages/stripe_js/lib/src/api/elements/card_element_change_event.freezed.dart index 00ca4f680..2ee50e417 100644 --- a/packages/stripe_js/lib/src/api/elements/card_element_change_event.freezed.dart +++ b/packages/stripe_js/lib/src/api/elements/card_element_change_event.freezed.dart @@ -12,7 +12,7 @@ part of 'card_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'); CardElementChangeEvent _$CardElementChangeEventFromJson( Map json) { @@ -231,7 +231,7 @@ class _$CardElementChangeEventImpl implements _CardElementChangeEvent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardElementChangeEventImpl && @@ -401,7 +401,7 @@ class _$CardElementChangeEventValueImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardElementChangeEventValueImpl && 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.freezed.dart b/packages/stripe_js/lib/src/api/elements/payment_element_options.freezed.dart index 375fdaf79..37954c642 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) { @@ -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 && @@ -627,7 +627,7 @@ class _$PaymentElementLayoutImpl implements _PaymentElementLayout { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementLayoutImpl && @@ -837,7 +837,7 @@ class _$PaymentElementDefaultValuesImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementDefaultValuesImpl && @@ -1060,7 +1060,7 @@ class _$PaymentElementBillingDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsImpl && @@ -1331,7 +1331,7 @@ class _$PaymentElementBillingDetailsAddressImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentElementBillingDetailsAddressImpl && @@ -1514,7 +1514,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 +1680,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 +1896,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 +2146,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_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/confirm_alipay_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_data.freezed.dart index 30fc07777..70fa2f314 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_alipay_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'); ConfirmAlipayPaymentData _$ConfirmAlipayPaymentDataFromJson( Map json) { @@ -149,7 +149,7 @@ class _$ConfirmAlipayPaymentDataImpl implements _ConfirmAlipayPaymentData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmAlipayPaymentDataImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_options.freezed.dart index 2ec05406f..b29b5daa4 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_alipay_payment_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_alipay_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'); ConfirmAlipayPaymentOptions _$ConfirmAlipayPaymentOptionsFromJson( Map json) { @@ -125,7 +125,7 @@ class _$ConfirmAlipayPaymentOptionsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmAlipayPaymentOptionsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_data.freezed.dart index b9c746b2d..f1c2d2a2c 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_card_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'); ConfirmCardPaymentData _$ConfirmCardPaymentDataFromJson( Map json) { @@ -304,7 +304,7 @@ class _$ConfirmCardPaymentDataImpl implements _ConfirmCardPaymentData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmCardPaymentDataImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_options.freezed.dart index ffe838752..50cbe01c8 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_card_payment_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_card_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'); ConfirmCardPaymentOptions _$ConfirmCardPaymentOptionsFromJson( Map json) { @@ -123,7 +123,7 @@ class _$ConfirmCardPaymentOptionsImpl implements _ConfirmCardPaymentOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmCardPaymentOptionsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_data.freezed.dart index 5e149f778..6e19d6cd8 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_ideal_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'); ConfirmIdealPaymentData _$ConfirmIdealPaymentDataFromJson( Map json) { @@ -201,7 +201,7 @@ class _$ConfirmIdealPaymentDataImpl implements _ConfirmIdealPaymentData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmIdealPaymentDataImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_options.freezed.dart index 964dd47b7..e38df77b8 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_ideal_payment_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_ideal_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'); ConfirmIdealPaymentOptions _$ConfirmIdealPaymentOptionsFromJson( Map json) { @@ -123,7 +123,7 @@ class _$ConfirmIdealPaymentOptionsImpl implements _ConfirmIdealPaymentOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmIdealPaymentOptionsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.dart new file mode 100644 index 000000000..555be7bf6 --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.dart @@ -0,0 +1,21 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stripe_js/stripe_api.dart'; + +part 'confirm_klarna_payment_data.freezed.dart'; +part 'confirm_klarna_payment_data.g.dart'; + +@freezed +class ConfirmKlarnaPaymentData with _$ConfirmKlarnaPaymentData { + const factory ConfirmKlarnaPaymentData({ + /// Either the id of an existing PaymentMethod, or an object containing + /// data to create a PaymentMethod with. + /// See the use case sections below for details. + @paymentMethodDetailJsonKey KlarnaPaymentMethodDetails? paymentMethod, + + /// The url your customer will be directed to after they complete authentication. + @JsonKey(name: 'return_url') String? returnUrl, + }) = _ConfirmKlarnaPaymentData; + + factory ConfirmKlarnaPaymentData.fromJson(Map json) => + _$ConfirmKlarnaPaymentDataFromJson(json); +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.freezed.dart new file mode 100644 index 000000000..8412f8469 --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.freezed.dart @@ -0,0 +1,226 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'confirm_klarna_payment_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +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#adding-getters-and-methods-to-our-models'); + +ConfirmKlarnaPaymentData _$ConfirmKlarnaPaymentDataFromJson( + Map json) { + return _ConfirmKlarnaPaymentData.fromJson(json); +} + +/// @nodoc +mixin _$ConfirmKlarnaPaymentData { + /// Either the id of an existing PaymentMethod, or an object containing + /// data to create a PaymentMethod with. + /// See the use case sections below for details. + @paymentMethodDetailJsonKey + KlarnaPaymentMethodDetails? get paymentMethod => + throw _privateConstructorUsedError; + + /// The url your customer will be directed to after they complete authentication. + @JsonKey(name: 'return_url') + String? get returnUrl => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ConfirmKlarnaPaymentDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ConfirmKlarnaPaymentDataCopyWith<$Res> { + factory $ConfirmKlarnaPaymentDataCopyWith(ConfirmKlarnaPaymentData value, + $Res Function(ConfirmKlarnaPaymentData) then) = + _$ConfirmKlarnaPaymentDataCopyWithImpl<$Res, ConfirmKlarnaPaymentData>; + @useResult + $Res call( + {@paymentMethodDetailJsonKey KlarnaPaymentMethodDetails? paymentMethod, + @JsonKey(name: 'return_url') String? returnUrl}); + + $KlarnaPaymentMethodDetailsCopyWith<$Res>? get paymentMethod; +} + +/// @nodoc +class _$ConfirmKlarnaPaymentDataCopyWithImpl<$Res, + $Val extends ConfirmKlarnaPaymentData> + implements $ConfirmKlarnaPaymentDataCopyWith<$Res> { + _$ConfirmKlarnaPaymentDataCopyWithImpl(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? paymentMethod = freezed, + Object? returnUrl = freezed, + }) { + return _then(_value.copyWith( + paymentMethod: freezed == paymentMethod + ? _value.paymentMethod + : paymentMethod // ignore: cast_nullable_to_non_nullable + as KlarnaPaymentMethodDetails?, + returnUrl: freezed == returnUrl + ? _value.returnUrl + : returnUrl // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $KlarnaPaymentMethodDetailsCopyWith<$Res>? get paymentMethod { + if (_value.paymentMethod == null) { + return null; + } + + return $KlarnaPaymentMethodDetailsCopyWith<$Res>(_value.paymentMethod!, + (value) { + return _then(_value.copyWith(paymentMethod: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$ConfirmKlarnaPaymentDataImplCopyWith<$Res> + implements $ConfirmKlarnaPaymentDataCopyWith<$Res> { + factory _$$ConfirmKlarnaPaymentDataImplCopyWith( + _$ConfirmKlarnaPaymentDataImpl value, + $Res Function(_$ConfirmKlarnaPaymentDataImpl) then) = + __$$ConfirmKlarnaPaymentDataImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@paymentMethodDetailJsonKey KlarnaPaymentMethodDetails? paymentMethod, + @JsonKey(name: 'return_url') String? returnUrl}); + + @override + $KlarnaPaymentMethodDetailsCopyWith<$Res>? get paymentMethod; +} + +/// @nodoc +class __$$ConfirmKlarnaPaymentDataImplCopyWithImpl<$Res> + extends _$ConfirmKlarnaPaymentDataCopyWithImpl<$Res, + _$ConfirmKlarnaPaymentDataImpl> + implements _$$ConfirmKlarnaPaymentDataImplCopyWith<$Res> { + __$$ConfirmKlarnaPaymentDataImplCopyWithImpl( + _$ConfirmKlarnaPaymentDataImpl _value, + $Res Function(_$ConfirmKlarnaPaymentDataImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentMethod = freezed, + Object? returnUrl = freezed, + }) { + return _then(_$ConfirmKlarnaPaymentDataImpl( + paymentMethod: freezed == paymentMethod + ? _value.paymentMethod + : paymentMethod // ignore: cast_nullable_to_non_nullable + as KlarnaPaymentMethodDetails?, + returnUrl: freezed == returnUrl + ? _value.returnUrl + : returnUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ConfirmKlarnaPaymentDataImpl implements _ConfirmKlarnaPaymentData { + const _$ConfirmKlarnaPaymentDataImpl( + {@paymentMethodDetailJsonKey this.paymentMethod, + @JsonKey(name: 'return_url') this.returnUrl}); + + factory _$ConfirmKlarnaPaymentDataImpl.fromJson(Map json) => + _$$ConfirmKlarnaPaymentDataImplFromJson(json); + + /// Either the id of an existing PaymentMethod, or an object containing + /// data to create a PaymentMethod with. + /// See the use case sections below for details. + @override + @paymentMethodDetailJsonKey + final KlarnaPaymentMethodDetails? paymentMethod; + + /// The url your customer will be directed to after they complete authentication. + @override + @JsonKey(name: 'return_url') + final String? returnUrl; + + @override + String toString() { + return 'ConfirmKlarnaPaymentData(paymentMethod: $paymentMethod, returnUrl: $returnUrl)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConfirmKlarnaPaymentDataImpl && + (identical(other.paymentMethod, paymentMethod) || + other.paymentMethod == paymentMethod) && + (identical(other.returnUrl, returnUrl) || + other.returnUrl == returnUrl)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, paymentMethod, returnUrl); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConfirmKlarnaPaymentDataImplCopyWith<_$ConfirmKlarnaPaymentDataImpl> + get copyWith => __$$ConfirmKlarnaPaymentDataImplCopyWithImpl< + _$ConfirmKlarnaPaymentDataImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ConfirmKlarnaPaymentDataImplToJson( + this, + ); + } +} + +abstract class _ConfirmKlarnaPaymentData implements ConfirmKlarnaPaymentData { + const factory _ConfirmKlarnaPaymentData( + {@paymentMethodDetailJsonKey + final KlarnaPaymentMethodDetails? paymentMethod, + @JsonKey(name: 'return_url') final String? returnUrl}) = + _$ConfirmKlarnaPaymentDataImpl; + + factory _ConfirmKlarnaPaymentData.fromJson(Map json) = + _$ConfirmKlarnaPaymentDataImpl.fromJson; + + @override + + /// Either the id of an existing PaymentMethod, or an object containing + /// data to create a PaymentMethod with. + /// See the use case sections below for details. + @paymentMethodDetailJsonKey + KlarnaPaymentMethodDetails? get paymentMethod; + @override + + /// The url your customer will be directed to after they complete authentication. + @JsonKey(name: 'return_url') + String? get returnUrl; + @override + @JsonKey(ignore: true) + _$$ConfirmKlarnaPaymentDataImplCopyWith<_$ConfirmKlarnaPaymentDataImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.g.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.g.dart new file mode 100644 index 000000000..52877e658 --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_data.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'confirm_klarna_payment_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ConfirmKlarnaPaymentDataImpl _$$ConfirmKlarnaPaymentDataImplFromJson( + Map json) => + _$ConfirmKlarnaPaymentDataImpl( + paymentMethod: json['payment_method'] == null + ? null + : KlarnaPaymentMethodDetails.fromJson( + Map.from(json['payment_method'] as Map)), + returnUrl: json['return_url'] as String?, + ); + +Map _$$ConfirmKlarnaPaymentDataImplToJson( + _$ConfirmKlarnaPaymentDataImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('payment_method', + PaymentMethodDetails.toJsonConverter(instance.paymentMethod)); + writeNotNull('return_url', instance.returnUrl); + return val; +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.dart new file mode 100644 index 000000000..ba4b37320 --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'confirm_klarna_payment_options.freezed.dart'; +part 'confirm_klarna_payment_options.g.dart'; + +@freezed +class ConfirmKlarnaPaymentOptions with _$ConfirmKlarnaPaymentOptions { + const factory ConfirmKlarnaPaymentOptions({ + /// Set this to false if you want to manually handle + /// the authorization redirect. Default is true. + @Default(true) bool? handleActions, + }) = _ConfirmKlarnaPaymentOptions; + + factory ConfirmKlarnaPaymentOptions.fromJson(Map json) => + _$ConfirmKlarnaPaymentOptionsFromJson(json); +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.freezed.dart new file mode 100644 index 000000000..62ac9252c --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.freezed.dart @@ -0,0 +1,172 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'confirm_klarna_payment_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +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#adding-getters-and-methods-to-our-models'); + +ConfirmKlarnaPaymentOptions _$ConfirmKlarnaPaymentOptionsFromJson( + Map json) { + return _ConfirmKlarnaPaymentOptions.fromJson(json); +} + +/// @nodoc +mixin _$ConfirmKlarnaPaymentOptions { + /// Set this to false if you want to manually handle + /// the authorization redirect. Default is true. + bool? get handleActions => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ConfirmKlarnaPaymentOptionsCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ConfirmKlarnaPaymentOptionsCopyWith<$Res> { + factory $ConfirmKlarnaPaymentOptionsCopyWith( + ConfirmKlarnaPaymentOptions value, + $Res Function(ConfirmKlarnaPaymentOptions) then) = + _$ConfirmKlarnaPaymentOptionsCopyWithImpl<$Res, + ConfirmKlarnaPaymentOptions>; + @useResult + $Res call({bool? handleActions}); +} + +/// @nodoc +class _$ConfirmKlarnaPaymentOptionsCopyWithImpl<$Res, + $Val extends ConfirmKlarnaPaymentOptions> + implements $ConfirmKlarnaPaymentOptionsCopyWith<$Res> { + _$ConfirmKlarnaPaymentOptionsCopyWithImpl(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? handleActions = freezed, + }) { + return _then(_value.copyWith( + handleActions: freezed == handleActions + ? _value.handleActions + : handleActions // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ConfirmKlarnaPaymentOptionsImplCopyWith<$Res> + implements $ConfirmKlarnaPaymentOptionsCopyWith<$Res> { + factory _$$ConfirmKlarnaPaymentOptionsImplCopyWith( + _$ConfirmKlarnaPaymentOptionsImpl value, + $Res Function(_$ConfirmKlarnaPaymentOptionsImpl) then) = + __$$ConfirmKlarnaPaymentOptionsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool? handleActions}); +} + +/// @nodoc +class __$$ConfirmKlarnaPaymentOptionsImplCopyWithImpl<$Res> + extends _$ConfirmKlarnaPaymentOptionsCopyWithImpl<$Res, + _$ConfirmKlarnaPaymentOptionsImpl> + implements _$$ConfirmKlarnaPaymentOptionsImplCopyWith<$Res> { + __$$ConfirmKlarnaPaymentOptionsImplCopyWithImpl( + _$ConfirmKlarnaPaymentOptionsImpl _value, + $Res Function(_$ConfirmKlarnaPaymentOptionsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? handleActions = freezed, + }) { + return _then(_$ConfirmKlarnaPaymentOptionsImpl( + handleActions: freezed == handleActions + ? _value.handleActions + : handleActions // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ConfirmKlarnaPaymentOptionsImpl + implements _ConfirmKlarnaPaymentOptions { + const _$ConfirmKlarnaPaymentOptionsImpl({this.handleActions = true}); + + factory _$ConfirmKlarnaPaymentOptionsImpl.fromJson( + Map json) => + _$$ConfirmKlarnaPaymentOptionsImplFromJson(json); + + /// Set this to false if you want to manually handle + /// the authorization redirect. Default is true. + @override + @JsonKey() + final bool? handleActions; + + @override + String toString() { + return 'ConfirmKlarnaPaymentOptions(handleActions: $handleActions)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConfirmKlarnaPaymentOptionsImpl && + (identical(other.handleActions, handleActions) || + other.handleActions == handleActions)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, handleActions); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConfirmKlarnaPaymentOptionsImplCopyWith<_$ConfirmKlarnaPaymentOptionsImpl> + get copyWith => __$$ConfirmKlarnaPaymentOptionsImplCopyWithImpl< + _$ConfirmKlarnaPaymentOptionsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ConfirmKlarnaPaymentOptionsImplToJson( + this, + ); + } +} + +abstract class _ConfirmKlarnaPaymentOptions + implements ConfirmKlarnaPaymentOptions { + const factory _ConfirmKlarnaPaymentOptions({final bool? handleActions}) = + _$ConfirmKlarnaPaymentOptionsImpl; + + factory _ConfirmKlarnaPaymentOptions.fromJson(Map json) = + _$ConfirmKlarnaPaymentOptionsImpl.fromJson; + + @override + + /// Set this to false if you want to manually handle + /// the authorization redirect. Default is true. + bool? get handleActions; + @override + @JsonKey(ignore: true) + _$$ConfirmKlarnaPaymentOptionsImplCopyWith<_$ConfirmKlarnaPaymentOptionsImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.g.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.g.dart new file mode 100644 index 000000000..79a4f89f1 --- /dev/null +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_klarna_payment_options.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'confirm_klarna_payment_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ConfirmKlarnaPaymentOptionsImpl _$$ConfirmKlarnaPaymentOptionsImplFromJson( + Map json) => + _$ConfirmKlarnaPaymentOptionsImpl( + handleActions: json['handleActions'] as bool? ?? true, + ); + +Map _$$ConfirmKlarnaPaymentOptionsImplToJson( + _$ConfirmKlarnaPaymentOptionsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('handleActions', instance.handleActions); + return val; +} diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_payment_options.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_payment_options.freezed.dart index 6f11f938b..a9b355b56 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_payment_options.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_payment_options.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_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'); ConfirmPaymentOptions _$ConfirmPaymentOptionsFromJson( Map json) { @@ -196,7 +196,7 @@ class _$ConfirmPaymentOptionsImpl implements _ConfirmPaymentOptions { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmPaymentOptionsImpl && @@ -367,7 +367,7 @@ class _$ConfirmPaymentParamsImpl implements _ConfirmPaymentParams { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmPaymentParamsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/confirm_sepa_debit_payment_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/confirm_sepa_debit_payment_data.freezed.dart index d80d048f4..021895e37 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/confirm_sepa_debit_payment_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/confirm_sepa_debit_payment_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_sepa_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'); ConfirmSepaDebitPaymentData _$ConfirmSepaDebitPaymentDataFromJson( Map json) { @@ -183,7 +183,7 @@ class _$ConfirmSepaDebitPaymentDataImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConfirmSepaDebitPaymentDataImpl && @@ -417,7 +417,7 @@ class _$IdSepaDebitPaymentMethodDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdSepaDebitPaymentMethodDetailsImpl && @@ -641,7 +641,7 @@ class _$SepaDebitPaymentMethodDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SepaDebitPaymentMethodDetailsImpl && @@ -888,7 +888,7 @@ class _$SepaDebitPaymentMethodDetailsWithIbanImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SepaDebitPaymentMethodDetailsWithIbanImpl && @@ -1135,7 +1135,7 @@ class _$SepaDebitIbanDataImpl implements _SepaDebitIbanData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SepaDebitIbanDataImpl && @@ -1348,7 +1348,7 @@ class _$SepaBillingDetailsImpl implements _SepaBillingDetails { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SepaBillingDetailsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.freezed.dart index 0b4e33118..b69f97233 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_intent.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'); PaymentIntent _$PaymentIntentFromJson(Map json) { return _PaymentIntent.fromJson(json); @@ -1178,7 +1178,7 @@ class _$PaymentIntentImpl implements _PaymentIntent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentIntentImpl && @@ -1742,7 +1742,7 @@ class _$PaymentIntentAmountDetailsImpl implements _PaymentIntentAmountDetails { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentIntentAmountDetailsImpl && @@ -1885,7 +1885,7 @@ class _$PaymentIntentTipImpl implements _PaymentIntentTip { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentIntentTipImpl && @@ -2036,7 +2036,7 @@ class _$PaymentIntentAutomaticPaymentMethodsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentIntentAutomaticPaymentMethodsImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart index 2c53088bc..bb566f45c 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/payment_intent.g.dart @@ -10,21 +10,21 @@ _$PaymentIntentImpl _$$PaymentIntentImplFromJson(Map json) => _$PaymentIntentImpl( id: json['id'] as String, object: json['object'] as String? ?? "payment_intent", - amount: json['amount'] as int, - amountCapturable: json['amount_capturable'] as int?, + amount: (json['amount'] as num).toInt(), + amountCapturable: (json['amount_capturable'] as num?)?.toInt(), amountDetails: json['amount_details'] == null ? const PaymentIntentAmountDetails() : PaymentIntentAmountDetails.fromJson( Map.from(json['amount_details'] as Map)), - amountReceived: json['amount_received'] as int?, + amountReceived: (json['amount_received'] as num?)?.toInt(), application: json['application'] as String?, - applicationFeeAmount: json['application_fee_amount'] as int?, + applicationFeeAmount: (json['application_fee_amount'] as num?)?.toInt(), automaticPaymentMethods: json['automatic_payment_methods'] == null ? null : PaymentIntentAutomaticPaymentMethods.fromJson( Map.from( json['automatic_payment_methods'] as Map)), - canceledAt: json['canceled_at'] as int?, + canceledAt: (json['canceled_at'] as num?)?.toInt(), cancellationReason: $enumDecodeNullable( _$PaymentIntentCancellationReasonEnumMap, json['cancellation_reason']), @@ -36,7 +36,7 @@ _$PaymentIntentImpl _$$PaymentIntentImplFromJson(Map json) => _$PaymentIntentConfirmationMethodEnumMap, json['confirmation_method']) ?? PaymentIntentConfirmationMethod.automatic, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), currency: json['currency'] as String, customer: json['customer'] as String?, description: json['description'] as String?, @@ -231,7 +231,7 @@ Map _$$PaymentIntentAmountDetailsImplToJson( _$PaymentIntentTipImpl _$$PaymentIntentTipImplFromJson(Map json) => _$PaymentIntentTipImpl( - amount: json['amount'] as int?, + amount: (json['amount'] as num?)?.toInt(), ); Map _$$PaymentIntentTipImplToJson( diff --git a/packages/stripe_js/lib/src/api/payment_intents/payment_intent_response.freezed.dart b/packages/stripe_js/lib/src/api/payment_intents/payment_intent_response.freezed.dart index fede51fbd..494bd87f7 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/payment_intent_response.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/payment_intent_response.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_intent_response.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'); PaymentIntentResponse _$PaymentIntentResponseFromJson( Map json) { @@ -166,7 +166,7 @@ class _$PaymentIntentResponseImpl implements _PaymentIntentResponse { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentIntentResponseImpl && diff --git a/packages/stripe_js/lib/src/api/payment_intents/payment_intents.dart b/packages/stripe_js/lib/src/api/payment_intents/payment_intents.dart index 896c4d6e7..b997f7ef3 100644 --- a/packages/stripe_js/lib/src/api/payment_intents/payment_intents.dart +++ b/packages/stripe_js/lib/src/api/payment_intents/payment_intents.dart @@ -6,6 +6,8 @@ export 'confirm_card_payment_data.dart'; export 'confirm_card_payment_options.dart'; export 'confirm_ideal_payment_data.dart'; export 'confirm_ideal_payment_options.dart'; +export 'confirm_klarna_payment_data.dart'; +export 'confirm_klarna_payment_options.dart'; export 'confirm_payment_options.dart'; export 'confirm_sepa_debit_payment_data.dart'; export 'payment_intent.dart'; diff --git a/packages/stripe_js/lib/src/api/payment_methods/create_payment_method_data.freezed.dart b/packages/stripe_js/lib/src/api/payment_methods/create_payment_method_data.freezed.dart index 4da139562..e99969754 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/create_payment_method_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/create_payment_method_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_payment_method_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'); CreatePaymentMethodData _$CreatePaymentMethodDataFromJson( Map json) { @@ -384,7 +384,7 @@ class _$CreatePaymentMethodDataImpl implements _CreatePaymentMethodData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreatePaymentMethodDataImpl && diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method.freezed.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method.freezed.dart index e56d101bd..566d4b61e 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_method.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'); PaymentMethod _$PaymentMethodFromJson(Map json) { return _PaymentMethod.fromJson(json); @@ -620,7 +620,7 @@ class _$PaymentMethodImpl implements _PaymentMethod { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodImpl && @@ -926,7 +926,7 @@ class _$AuBecsDebitImpl implements _AuBecsDebit { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$AuBecsDebitImpl && @@ -1115,7 +1115,7 @@ class _$BacsDebitImpl implements _BacsDebit { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BacsDebitImpl && @@ -1425,7 +1425,7 @@ class _$CardPaymentMethodImpl implements _CardPaymentMethod { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardPaymentMethodImpl && @@ -1632,7 +1632,7 @@ class _$FpxImpl implements _Fpx { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FpxImpl && @@ -1793,7 +1793,7 @@ class _$IdealImpl implements _Ideal { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdealImpl && @@ -1993,7 +1993,7 @@ class _$SepaDebitImpl implements _SepaDebit { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SepaDebitImpl && @@ -2153,7 +2153,7 @@ class _$SofortImpl implements _Sofort { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SofortImpl && @@ -2286,7 +2286,7 @@ class _$UpiImpl implements _Upi { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$UpiImpl && @@ -2612,7 +2612,7 @@ class _$UsBankAccountImpl implements _UsBankAccount { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$UsBankAccountImpl && 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/payment_methods/payment_method_details.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart index 0e9b2f127..e3de7be98 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart @@ -77,6 +77,31 @@ class CardPaymentMethodDetails _$CardPaymentMethodDetailsFromJson(json); } +@Freezed(unionKey: 'type') +class KlarnaPaymentMethodDetails + with _$KlarnaPaymentMethodDetails + implements PaymentMethodDetails { + @FreezedUnionValue('klarna') + @Implements() + const factory KlarnaPaymentMethodDetails.id(String id) = + _IdKlarnaPaymentMethodDetails; + + /// Use stripe.confirmCardPayment with payment data from an Element by + /// passing a card or cardNumber Element as payment_method[card] in the + /// data argument. + /// + /// The new PaymentMethod will be created with data collected by the + /// Element and will be used to confirm the PaymentIntent. + @FreezedUnionValue('klarna') + const factory KlarnaPaymentMethodDetails({ + /// The billing_details associated with the card. + @JsonKey(name: 'billing_details') BillingDetails? billingDetails, + }) = _KlarnaPaymentMethodDetails; + + factory KlarnaPaymentMethodDetails.fromJson(Map json) => + _$KlarnaPaymentMethodDetailsFromJson(json); +} + @Freezed(unionKey: 'type') class IdealPaymentMethodDetails with _$IdealPaymentMethodDetails diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.freezed.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.freezed.dart index 48b286d24..d3522ddd0 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_method_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'); CardPaymentMethodDetails _$CardPaymentMethodDetailsFromJson( Map json) { @@ -163,7 +163,7 @@ class _$CardPaymentMethodRefImpl implements _CardPaymentMethodRef { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardPaymentMethodRefImpl && @@ -370,7 +370,7 @@ class _$CardPaymentMethodDefaultImpl implements _CardPaymentMethodDefault { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardPaymentMethodDefaultImpl && @@ -595,7 +595,7 @@ class _$CardPaymentMethodDetailsTokenImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardPaymentMethodDetailsTokenImpl && @@ -727,6 +727,442 @@ abstract class _CardPaymentMethodDetailsToken get copyWith => throw _privateConstructorUsedError; } +KlarnaPaymentMethodDetails _$KlarnaPaymentMethodDetailsFromJson( + Map json) { + switch (json['type']) { + case 'klarna': + return _IdKlarnaPaymentMethodDetails.fromJson(json); + case 'klarna': + return _KlarnaPaymentMethodDetails.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'type', 'KlarnaPaymentMethodDetails', + 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$KlarnaPaymentMethodDetails { + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails) + $default, { + required TResult Function(String id) id, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult? Function(String id)? id, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult Function(String id)? id, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map( + TResult Function(_KlarnaPaymentMethodDetails value) $default, { + required TResult Function(_IdKlarnaPaymentMethodDetails value) id, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult? Function(_IdKlarnaPaymentMethodDetails value)? id, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap( + TResult Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult Function(_IdKlarnaPaymentMethodDetails value)? id, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $KlarnaPaymentMethodDetailsCopyWith<$Res> { + factory $KlarnaPaymentMethodDetailsCopyWith(KlarnaPaymentMethodDetails value, + $Res Function(KlarnaPaymentMethodDetails) then) = + _$KlarnaPaymentMethodDetailsCopyWithImpl<$Res, + KlarnaPaymentMethodDetails>; +} + +/// @nodoc +class _$KlarnaPaymentMethodDetailsCopyWithImpl<$Res, + $Val extends KlarnaPaymentMethodDetails> + implements $KlarnaPaymentMethodDetailsCopyWith<$Res> { + _$KlarnaPaymentMethodDetailsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$IdKlarnaPaymentMethodDetailsImplCopyWith<$Res> { + factory _$$IdKlarnaPaymentMethodDetailsImplCopyWith( + _$IdKlarnaPaymentMethodDetailsImpl value, + $Res Function(_$IdKlarnaPaymentMethodDetailsImpl) then) = + __$$IdKlarnaPaymentMethodDetailsImplCopyWithImpl<$Res>; + @useResult + $Res call({String id}); +} + +/// @nodoc +class __$$IdKlarnaPaymentMethodDetailsImplCopyWithImpl<$Res> + extends _$KlarnaPaymentMethodDetailsCopyWithImpl<$Res, + _$IdKlarnaPaymentMethodDetailsImpl> + implements _$$IdKlarnaPaymentMethodDetailsImplCopyWith<$Res> { + __$$IdKlarnaPaymentMethodDetailsImplCopyWithImpl( + _$IdKlarnaPaymentMethodDetailsImpl _value, + $Res Function(_$IdKlarnaPaymentMethodDetailsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + }) { + return _then(_$IdKlarnaPaymentMethodDetailsImpl( + null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IdKlarnaPaymentMethodDetailsImpl + implements _IdKlarnaPaymentMethodDetails { + const _$IdKlarnaPaymentMethodDetailsImpl(this.id, {final String? $type}) + : $type = $type ?? 'klarna'; + + factory _$IdKlarnaPaymentMethodDetailsImpl.fromJson( + Map json) => + _$$IdKlarnaPaymentMethodDetailsImplFromJson(json); + + @override + final String id; + + @JsonKey(name: 'type') + final String $type; + + @override + String toString() { + return 'KlarnaPaymentMethodDetails.id(id: $id)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IdKlarnaPaymentMethodDetailsImpl && + (identical(other.id, id) || other.id == id)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IdKlarnaPaymentMethodDetailsImplCopyWith< + _$IdKlarnaPaymentMethodDetailsImpl> + get copyWith => __$$IdKlarnaPaymentMethodDetailsImplCopyWithImpl< + _$IdKlarnaPaymentMethodDetailsImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails) + $default, { + required TResult Function(String id) id, + }) { + return id(this.id); + } + + @override + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult? Function(String id)? id, + }) { + return id?.call(this.id); + } + + @override + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult Function(String id)? id, + required TResult orElse(), + }) { + if (id != null) { + return id(this.id); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map( + TResult Function(_KlarnaPaymentMethodDetails value) $default, { + required TResult Function(_IdKlarnaPaymentMethodDetails value) id, + }) { + return id(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult? Function(_IdKlarnaPaymentMethodDetails value)? id, + }) { + return id?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap( + TResult Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult Function(_IdKlarnaPaymentMethodDetails value)? id, + required TResult orElse(), + }) { + if (id != null) { + return id(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$IdKlarnaPaymentMethodDetailsImplToJson( + this, + ); + } +} + +abstract class _IdKlarnaPaymentMethodDetails + implements KlarnaPaymentMethodDetails, IdPaymentMethodDetails { + const factory _IdKlarnaPaymentMethodDetails(final String id) = + _$IdKlarnaPaymentMethodDetailsImpl; + + factory _IdKlarnaPaymentMethodDetails.fromJson(Map json) = + _$IdKlarnaPaymentMethodDetailsImpl.fromJson; + + String get id; + @JsonKey(ignore: true) + _$$IdKlarnaPaymentMethodDetailsImplCopyWith< + _$IdKlarnaPaymentMethodDetailsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$KlarnaPaymentMethodDetailsImplCopyWith<$Res> { + factory _$$KlarnaPaymentMethodDetailsImplCopyWith( + _$KlarnaPaymentMethodDetailsImpl value, + $Res Function(_$KlarnaPaymentMethodDetailsImpl) then) = + __$$KlarnaPaymentMethodDetailsImplCopyWithImpl<$Res>; + @useResult + $Res call({@JsonKey(name: 'billing_details') BillingDetails? billingDetails}); + + $BillingDetailsCopyWith<$Res>? get billingDetails; +} + +/// @nodoc +class __$$KlarnaPaymentMethodDetailsImplCopyWithImpl<$Res> + extends _$KlarnaPaymentMethodDetailsCopyWithImpl<$Res, + _$KlarnaPaymentMethodDetailsImpl> + implements _$$KlarnaPaymentMethodDetailsImplCopyWith<$Res> { + __$$KlarnaPaymentMethodDetailsImplCopyWithImpl( + _$KlarnaPaymentMethodDetailsImpl _value, + $Res Function(_$KlarnaPaymentMethodDetailsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? billingDetails = freezed, + }) { + return _then(_$KlarnaPaymentMethodDetailsImpl( + billingDetails: freezed == billingDetails + ? _value.billingDetails + : billingDetails // ignore: cast_nullable_to_non_nullable + as BillingDetails?, + )); + } + + @override + @pragma('vm:prefer-inline') + $BillingDetailsCopyWith<$Res>? get billingDetails { + if (_value.billingDetails == null) { + return null; + } + + return $BillingDetailsCopyWith<$Res>(_value.billingDetails!, (value) { + return _then(_value.copyWith(billingDetails: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$KlarnaPaymentMethodDetailsImpl implements _KlarnaPaymentMethodDetails { + const _$KlarnaPaymentMethodDetailsImpl( + {@JsonKey(name: 'billing_details') this.billingDetails, + final String? $type}) + : $type = $type ?? 'klarna'; + + factory _$KlarnaPaymentMethodDetailsImpl.fromJson( + Map json) => + _$$KlarnaPaymentMethodDetailsImplFromJson(json); + + /// The billing_details associated with the card. + @override + @JsonKey(name: 'billing_details') + final BillingDetails? billingDetails; + + @JsonKey(name: 'type') + final String $type; + + @override + String toString() { + return 'KlarnaPaymentMethodDetails(billingDetails: $billingDetails)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$KlarnaPaymentMethodDetailsImpl && + (identical(other.billingDetails, billingDetails) || + other.billingDetails == billingDetails)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, billingDetails); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$KlarnaPaymentMethodDetailsImplCopyWith<_$KlarnaPaymentMethodDetailsImpl> + get copyWith => __$$KlarnaPaymentMethodDetailsImplCopyWithImpl< + _$KlarnaPaymentMethodDetailsImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails) + $default, { + required TResult Function(String id) id, + }) { + return $default(billingDetails); + } + + @override + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult? Function(String id)? id, + }) { + return $default?.call(billingDetails); + } + + @override + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: 'billing_details') BillingDetails? billingDetails)? + $default, { + TResult Function(String id)? id, + required TResult orElse(), + }) { + if ($default != null) { + return $default(billingDetails); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map( + TResult Function(_KlarnaPaymentMethodDetails value) $default, { + required TResult Function(_IdKlarnaPaymentMethodDetails value) id, + }) { + return $default(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult? Function(_IdKlarnaPaymentMethodDetails value)? id, + }) { + return $default?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap( + TResult Function(_KlarnaPaymentMethodDetails value)? $default, { + TResult Function(_IdKlarnaPaymentMethodDetails value)? id, + required TResult orElse(), + }) { + if ($default != null) { + return $default(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$KlarnaPaymentMethodDetailsImplToJson( + this, + ); + } +} + +abstract class _KlarnaPaymentMethodDetails + implements KlarnaPaymentMethodDetails { + const factory _KlarnaPaymentMethodDetails( + {@JsonKey(name: 'billing_details') + final BillingDetails? billingDetails}) = _$KlarnaPaymentMethodDetailsImpl; + + factory _KlarnaPaymentMethodDetails.fromJson(Map json) = + _$KlarnaPaymentMethodDetailsImpl.fromJson; + + /// The billing_details associated with the card. + @JsonKey(name: 'billing_details') + BillingDetails? get billingDetails; + @JsonKey(ignore: true) + _$$KlarnaPaymentMethodDetailsImplCopyWith<_$KlarnaPaymentMethodDetailsImpl> + get copyWith => throw _privateConstructorUsedError; +} + IdealPaymentMethodDetails _$IdealPaymentMethodDetailsFromJson( Map json) { switch (json['type']) { @@ -881,7 +1317,7 @@ class _$IdIdealPaymentMethodDetailsImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdIdealPaymentMethodDetailsImpl && @@ -1088,7 +1524,7 @@ class _$IdealPaymentMethodDetailsImpl implements _IdealPaymentMethodDetails { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdealPaymentMethodDetailsImpl && @@ -1314,7 +1750,7 @@ class _$IdealPaymentMethodDetailsSelfCollectImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdealPaymentMethodDetailsSelfCollectImpl && @@ -1547,7 +1983,7 @@ class _$IdealBankDataImpl implements _IdealBankData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$IdealBankDataImpl && @@ -1691,7 +2127,7 @@ class _$CardTokenPaymentMethodImpl implements _CardTokenPaymentMethod { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardTokenPaymentMethodImpl && diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.g.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.g.dart index feaa34103..f1fa459a9 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.g.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.g.dart @@ -75,6 +75,45 @@ Map _$$CardPaymentMethodDetailsTokenImplToJson( return val; } +_$IdKlarnaPaymentMethodDetailsImpl _$$IdKlarnaPaymentMethodDetailsImplFromJson( + Map json) => + _$IdKlarnaPaymentMethodDetailsImpl( + json['id'] as String, + $type: json['type'] as String?, + ); + +Map _$$IdKlarnaPaymentMethodDetailsImplToJson( + _$IdKlarnaPaymentMethodDetailsImpl instance) => + { + 'id': instance.id, + 'type': instance.$type, + }; + +_$KlarnaPaymentMethodDetailsImpl _$$KlarnaPaymentMethodDetailsImplFromJson( + Map json) => + _$KlarnaPaymentMethodDetailsImpl( + billingDetails: json['billing_details'] == null + ? null + : BillingDetails.fromJson( + Map.from(json['billing_details'] as Map)), + $type: json['type'] as String?, + ); + +Map _$$KlarnaPaymentMethodDetailsImplToJson( + _$KlarnaPaymentMethodDetailsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('billing_details', instance.billingDetails?.toJson()); + val['type'] = instance.$type; + return val; +} + _$IdIdealPaymentMethodDetailsImpl _$$IdIdealPaymentMethodDetailsImplFromJson( Map json) => _$IdIdealPaymentMethodDetailsImpl( diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method_params.freezed.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_params.freezed.dart index 353507f6e..21df25de0 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_params.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_params.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_method_params.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'); PaymentMethodParams _$PaymentMethodParamsFromJson(Map json) { switch (json['paymentMethodType']) { @@ -324,7 +324,7 @@ class _$PaymentMethodParamsCardImpl implements _PaymentMethodParamsCard { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsCardImpl && @@ -628,7 +628,7 @@ class _$PaymentMethodParamsCardWithTokenImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsCardWithTokenImpl && @@ -936,7 +936,7 @@ class _$PaymentMethodParamsCardWithMethodIdImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsCardWithMethodIdImpl && @@ -1241,7 +1241,7 @@ class _$PaymentMethodParamsAlipayImpl implements _PaymentMethodParamsAlipay { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsAlipayImpl && @@ -1543,7 +1543,7 @@ class _$PaymentMethodParamsIdealImpl implements _PaymentMethodParamsIdeal { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsIdealImpl && @@ -1845,7 +1845,7 @@ class _$PaymentMethodParamsAubecsImpl implements _PaymentMethodParamsAubecs { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsAubecsImpl && @@ -2148,7 +2148,7 @@ class _$PaymentMethodParamsBankContactImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsBankContactImpl && @@ -2452,7 +2452,7 @@ class _$PaymentMethodParamsGiroPayImpl implements _PaymentMethodParamsGiroPay { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsGiroPayImpl && @@ -2753,7 +2753,7 @@ class _$PaymentMethodParamsEpsImpl implements _PaymentMethodParamsEps { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsEpsImpl && @@ -3054,7 +3054,7 @@ class _$PaymentMethodParamsAffirmImpl implements _PaymentMethodParamsAffirm { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsAffirmImpl && @@ -3355,7 +3355,7 @@ class _$PaymentMethodParamsPayImpl implements _PaymentMethodParamsPay { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsPayImpl && @@ -3656,7 +3656,7 @@ class _$PaymentMethodParamsP24Impl implements _PaymentMethodParamsP24 { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsP24Impl && @@ -3958,7 +3958,7 @@ class _$PaymentMethodParamsFpxImpl implements _PaymentMethodParamsFpx { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsFpxImpl && @@ -4262,7 +4262,7 @@ class _$PaymentMethodParamsSepaDebitImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsSepaDebitImpl && @@ -4565,7 +4565,7 @@ class _$PaymentMethodParamsSofortImpl implements _PaymentMethodParamsSofort { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsSofortImpl && @@ -4866,7 +4866,7 @@ class _$PaymentMethodParamsAfterpayClearpayImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsAfterpayClearpayImpl && @@ -5169,7 +5169,7 @@ class _$PaymentMethodParamsOxxoImpl implements _PaymentMethodParamsOxxo { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsOxxoImpl && @@ -5473,7 +5473,7 @@ class _$PaymentMethodParamsKlarnaImpl implements _PaymentMethodParamsKlarna { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsKlarnaImpl && @@ -5780,7 +5780,7 @@ class _$PaymentMethodParamsPayPalImpl implements _PaymentMethodParamsPayPal { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsPayPalImpl && @@ -6087,7 +6087,7 @@ class _$PaymentMethodParamsUsBankAccountImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodParamsUsBankAccountImpl && @@ -6473,7 +6473,7 @@ class _$PaymentMethodDataImpl implements _PaymentMethodData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataImpl && @@ -6706,7 +6706,7 @@ class _$PaymentMethodDataCardFromTokenImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataCardFromTokenImpl && @@ -6972,7 +6972,7 @@ class _$PaymentMethodDataCardFromMethodImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataCardFromMethodImpl && @@ -7219,7 +7219,7 @@ class _$PaymentMethodDataIdealImpl implements _PaymentMethodDataIdeal { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataIdealImpl && @@ -7456,7 +7456,7 @@ class _$PaymentMethodDataAubecsImpl implements _PaymentMethodDataAubecs { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataAubecsImpl && @@ -7695,7 +7695,7 @@ class _$PaymentMethodDataFpxImpl implements _PaymentMethodDataFpx { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataFpxImpl && @@ -7933,7 +7933,7 @@ class _$PaymentMethodDataSofortImpl implements _PaymentMethodDataSofort { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataSofortImpl && @@ -8168,7 +8168,7 @@ class _$PaymentMethodDataSepaImpl implements _PaymentMethodDataSepa { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataSepaImpl && @@ -8377,7 +8377,7 @@ class _$PaymentMethodDataAfterPayImpl implements _PaymentMethodDataAfterPay { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataAfterPayImpl && @@ -8672,7 +8672,7 @@ class _$PaymentMethodDataUsBankImpl implements _PaymentMethodDataUsBank { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodDataUsBankImpl && diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method_response.freezed.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_response.freezed.dart index 25940ffb5..144e158f3 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_response.freezed.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_response.freezed.dart @@ -12,7 +12,7 @@ part of 'payment_method_response.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'); PaymentMethodResponse _$PaymentMethodResponseFromJson( Map json) { @@ -166,7 +166,7 @@ class _$PaymentMethodResponseImpl implements _PaymentMethodResponse { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PaymentMethodResponseImpl && diff --git a/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_data.freezed.dart b/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_data.freezed.dart index 4d171462c..b37843950 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/confirm_card_setup_data.freezed.dart @@ -12,7 +12,7 @@ part of 'confirm_card_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'); ConfirmCardSetupData _$ConfirmCardSetupDataFromJson(Map json) { return _ConfirmCardSetupData.fromJson(json); @@ -168,7 +168,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/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.freezed.dart b/packages/stripe_js/lib/src/api/setup_intents/setup_intent.freezed.dart index e9aee4ea2..b21653141 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/setup_intent.freezed.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/setup_intent.freezed.dart @@ -12,7 +12,7 @@ part of 'setup_intent.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'); SetupIntent _$SetupIntentFromJson(Map json) { return _SetupIntent.fromJson(json); @@ -702,7 +702,7 @@ class _$SetupIntentImpl implements _SetupIntent { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SetupIntentImpl && 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/setup_intents/setup_intent_response.freezed.dart b/packages/stripe_js/lib/src/api/setup_intents/setup_intent_response.freezed.dart index 18dcc9ca5..a2772cbbe 100644 --- a/packages/stripe_js/lib/src/api/setup_intents/setup_intent_response.freezed.dart +++ b/packages/stripe_js/lib/src/api/setup_intents/setup_intent_response.freezed.dart @@ -12,7 +12,7 @@ part of 'setup_intent_response.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'); SetupIntentResponse _$SetupIntentResponseFromJson(Map json) { return _SetupIntentResponse.fromJson(json); @@ -162,7 +162,7 @@ class _$SetupIntentResponseImpl implements _SetupIntentResponse { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SetupIntentResponseImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/create_token_bank_account_data.freezed.dart b/packages/stripe_js/lib/src/api/tokens/create_token_bank_account_data.freezed.dart index 140330703..7aeb311b5 100644 --- a/packages/stripe_js/lib/src/api/tokens/create_token_bank_account_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/create_token_bank_account_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_token_bank_account_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'); CreateTokenBankAccountData _$CreateTokenBankAccountDataFromJson( Map json) { @@ -234,7 +234,7 @@ class _$CreateTokenBankAccountDataImpl implements _CreateTokenBankAccountData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreateTokenBankAccountDataImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart b/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart index f984ec2b8..db8c6dd8e 100644 --- a/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/create_token_card_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_token_card_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CreateTokenCardData _$CreateTokenCardDataFromJson(Map json) { return _CreateTokenCardData.fromJson(json); @@ -278,7 +278,7 @@ class _$CreateTokenCardDataImpl implements _CreateTokenCardData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreateTokenCardDataImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart b/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart index 6e2165533..3162f1e5f 100644 --- a/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/create_token_pii_data.freezed.dart @@ -12,7 +12,7 @@ part of 'create_token_pii_data.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CreateTokenPIIData _$CreateTokenPIIDataFromJson(Map json) { return _CreateTokenPIIData.fromJson(json); @@ -114,7 +114,7 @@ class _$CreateTokenPIIDataImpl implements _CreateTokenPIIData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CreateTokenPIIDataImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/token.freezed.dart b/packages/stripe_js/lib/src/api/tokens/token.freezed.dart index 50c635d7c..21b06bc8b 100644 --- a/packages/stripe_js/lib/src/api/tokens/token.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/token.freezed.dart @@ -12,7 +12,7 @@ part of 'token.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Token _$TokenFromJson(Map json) { return _Token.fromJson(json); @@ -320,7 +320,7 @@ class _$TokenImpl implements _Token { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TokenImpl && @@ -809,7 +809,7 @@ class _$BankAccountTokenImpl implements _BankAccountToken { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BankAccountTokenImpl && @@ -1613,7 +1613,7 @@ class _$CardTokenImpl implements _CardToken { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CardTokenImpl && diff --git a/packages/stripe_js/lib/src/api/tokens/token.g.dart b/packages/stripe_js/lib/src/api/tokens/token.g.dart index 0b9d15656..696e6d82c 100644 --- a/packages/stripe_js/lib/src/api/tokens/token.g.dart +++ b/packages/stripe_js/lib/src/api/tokens/token.g.dart @@ -17,7 +17,7 @@ _$TokenImpl _$$TokenImplFromJson(Map json) => _$TokenImpl( ? null : CardToken.fromJson(Map.from(json['card'] as Map)), clientIP: json['client_ip'] as String?, - created: json['created'] as int?, + created: (json['created'] as num?)?.toInt(), livemode: json['livemode'] as bool? ?? true, type: $enumDecode(_$TokenTypeEnumMap, json['type']), used: json['used'] as bool? ?? false, @@ -129,8 +129,8 @@ _$CardTokenImpl _$$CardTokenImplFromJson(Map json) => _$CardTokenImpl( cvcCheck: $enumDecodeNullable(_$VerificationCheckEnumMap, json['cvc_check']), dynamicLast4: json['dynamic_last4'] as String?, - expMonth: json['exp_month'] as int?, - expYear: json['exp_year'] as int?, + expMonth: (json['exp_month'] as num?)?.toInt(), + expYear: (json['exp_year'] as num?)?.toInt(), fingerprint: json['fingerprint'] as String?, funding: $enumDecodeNullable(_$CardFundingTypeEnumMap, json['funding']), last4: json['last4'] as String?, diff --git a/packages/stripe_js/lib/src/api/tokens/token_response.freezed.dart b/packages/stripe_js/lib/src/api/tokens/token_response.freezed.dart index c609f8738..38e858945 100644 --- a/packages/stripe_js/lib/src/api/tokens/token_response.freezed.dart +++ b/packages/stripe_js/lib/src/api/tokens/token_response.freezed.dart @@ -12,7 +12,7 @@ part of 'token_response.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'); TokenResponse _$TokenResponseFromJson(Map json) { return _TokenResponse.fromJson(json); @@ -164,7 +164,7 @@ class _$TokenResponseImpl implements _TokenResponse { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TokenResponseImpl && diff --git a/packages/stripe_js/lib/src/js/payment_intents/confirm_klarna_payment.dart b/packages/stripe_js/lib/src/js/payment_intents/confirm_klarna_payment.dart new file mode 100644 index 000000000..8459a72ac --- /dev/null +++ b/packages/stripe_js/lib/src/js/payment_intents/confirm_klarna_payment.dart @@ -0,0 +1,52 @@ +import 'package:js/js.dart'; +import 'package:stripe_js/src/api/payment_intents/confirm_klarna_payment_data.dart'; +import 'package:stripe_js/src/api/payment_intents/confirm_klarna_payment_options.dart'; +import 'package:stripe_js/src/js/utils/utils.dart'; +import 'package:stripe_js/stripe_api.dart'; +import 'package:stripe_js/stripe_js.dart'; + +extension ExtensionKlarnaPayment on Stripe { + _JS get js => this as _JS; + + /// Use stripe.confirmKlarnaPayment in the Klarna Payments with Payment + /// Methods flow when the customer submits your payment form. + /// When called, it will confirm the PaymentIntent with data you provide, + /// and it will automatically redirect the customer to authorize the + /// transaction. Once authorization is complete, the customer will be + /// redirected back to your specified return_url. + /// + /// When you confirm a PaymentIntent, it needs to have an attached PaymentMethod. + /// In addition to confirming the PaymentIntent, this method can automatically + /// create and attach a new PaymentMethod for you. If you have already attached + /// a PaymentMethod you can call this method without needing to provide any + /// additional data. These use cases are detailed in the sections that follow. + /// + /// https://docs.stripe.com/js/payment_intents/confirm_klarna_payment + /// + /// Note that stripe.confirmKlarnaPayment may take several seconds to + /// complete. During that time, you should disable your form from being + /// resubmitted and show a waiting indicator like a spinner. + /// If you receive an error result, you should be sure to show that + /// error to the customer, re-enable the form, and hide the waiting indicator. + Future confirmKlarnaPayment( + String clientSecret, { + ConfirmKlarnaPaymentData? data, + ConfirmKlarnaPaymentOptions? options, + }) { + final jsData = jsify(data?.toJson() ?? {}); + final jsOptions = jsify(options?.toJson() ?? {}); + return parseIntentResponse( + js.confirmKlarnaPayment(clientSecret, jsData, jsOptions), + ); + } +} + +@anonymous +@JS() +abstract class _JS { + external Promise confirmKlarnaPayment( + String clientSecret, [ + dynamic data, + dynamic options, + ]); +} \ No newline at end of file diff --git a/packages/stripe_js/lib/src/js/payment_intents/payment_intents.dart b/packages/stripe_js/lib/src/js/payment_intents/payment_intents.dart index 7a2a6e8ee..3907a5a54 100644 --- a/packages/stripe_js/lib/src/js/payment_intents/payment_intents.dart +++ b/packages/stripe_js/lib/src/js/payment_intents/payment_intents.dart @@ -2,6 +2,7 @@ export 'confirm_acss_debit_payment.dart'; export 'confirm_alipay_payment.dart'; export 'confirm_card_payment.dart'; export 'confirm_ideal_payment.dart'; +export 'confirm_klarna_payment.dart'; export 'confirm_payment.dart'; export 'confirm_sepa_debit_payment.dart'; export 'handle_card_action.dart'; diff --git a/packages/stripe_web/lib/src/web_stripe.dart b/packages/stripe_web/lib/src/web_stripe.dart index a33f01f55..372f1d0a5 100644 --- a/packages/stripe_web/lib/src/web_stripe.dart +++ b/packages/stripe_web/lib/src/web_stripe.dart @@ -180,6 +180,30 @@ class WebStripe extends StripePlatform { ), ); }, + klarna: (paymentData) { + return js.confirmKlarnaPayment( + paymentIntentClientSecret, + data: stripe_js.ConfirmKlarnaPaymentData( + paymentMethod: stripe_js.KlarnaPaymentMethodDetails( + billingDetails: stripe_js.BillingDetails( + name: paymentData.billingDetails?.name, + address: stripe_js.BillingAddress( + line1: paymentData.billingDetails?.address?.line1, + line2: paymentData.billingDetails?.address?.line2, + city: paymentData.billingDetails?.address?.city, + state: paymentData.billingDetails?.address?.state, + country: paymentData.billingDetails?.address?.country, + postalCode: + paymentData.billingDetails?.address?.postalCode, + ), + email: paymentData.billingDetails?.email, + phone: paymentData.billingDetails?.phone, + ), + ), + returnUrl: urlScheme, + ), + ); + }, orElse: () { throw WebUnsupportedError(); }, From 68f37a621121bf100b9fd5e5244ca0688c7eaee2 Mon Sep 17 00:00:00 2001 From: Slowline Date: Wed, 24 Jul 2024 15:22:06 +0200 Subject: [PATCH 2/2] Update payment_method_details.dart --- .../lib/src/api/payment_methods/payment_method_details.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart index e3de7be98..1a874e364 100644 --- a/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart +++ b/packages/stripe_js/lib/src/api/payment_methods/payment_method_details.dart @@ -86,10 +86,6 @@ class KlarnaPaymentMethodDetails const factory KlarnaPaymentMethodDetails.id(String id) = _IdKlarnaPaymentMethodDetails; - /// Use stripe.confirmCardPayment with payment data from an Element by - /// passing a card or cardNumber Element as payment_method[card] in the - /// data argument. - /// /// The new PaymentMethod will be created with data collected by the /// Element and will be used to confirm the PaymentIntent. @FreezedUnionValue('klarna')