diff --git a/packages/stripe/lib/src/stripe.dart b/packages/stripe/lib/src/stripe.dart index 6a51cecf1..1fef5994f 100644 --- a/packages/stripe/lib/src/stripe.dart +++ b/packages/stripe/lib/src/stripe.dart @@ -352,14 +352,20 @@ class Stripe { /// See [PresentPaymentSheetPameters] for more details /// /// throws [StripeException] in case of a failure - Future presentPaymentSheet({ - @Deprecated('Params are now inherited from initPaymentSheet so this `parameters` can be removed') - dynamic parameters, - }) async { + Future presentPaymentSheet() async { await _awaitForSettings(); return await _platform.presentPaymentSheet(); } + /// Call this method when the user logs out from your app. + /// + /// This will ensur ethat any persisted authentication state in the + /// paymentsheet, such as authentication cookies are cleared during logout. + Future resetPaymentSheetCustomer() async { + await _awaitForSettings(); + return await _platform.resetPaymentSheetCustomer(); + } + /// Confirms the paymentsheet payment /// /// throws [StripeException] in case of a failure diff --git a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart index c47b24d9a..62b383ee6 100644 --- a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart +++ b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart @@ -217,6 +217,21 @@ class MethodChannelStripe extends StripePlatform { } } + @override + Future resetPaymentSheetCustomer() async { + final result = await _methodChannel.invokeMethod( + 'resetPaymentSheetCustomer', + {'params': {}}, + ); + + // iOS returns empty list on success + if (result is List) { + return; + } else { + return _parsePaymentSheetResult(result); + } + } + @override Future confirmPaymentSheetPayment() async { final result = await _methodChannel diff --git a/packages/stripe_platform_interface/lib/src/models/ach_params.freezed.dart b/packages/stripe_platform_interface/lib/src/models/ach_params.freezed.dart index 7921c975c..307c8bcc2 100644 --- a/packages/stripe_platform_interface/lib/src/models/ach_params.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/ach_params.freezed.dart @@ -180,7 +180,9 @@ class _$_CollectBankAccountParams implements _CollectBankAccountParams { @override Map toJson() { - return _$$_CollectBankAccountParamsToJson(this); + return _$$_CollectBankAccountParamsToJson( + this, + ); } } @@ -197,12 +199,12 @@ abstract class _CollectBankAccountParams implements CollectBankAccountParams { /// Billingdetails of the account holder /// /// It is required to fill in the name in the billing details - BillingDetails get billingDetails => throw _privateConstructorUsedError; + BillingDetails get billingDetails; @override /// The paymentmethod type. At this point only method [PaymentMethodType.USBankAccount] /// is supported. - PaymentMethodType get paymentMethodType => throw _privateConstructorUsedError; + PaymentMethodType get paymentMethodType; @override @JsonKey(ignore: true) _$$_CollectBankAccountParamsCopyWith<_$_CollectBankAccountParams> @@ -375,7 +377,9 @@ class _$_VerifyMicroDepositsParams implements _VerifyMicroDepositsParams { @override Map toJson() { - return _$$_VerifyMicroDepositsParamsToJson(this); + return _$$_VerifyMicroDepositsParamsToJson( + this, + ); } } @@ -393,13 +397,13 @@ abstract class _VerifyMicroDepositsParams implements VerifyMicroDepositsParams { /// /// Make sure that the amount is exactly 2. When using this field make sure /// [descriptorCode] is `null`. - List? get amounts => throw _privateConstructorUsedError; + List? get amounts; @override /// The descriptor code that is part of the microdepot to the customer bank account. /// /// When Using this field make sure [amounts] is `null`. - String? get descriptorCode => throw _privateConstructorUsedError; + String? get descriptorCode; @override @JsonKey(ignore: true) _$$_VerifyMicroDepositsParamsCopyWith<_$_VerifyMicroDepositsParams> diff --git a/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart b/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart index 2e145d3bc..33cdcf1d2 100644 --- a/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart @@ -21,7 +21,7 @@ Map _$$_CollectBankAccountParamsToJson( { 'billingDetails': instance.billingDetails.toJson(), 'paymentMethodType': - _$PaymentMethodTypeEnumMap[instance.paymentMethodType], + _$PaymentMethodTypeEnumMap[instance.paymentMethodType]!, }; const _$PaymentMethodTypeEnumMap = { diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart index 8c50de027..d4761e596 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart @@ -152,6 +152,12 @@ class Card with _$Card { /// last four digits of the card. String? last4, + + /// The preffered card brand for payment + String? preferredNetwork, + + /// The available networks the card can run. + List? availableNetworks, }) = _Card; factory Card.fromJson(Map json) => _$CardFromJson(json); diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart index 54991871e..ea4377eba 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart @@ -546,7 +546,9 @@ class _$_PaymentMethod implements _PaymentMethod { @override Map toJson() { - return _$$_PaymentMethodToJson(this); + return _$$_PaymentMethodToJson( + this, + ); } } @@ -582,68 +584,68 @@ abstract class _PaymentMethod implements PaymentMethod { @override /// Unique identifier. - String get id => throw _privateConstructorUsedError; + String get id; @override /// Whether or not the object exists in livemode. - bool get livemode => throw _privateConstructorUsedError; + bool get livemode; @override /// The type of the paymentmethod. - String get paymentMethodType => throw _privateConstructorUsedError; + String get paymentMethodType; @override /// Billing information related to the payment method. - BillingDetails get billingDetails => throw _privateConstructorUsedError; + BillingDetails get billingDetails; @override /// Containing additional data in case paymentmethod type is card. @JsonKey(name: 'Card') - Card get card => throw _privateConstructorUsedError; + Card get card; @override /// Containing additional data in case paymentmethod type is sepa. @JsonKey(name: 'SepaDebit') - SepaDebit get sepaDebit => throw _privateConstructorUsedError; + SepaDebit get sepaDebit; @override /// Containing additional data in case paymentmethod type is Bacs debit. @JsonKey(name: 'BacsDebit') - BacsDebit get bacsDebit => throw _privateConstructorUsedError; + BacsDebit get bacsDebit; @override /// Containing additional data in case paymentmethod type is Aubecs debit. @JsonKey(name: 'AuBecsDebit') - AuBecsDebit get auBecsDebit => throw _privateConstructorUsedError; + AuBecsDebit get auBecsDebit; @override /// Containing additional data in case paymentmethod type is sofort. @JsonKey(name: 'Sofort') - Sofort get sofort => throw _privateConstructorUsedError; + Sofort get sofort; @override /// Containing additional data in case paymentmethod type is Ideal. @JsonKey(name: 'Ideal') - Ideal get ideal => throw _privateConstructorUsedError; + Ideal get ideal; @override /// Containing additional data in case paymentmethod type is FPX. @JsonKey(name: 'Fpx') - Fpx get fpx => throw _privateConstructorUsedError; + Fpx get fpx; @override /// Containing additional data in case paymentmethod type is UPI. @JsonKey(name: 'Upi') - Upi get upi => throw _privateConstructorUsedError; + Upi get upi; @override /// Containing additional data in case paymentmethod type is UPI. @JsonKey(name: 'USBankAccount') - UsBankAccount get usBankAccount => throw _privateConstructorUsedError; + UsBankAccount get usBankAccount; @override /// Id related to the customer to which this paymentmethod has been saved. - String? get customerId => throw _privateConstructorUsedError; + String? get customerId; @override @JsonKey(ignore: true) _$$_PaymentMethodCopyWith<_$_PaymentMethod> get copyWith => @@ -841,7 +843,9 @@ class _$_BillingDetails implements _BillingDetails { @override Map toJson() { - return _$$_BillingDetailsToJson(this); + return _$$_BillingDetailsToJson( + this, + ); } } @@ -858,19 +862,19 @@ abstract class _BillingDetails implements BillingDetails { @override /// Email address. - String? get email => throw _privateConstructorUsedError; + String? get email; @override /// Billing address. - Address? get address => throw _privateConstructorUsedError; + Address? get address; @override /// Billing phone number. - String? get phone => throw _privateConstructorUsedError; + String? get phone; @override /// Full name. - String? get name => throw _privateConstructorUsedError; + String? get name; @override @JsonKey(ignore: true) _$$_BillingDetailsCopyWith<_$_BillingDetails> get copyWith => @@ -1032,7 +1036,9 @@ class _$_AuBecsDebit implements _AuBecsDebit { @override Map toJson() { - return _$$_AuBecsDebitToJson(this); + return _$$_AuBecsDebitToJson( + this, + ); } } @@ -1048,15 +1054,15 @@ abstract class _AuBecsDebit implements AuBecsDebit { @override /// Unique identifier for the bankaccount. - String? get fingerprint => throw _privateConstructorUsedError; + String? get fingerprint; @override /// Last 4 digits of the bankaccount number. - String? get last4 => throw _privateConstructorUsedError; + String? get last4; @override /// Six digit number identifying the bank or branch for this account. - String? get bsbNumber => throw _privateConstructorUsedError; + String? get bsbNumber; @override @JsonKey(ignore: true) _$$_AuBecsDebitCopyWith<_$_AuBecsDebit> get copyWith => @@ -1216,7 +1222,9 @@ class _$_BacsDebit implements _BacsDebit { @override Map toJson() { - return _$$_BacsDebitToJson(this); + return _$$_BacsDebitToJson( + this, + ); } } @@ -1232,15 +1240,15 @@ abstract class _BacsDebit implements BacsDebit { @override /// Sort code of the bankaccount. - String? get sortCode => throw _privateConstructorUsedError; + String? get sortCode; @override /// Unique identifier for the bankaccount. - String? get fingerprint => throw _privateConstructorUsedError; + String? get fingerprint; @override /// Last 4 digits of the bank account. - String? get last4 => throw _privateConstructorUsedError; + String? get last4; @override @JsonKey(ignore: true) _$$_BacsDebitCopyWith<_$_BacsDebit> get copyWith => @@ -1271,6 +1279,12 @@ mixin _$Card { /// last four digits of the card. String? get last4 => throw _privateConstructorUsedError; + /// The preffered card brand for payment + String? get preferredNetwork => throw _privateConstructorUsedError; + + /// The available networks the card can run. + List? get availableNetworks => throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $CardCopyWith get copyWith => throw _privateConstructorUsedError; @@ -1286,7 +1300,9 @@ abstract class $CardCopyWith<$Res> { int? expYear, int? expMonth, String? funding, - String? last4}); + String? last4, + String? preferredNetwork, + List? availableNetworks}); } /// @nodoc @@ -1305,6 +1321,8 @@ class _$CardCopyWithImpl<$Res> implements $CardCopyWith<$Res> { Object? expMonth = freezed, Object? funding = freezed, Object? last4 = freezed, + Object? preferredNetwork = freezed, + Object? availableNetworks = freezed, }) { return _then(_value.copyWith( brand: brand == freezed @@ -1331,6 +1349,14 @@ class _$CardCopyWithImpl<$Res> implements $CardCopyWith<$Res> { ? _value.last4 : last4 // ignore: cast_nullable_to_non_nullable as String?, + preferredNetwork: preferredNetwork == freezed + ? _value.preferredNetwork + : preferredNetwork // ignore: cast_nullable_to_non_nullable + as String?, + availableNetworks: availableNetworks == freezed + ? _value.availableNetworks + : availableNetworks // ignore: cast_nullable_to_non_nullable + as List?, )); } } @@ -1346,7 +1372,9 @@ abstract class _$$_CardCopyWith<$Res> implements $CardCopyWith<$Res> { int? expYear, int? expMonth, String? funding, - String? last4}); + String? last4, + String? preferredNetwork, + List? availableNetworks}); } /// @nodoc @@ -1366,6 +1394,8 @@ class __$$_CardCopyWithImpl<$Res> extends _$CardCopyWithImpl<$Res> Object? expMonth = freezed, Object? funding = freezed, Object? last4 = freezed, + Object? preferredNetwork = freezed, + Object? availableNetworks = freezed, }) { return _then(_$_Card( brand: brand == freezed @@ -1392,6 +1422,14 @@ class __$$_CardCopyWithImpl<$Res> extends _$CardCopyWithImpl<$Res> ? _value.last4 : last4 // ignore: cast_nullable_to_non_nullable as String?, + preferredNetwork: preferredNetwork == freezed + ? _value.preferredNetwork + : preferredNetwork // ignore: cast_nullable_to_non_nullable + as String?, + availableNetworks: availableNetworks == freezed + ? _value._availableNetworks + : availableNetworks // ignore: cast_nullable_to_non_nullable + as List?, )); } } @@ -1406,7 +1444,10 @@ class _$_Card implements _Card { this.expYear, this.expMonth, this.funding, - this.last4}); + this.last4, + this.preferredNetwork, + final List? availableNetworks}) + : _availableNetworks = availableNetworks; factory _$_Card.fromJson(Map json) => _$$_CardFromJson(json); @@ -1434,9 +1475,25 @@ class _$_Card implements _Card { @override final String? last4; + /// The preffered card brand for payment + @override + final String? preferredNetwork; + + /// The available networks the card can run. + final List? _availableNetworks; + + /// The available networks the card can run. + @override + List? get availableNetworks { + final value = _availableNetworks; + if (value == null) return null; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + @override String toString() { - return 'Card(brand: $brand, country: $country, expYear: $expYear, expMonth: $expMonth, funding: $funding, last4: $last4)'; + return 'Card(brand: $brand, country: $country, expYear: $expYear, expMonth: $expMonth, funding: $funding, last4: $last4, preferredNetwork: $preferredNetwork, availableNetworks: $availableNetworks)'; } @override @@ -1449,7 +1506,11 @@ class _$_Card implements _Card { const DeepCollectionEquality().equals(other.expYear, expYear) && const DeepCollectionEquality().equals(other.expMonth, expMonth) && const DeepCollectionEquality().equals(other.funding, funding) && - const DeepCollectionEquality().equals(other.last4, last4)); + const DeepCollectionEquality().equals(other.last4, last4) && + const DeepCollectionEquality() + .equals(other.preferredNetwork, preferredNetwork) && + const DeepCollectionEquality() + .equals(other._availableNetworks, _availableNetworks)); } @JsonKey(ignore: true) @@ -1461,7 +1522,9 @@ class _$_Card implements _Card { const DeepCollectionEquality().hash(expYear), const DeepCollectionEquality().hash(expMonth), const DeepCollectionEquality().hash(funding), - const DeepCollectionEquality().hash(last4)); + const DeepCollectionEquality().hash(last4), + const DeepCollectionEquality().hash(preferredNetwork), + const DeepCollectionEquality().hash(_availableNetworks)); @JsonKey(ignore: true) @override @@ -1470,7 +1533,9 @@ class _$_Card implements _Card { @override Map toJson() { - return _$$_CardToJson(this); + return _$$_CardToJson( + this, + ); } } @@ -1481,34 +1546,44 @@ abstract class _Card implements Card { final int? expYear, final int? expMonth, final String? funding, - final String? last4}) = _$_Card; + final String? last4, + final String? preferredNetwork, + final List? availableNetworks}) = _$_Card; factory _Card.fromJson(Map json) = _$_Card.fromJson; @override /// The brand associated to the card e.g. (visa, amex). - String? get brand => throw _privateConstructorUsedError; + String? get brand; @override /// Two letter iso code. - String? get country => throw _privateConstructorUsedError; + String? get country; @override /// four digit number representing the year of expiry of the card. - int? get expYear => throw _privateConstructorUsedError; + int? get expYear; @override /// two digit number representing the month of expire of the card. - int? get expMonth => throw _privateConstructorUsedError; + int? get expMonth; @override /// card funding type e.g. (credit, debit). - String? get funding => throw _privateConstructorUsedError; + String? get funding; @override /// last four digits of the card. - String? get last4 => throw _privateConstructorUsedError; + String? get last4; + @override + + /// The preffered card brand for payment + String? get preferredNetwork; + @override + + /// The available networks the card can run. + List? get availableNetworks; @override @JsonKey(ignore: true) _$$_CardCopyWith<_$_Card> get copyWith => throw _privateConstructorUsedError; @@ -1644,7 +1719,9 @@ class _$_Fpx implements _Fpx { @override Map toJson() { - return _$$_FpxToJson(this); + return _$$_FpxToJson( + this, + ); } } @@ -1657,11 +1734,11 @@ abstract class _Fpx implements Fpx { @override /// the customer bank - String? get bank => throw _privateConstructorUsedError; + String? get bank; @override /// accountholder type - String? get accountHolderType => throw _privateConstructorUsedError; + String? get accountHolderType; @override @JsonKey(ignore: true) _$$_FpxCopyWith<_$_Fpx> get copyWith => throw _privateConstructorUsedError; @@ -1798,7 +1875,9 @@ class _$_Ideal implements _Ideal { @override Map toJson() { - return _$$_IdealToJson(this); + return _$$_IdealToJson( + this, + ); } } @@ -1811,11 +1890,11 @@ abstract class _Ideal implements Ideal { @override /// The BIC code of the bank - String? get bankIdentifierCode => throw _privateConstructorUsedError; + String? get bankIdentifierCode; @override /// The bank of the customer - String? get bank => throw _privateConstructorUsedError; + String? get bank; @override @JsonKey(ignore: true) _$$_IdealCopyWith<_$_Ideal> get copyWith => @@ -1997,7 +2076,9 @@ class _$_SepaDebit implements _SepaDebit { @override Map toJson() { - return _$$_SepaDebitToJson(this); + return _$$_SepaDebitToJson( + this, + ); } } @@ -2014,19 +2095,19 @@ abstract class _SepaDebit implements SepaDebit { @override /// Two letter ISO code representing the country of the bank account. - String? get country => throw _privateConstructorUsedError; + String? get country; @override /// Bank code associated with the bankaccount. - String? get bankCode => throw _privateConstructorUsedError; + String? get bankCode; @override /// Unique ID for the bank account. - String? get fingerprint => throw _privateConstructorUsedError; + String? get fingerprint; @override /// Last four characters of IBAN. - String? get last4 => throw _privateConstructorUsedError; + String? get last4; @override @JsonKey(ignore: true) _$$_SepaDebitCopyWith<_$_SepaDebit> get copyWith => @@ -2143,7 +2224,9 @@ class _$_Sofort implements _Sofort { @override Map toJson() { - return _$$_SofortToJson(this); + return _$$_SofortToJson( + this, + ); } } @@ -2155,7 +2238,7 @@ abstract class _Sofort implements Sofort { @override /// Two letter ISO code representing the country of the bank account. - String? get country => throw _privateConstructorUsedError; + String? get country; @override @JsonKey(ignore: true) _$$_SofortCopyWith<_$_Sofort> get copyWith => @@ -2271,7 +2354,9 @@ class _$_Upi implements _Upi { @override Map toJson() { - return _$$_UpiToJson(this); + return _$$_UpiToJson( + this, + ); } } @@ -2283,7 +2368,7 @@ abstract class _Upi implements Upi { @override /// The customer's vpa. - String? get vpa => throw _privateConstructorUsedError; + String? get vpa; @override @JsonKey(ignore: true) _$$_UpiCopyWith<_$_Upi> get copyWith => throw _privateConstructorUsedError; @@ -2612,7 +2697,9 @@ class _$_UsBankAccount implements _UsBankAccount { @override Map toJson() { - return _$$_UsBankAccountToJson(this); + return _$$_UsBankAccountToJson( + this, + ); } } @@ -2634,40 +2721,39 @@ abstract class _UsBankAccount implements UsBankAccount { @override /// Routing number of the bank account - String? get routingNumber => throw _privateConstructorUsedError; + String? get routingNumber; @override /// Last 4 digits of the account - String? get last4 => throw _privateConstructorUsedError; + String? get last4; @override /// The bank account type of the holder - BankAccountHolderType get accountHolderType => - throw _privateConstructorUsedError; + BankAccountHolderType get accountHolderType; @override /// The account type - UsBankAccountType get accountType => throw _privateConstructorUsedError; + UsBankAccountType get accountType; @override /// The name of the bank of the account - String? get bankName => throw _privateConstructorUsedError; + String? get bankName; @override /// Unique identifier for the bankaccount. - String? get fingerprint => throw _privateConstructorUsedError; + String? get fingerprint; @override /// Number of linkedaccount - String? get linkedAccount => throw _privateConstructorUsedError; + String? get linkedAccount; @override /// list of preferred network names - List? get preferredNetworks => throw _privateConstructorUsedError; + List? get preferredNetworks; @override /// list of preferred network names - List? get supportedNetworks => throw _privateConstructorUsedError; + List? get supportedNetworks; @override @JsonKey(ignore: true) _$$_UsBankAccountCopyWith<_$_UsBankAccount> get copyWith => @@ -3249,7 +3335,9 @@ class _$_PaymentMethodParamsCard implements _PaymentMethodParamsCard { @override Map toJson() { - return _$$_PaymentMethodParamsCardToJson(this); + return _$$_PaymentMethodParamsCardToJson( + this, + ); } } @@ -3262,10 +3350,10 @@ abstract class _PaymentMethodParamsCard implements PaymentMethodParams { _$_PaymentMethodParamsCard.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; /// Paymentmethod options - PaymentMethodOptions? get options => throw _privateConstructorUsedError; + PaymentMethodOptions? get options; @JsonKey(ignore: true) _$$_PaymentMethodParamsCardCopyWith<_$_PaymentMethodParamsCard> get copyWith => throw _privateConstructorUsedError; @@ -3596,7 +3684,9 @@ class _$_PaymentMethodParamsCardWithToken @override Map toJson() { - return _$$_PaymentMethodParamsCardWithTokenToJson(this); + return _$$_PaymentMethodParamsCardWithTokenToJson( + this, + ); } } @@ -3611,11 +3701,10 @@ abstract class _PaymentMethodParamsCardWithToken Map json) = _$_PaymentMethodParamsCardWithToken.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataCardFromToken get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataCardFromToken get paymentMethodData; /// Paymentmethod options - PaymentMethodOptions? get options => throw _privateConstructorUsedError; + PaymentMethodOptions? get options; @JsonKey(ignore: true) _$$_PaymentMethodParamsCardWithTokenCopyWith< _$_PaymentMethodParamsCardWithToken> @@ -3948,7 +4037,9 @@ class _$_PaymentMethodParamsCardWithMethodId @override Map toJson() { - return _$$_PaymentMethodParamsCardWithMethodIdToJson(this); + return _$$_PaymentMethodParamsCardWithMethodIdToJson( + this, + ); } } @@ -3964,11 +4055,10 @@ abstract class _PaymentMethodParamsCardWithMethodId _$_PaymentMethodParamsCardWithMethodId.fromJson; /// Payment method data object for card from payment method. - PaymentMethodDataCardFromMethod get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataCardFromMethod get paymentMethodData; /// Paymentmethod options - PaymentMethodOptions? get options => throw _privateConstructorUsedError; + PaymentMethodOptions? get options; @JsonKey(ignore: true) _$$_PaymentMethodParamsCardWithMethodIdCopyWith< _$_PaymentMethodParamsCardWithMethodId> @@ -4270,7 +4360,9 @@ class _$_PaymentMethodParamsAlipay implements _PaymentMethodParamsAlipay { @override Map toJson() { - return _$$_PaymentMethodParamsAlipayToJson(this); + return _$$_PaymentMethodParamsAlipayToJson( + this, + ); } } @@ -4283,7 +4375,7 @@ abstract class _PaymentMethodParamsAlipay implements PaymentMethodParams { _$_PaymentMethodParamsAlipay.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsAlipayCopyWith<_$_PaymentMethodParamsAlipay> get copyWith => throw _privateConstructorUsedError; @@ -4584,7 +4676,9 @@ class _$_PaymentMethodParamsIdeal implements _PaymentMethodParamsIdeal { @override Map toJson() { - return _$$_PaymentMethodParamsIdealToJson(this); + return _$$_PaymentMethodParamsIdealToJson( + this, + ); } } @@ -4597,8 +4691,7 @@ abstract class _PaymentMethodParamsIdeal implements PaymentMethodParams { _$_PaymentMethodParamsIdeal.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataIdeal get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataIdeal get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsIdealCopyWith<_$_PaymentMethodParamsIdeal> get copyWith => throw _privateConstructorUsedError; @@ -4900,7 +4993,9 @@ class _$_PaymentMethodParamsAubecs implements _PaymentMethodParamsAubecs { @override Map toJson() { - return _$$_PaymentMethodParamsAubecsToJson(this); + return _$$_PaymentMethodParamsAubecsToJson( + this, + ); } } @@ -4913,8 +5008,7 @@ abstract class _PaymentMethodParamsAubecs implements PaymentMethodParams { _$_PaymentMethodParamsAubecs.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataAubecs get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataAubecs get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsAubecsCopyWith<_$_PaymentMethodParamsAubecs> get copyWith => throw _privateConstructorUsedError; @@ -5217,7 +5311,9 @@ class _$_PaymentMethodParamsBankContact @override Map toJson() { - return _$$_PaymentMethodParamsBankContactToJson(this); + return _$$_PaymentMethodParamsBankContactToJson( + this, + ); } } @@ -5230,7 +5326,7 @@ abstract class _PaymentMethodParamsBankContact implements PaymentMethodParams { _$_PaymentMethodParamsBankContact.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsBankContactCopyWith<_$_PaymentMethodParamsBankContact> get copyWith => throw _privateConstructorUsedError; @@ -5531,7 +5627,9 @@ class _$_PaymentMethodParamsGiroPay implements _PaymentMethodParamsGiroPay { @override Map toJson() { - return _$$_PaymentMethodParamsGiroPayToJson(this); + return _$$_PaymentMethodParamsGiroPayToJson( + this, + ); } } @@ -5544,7 +5642,7 @@ abstract class _PaymentMethodParamsGiroPay implements PaymentMethodParams { _$_PaymentMethodParamsGiroPay.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsGiroPayCopyWith<_$_PaymentMethodParamsGiroPay> get copyWith => throw _privateConstructorUsedError; @@ -5843,7 +5941,9 @@ class _$_PaymentMethodParamsEps implements _PaymentMethodParamsEps { @override Map toJson() { - return _$$_PaymentMethodParamsEpsToJson(this); + return _$$_PaymentMethodParamsEpsToJson( + this, + ); } } @@ -5856,7 +5956,7 @@ abstract class _PaymentMethodParamsEps implements PaymentMethodParams { _$_PaymentMethodParamsEps.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsEpsCopyWith<_$_PaymentMethodParamsEps> get copyWith => throw _privateConstructorUsedError; @@ -6157,7 +6257,9 @@ class _$_PaymentMethodParamsAffirm implements _PaymentMethodParamsAffirm { @override Map toJson() { - return _$$_PaymentMethodParamsAffirmToJson(this); + return _$$_PaymentMethodParamsAffirmToJson( + this, + ); } } @@ -6170,7 +6272,7 @@ abstract class _PaymentMethodParamsAffirm implements PaymentMethodParams { _$_PaymentMethodParamsAffirm.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsAffirmCopyWith<_$_PaymentMethodParamsAffirm> get copyWith => throw _privateConstructorUsedError; @@ -6469,7 +6571,9 @@ class _$_PaymentMethodParamsPay implements _PaymentMethodParamsPay { @override Map toJson() { - return _$$_PaymentMethodParamsPayToJson(this); + return _$$_PaymentMethodParamsPayToJson( + this, + ); } } @@ -6482,7 +6586,7 @@ abstract class _PaymentMethodParamsPay implements PaymentMethodParams { _$_PaymentMethodParamsPay.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsPayCopyWith<_$_PaymentMethodParamsPay> get copyWith => throw _privateConstructorUsedError; @@ -6781,7 +6885,9 @@ class _$_PaymentMethodParamsP24 implements _PaymentMethodParamsP24 { @override Map toJson() { - return _$$_PaymentMethodParamsP24ToJson(this); + return _$$_PaymentMethodParamsP24ToJson( + this, + ); } } @@ -6794,7 +6900,7 @@ abstract class _PaymentMethodParamsP24 implements PaymentMethodParams { _$_PaymentMethodParamsP24.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsP24CopyWith<_$_PaymentMethodParamsP24> get copyWith => throw _privateConstructorUsedError; @@ -7094,7 +7200,9 @@ class _$_PaymentMethodParamsFpx implements _PaymentMethodParamsFpx { @override Map toJson() { - return _$$_PaymentMethodParamsFpxToJson(this); + return _$$_PaymentMethodParamsFpxToJson( + this, + ); } } @@ -7107,8 +7215,7 @@ abstract class _PaymentMethodParamsFpx implements PaymentMethodParams { _$_PaymentMethodParamsFpx.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataFpx get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataFpx get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsFpxCopyWith<_$_PaymentMethodParamsFpx> get copyWith => throw _privateConstructorUsedError; @@ -7410,7 +7517,9 @@ class _$_PaymentMethodParamsSepaDebit implements _PaymentMethodParamsSepaDebit { @override Map toJson() { - return _$$_PaymentMethodParamsSepaDebitToJson(this); + return _$$_PaymentMethodParamsSepaDebitToJson( + this, + ); } } @@ -7423,8 +7532,7 @@ abstract class _PaymentMethodParamsSepaDebit implements PaymentMethodParams { _$_PaymentMethodParamsSepaDebit.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataSepa get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataSepa get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsSepaDebitCopyWith<_$_PaymentMethodParamsSepaDebit> get copyWith => throw _privateConstructorUsedError; @@ -7725,7 +7833,9 @@ class _$_PaymentMethodParamsSofort implements _PaymentMethodParamsSofort { @override Map toJson() { - return _$$_PaymentMethodParamsSofortToJson(this); + return _$$_PaymentMethodParamsSofortToJson( + this, + ); } } @@ -7737,8 +7847,7 @@ abstract class _PaymentMethodParamsSofort implements PaymentMethodParams { factory _PaymentMethodParamsSofort.fromJson(Map json) = _$_PaymentMethodParamsSofort.fromJson; - PaymentMethodDataSofort get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataSofort get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsSofortCopyWith<_$_PaymentMethodParamsSofort> get copyWith => throw _privateConstructorUsedError; @@ -8043,7 +8152,9 @@ class _$_PaymentMethodParamsAfterpayClearpay @override Map toJson() { - return _$$_PaymentMethodParamsAfterpayClearpayToJson(this); + return _$$_PaymentMethodParamsAfterpayClearpayToJson( + this, + ); } } @@ -8057,8 +8168,7 @@ abstract class _PaymentMethodParamsAfterpayClearpay Map json) = _$_PaymentMethodParamsAfterpayClearpay.fromJson; - PaymentMethodDataAfterPay get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataAfterPay get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsAfterpayClearpayCopyWith< _$_PaymentMethodParamsAfterpayClearpay> @@ -8359,7 +8469,9 @@ class _$_PaymentMethodParamsOxxo implements _PaymentMethodParamsOxxo { @override Map toJson() { - return _$$_PaymentMethodParamsOxxoToJson(this); + return _$$_PaymentMethodParamsOxxoToJson( + this, + ); } } @@ -8372,7 +8484,7 @@ abstract class _PaymentMethodParamsOxxo implements PaymentMethodParams { _$_PaymentMethodParamsOxxo.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsOxxoCopyWith<_$_PaymentMethodParamsOxxo> get copyWith => throw _privateConstructorUsedError; @@ -8676,7 +8788,9 @@ class _$_PaymentMethodParamsKlarna implements _PaymentMethodParamsKlarna { @override Map toJson() { - return _$$_PaymentMethodParamsKlarnaToJson(this); + return _$$_PaymentMethodParamsKlarnaToJson( + this, + ); } } @@ -8692,7 +8806,7 @@ abstract class _PaymentMethodParamsKlarna implements PaymentMethodParams { /// /// Make sure to add an email and country (part of the address) in the /// billingdetails which is required for using Klarna. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsKlarnaCopyWith<_$_PaymentMethodParamsKlarna> get copyWith => throw _privateConstructorUsedError; @@ -8996,7 +9110,9 @@ class _$_PaymentMethodParamsPayPal implements _PaymentMethodParamsPayPal { @override Map toJson() { - return _$$_PaymentMethodParamsPayPalToJson(this); + return _$$_PaymentMethodParamsPayPalToJson( + this, + ); } } @@ -9012,7 +9128,7 @@ abstract class _PaymentMethodParamsPayPal implements PaymentMethodParams { /// /// Make sure to add an email and country (part of the address) in the /// billingdetails which is required for using Klarna. - PaymentMethodData get paymentMethodData => throw _privateConstructorUsedError; + PaymentMethodData get paymentMethodData; @JsonKey(ignore: true) _$$_PaymentMethodParamsPayPalCopyWith<_$_PaymentMethodParamsPayPal> get copyWith => throw _privateConstructorUsedError; @@ -9343,7 +9459,9 @@ class _$_PaymentMethodParamsUsBankAccount @override Map toJson() { - return _$$_PaymentMethodParamsUsBankAccountToJson(this); + return _$$_PaymentMethodParamsUsBankAccountToJson( + this, + ); } } @@ -9358,11 +9476,10 @@ abstract class _PaymentMethodParamsUsBankAccount Map json) = _$_PaymentMethodParamsUsBankAccount.fromJson; /// Paymentmethod data for this paymentmethod. - PaymentMethodDataUsBank get paymentMethodData => - throw _privateConstructorUsedError; + PaymentMethodDataUsBank get paymentMethodData; /// Payment options. - PaymentMethodOptions? get options => throw _privateConstructorUsedError; + PaymentMethodOptions? get options; @JsonKey(ignore: true) _$$_PaymentMethodParamsUsBankAccountCopyWith< _$_PaymentMethodParamsUsBankAccount> @@ -9539,7 +9656,9 @@ class _$_PaymentMethodData implements _PaymentMethodData { @override Map toJson() { - return _$$_PaymentMethodDataToJson(this); + return _$$_PaymentMethodDataToJson( + this, + ); } } @@ -9554,11 +9673,11 @@ abstract class _PaymentMethodData implements PaymentMethodData { @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataCopyWith<_$_PaymentMethodData> get copyWith => @@ -9768,7 +9887,9 @@ class _$_PaymentMethodDataCardFromToken @override Map toJson() { - return _$$_PaymentMethodDataCardFromTokenToJson(this); + return _$$_PaymentMethodDataCardFromTokenToJson( + this, + ); } } @@ -9786,15 +9907,15 @@ abstract class _PaymentMethodDataCardFromToken @override /// Token. - String get token => throw _privateConstructorUsedError; + String get token; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataCardFromTokenCopyWith<_$_PaymentMethodDataCardFromToken> @@ -10030,7 +10151,9 @@ class _$_PaymentMethodDataCardFromMethod @override Map toJson() { - return _$$_PaymentMethodDataCardFromMethodToJson(this); + return _$$_PaymentMethodDataCardFromMethodToJson( + this, + ); } } @@ -10049,19 +10172,19 @@ abstract class _PaymentMethodDataCardFromMethod @override /// Payment method id. - String get paymentMethodId => throw _privateConstructorUsedError; + String get paymentMethodId; @override /// Cvc of the cart - String? get cvc => throw _privateConstructorUsedError; + String? get cvc; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataCardFromMethodCopyWith< @@ -10267,7 +10390,9 @@ class _$_PaymentMethodDataIdeal implements _PaymentMethodDataIdeal { @override Map toJson() { - return _$$_PaymentMethodDataIdealToJson(this); + return _$$_PaymentMethodDataIdealToJson( + this, + ); } } @@ -10283,15 +10408,15 @@ abstract class _PaymentMethodDataIdeal implements PaymentMethodDataIdeal { @override /// The name of bank. - String? get bankName => throw _privateConstructorUsedError; + String? get bankName; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataIdealCopyWith<_$_PaymentMethodDataIdeal> get copyWith => @@ -10508,7 +10633,9 @@ class _$_PaymentMethodDataAubecs implements _PaymentMethodDataAubecs { @override Map toJson() { - return _$$_PaymentMethodDataAubecsToJson(this); + return _$$_PaymentMethodDataAubecsToJson( + this, + ); } } @@ -10524,15 +10651,15 @@ abstract class _PaymentMethodDataAubecs implements PaymentMethodDataAubecs { @override /// form input details - AubecsFormInputDetails get formDetails => throw _privateConstructorUsedError; + AubecsFormInputDetails get formDetails; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataAubecsCopyWith<_$_PaymentMethodDataAubecs> @@ -10739,7 +10866,9 @@ class _$_PaymentMethodDataFpx implements _PaymentMethodDataFpx { @override Map toJson() { - return _$$_PaymentMethodDataFpxToJson(this); + return _$$_PaymentMethodDataFpxToJson( + this, + ); } } @@ -10755,15 +10884,15 @@ abstract class _PaymentMethodDataFpx implements PaymentMethodDataFpx { @override /// When set to true you can test offline payment. - bool get testOfflineBank => throw _privateConstructorUsedError; + bool get testOfflineBank; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataFpxCopyWith<_$_PaymentMethodDataFpx> get copyWith => @@ -10969,7 +11098,9 @@ class _$_PaymentMethodDataSofort implements _PaymentMethodDataSofort { @override Map toJson() { - return _$$_PaymentMethodDataSofortToJson(this); + return _$$_PaymentMethodDataSofortToJson( + this, + ); } } @@ -10985,15 +11116,15 @@ abstract class _PaymentMethodDataSofort implements PaymentMethodDataSofort { @override /// Country of the accountholder - String get country => throw _privateConstructorUsedError; + String get country; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataSofortCopyWith<_$_PaymentMethodDataSofort> @@ -11198,7 +11329,9 @@ class _$_PaymentMethodDataSepa implements _PaymentMethodDataSepa { @override Map toJson() { - return _$$_PaymentMethodDataSepaToJson(this); + return _$$_PaymentMethodDataSepaToJson( + this, + ); } } @@ -11214,15 +11347,15 @@ abstract class _PaymentMethodDataSepa implements PaymentMethodDataSepa { @override /// Iban number of the accountholder - String get iban => throw _privateConstructorUsedError; + String get iban; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataSepaCopyWith<_$_PaymentMethodDataSepa> get copyWith => @@ -11400,7 +11533,9 @@ class _$_PaymentMethodDataAfterPay implements _PaymentMethodDataAfterPay { @override Map toJson() { - return _$$_PaymentMethodDataAfterPayToJson(this); + return _$$_PaymentMethodDataAfterPayToJson( + this, + ); } } @@ -11415,11 +11550,11 @@ abstract class _PaymentMethodDataAfterPay implements PaymentMethodDataAfterPay { @override /// Billing information. - BillingDetails get billingDetails => throw _privateConstructorUsedError; + BillingDetails get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataAfterPayCopyWith<_$_PaymentMethodDataAfterPay> @@ -11700,7 +11835,9 @@ class _$_PaymentMethodDataUsBank implements _PaymentMethodDataUsBank { @override Map toJson() { - return _$$_PaymentMethodDataUsBankToJson(this); + return _$$_PaymentMethodDataUsBankToJson( + this, + ); } } @@ -11719,29 +11856,28 @@ abstract class _PaymentMethodDataUsBank implements PaymentMethodDataUsBank { @override /// The account number of the bank account. - String? get accountNumber => throw _privateConstructorUsedError; + String? get accountNumber; @override ///The routing number, sort code, or other country-appropriate institution ///number for the bank account. - String? get routingNumber => throw _privateConstructorUsedError; + String? get routingNumber; @override /// The bank account type of the holder - BankAccountHolderType? get accountHolderType => - throw _privateConstructorUsedError; + BankAccountHolderType? get accountHolderType; @override /// The account type - UsBankAccountType? get accountType => throw _privateConstructorUsedError; + UsBankAccountType? get accountType; @override /// Billing information. - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Shipping details - ShippingDetails? get shippingDetails => throw _privateConstructorUsedError; + ShippingDetails? get shippingDetails; @override @JsonKey(ignore: true) _$$_PaymentMethodDataUsBankCopyWith<_$_PaymentMethodDataUsBank> @@ -11868,7 +12004,9 @@ class _$_PaymentMethodOptions implements _PaymentMethodOptions { @override Map toJson() { - return _$$_PaymentMethodOptionsToJson(this); + return _$$_PaymentMethodOptionsToJson( + this, + ); } } @@ -11883,8 +12021,7 @@ abstract class _PaymentMethodOptions implements PaymentMethodOptions { @override /// Indicates whether or not you want to reuse this method for future payments. - PaymentIntentsFutureUsage? get setupFutureUsage => - throw _privateConstructorUsedError; + PaymentIntentsFutureUsage? get setupFutureUsage; @override @JsonKey(ignore: true) _$$_PaymentMethodOptionsCopyWith<_$_PaymentMethodOptions> get copyWith => diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart index a7795bbfb..3d22c2810 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart @@ -97,6 +97,10 @@ _$_Card _$$_CardFromJson(Map json) => _$_Card( expMonth: json['expMonth'] as int?, funding: json['funding'] as String?, last4: json['last4'] as String?, + preferredNetwork: json['preferredNetwork'] as String?, + availableNetworks: (json['availableNetworks'] as List?) + ?.map((e) => e as String) + .toList(), ); Map _$$_CardToJson(_$_Card instance) => { @@ -106,6 +110,8 @@ Map _$$_CardToJson(_$_Card instance) => { 'expMonth': instance.expMonth, 'funding': instance.funding, 'last4': instance.last4, + 'preferredNetwork': instance.preferredNetwork, + 'availableNetworks': instance.availableNetworks, }; _$_Fpx _$$_FpxFromJson(Map json) => _$_Fpx( @@ -182,8 +188,8 @@ Map _$$_UsBankAccountToJson(_$_UsBankAccount instance) => 'routingNumber': instance.routingNumber, 'last4': instance.last4, 'accountHolderType': - _$BankAccountHolderTypeEnumMap[instance.accountHolderType], - 'accountType': _$UsBankAccountTypeEnumMap[instance.accountType], + _$BankAccountHolderTypeEnumMap[instance.accountHolderType]!, + 'accountType': _$UsBankAccountTypeEnumMap[instance.accountType]!, 'bankName': instance.bankName, 'fingerprint': instance.fingerprint, 'linkedAccount': instance.linkedAccount, diff --git a/packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart b/packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart index f2b150241..66bdcfe33 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart @@ -519,7 +519,9 @@ class _$_SetupParameters implements _SetupParameters { @override Map toJson() { - return _$$_SetupParametersToJson(this); + return _$$_SetupParametersToJson( + this, + ); } } @@ -551,61 +553,61 @@ abstract class _SetupParameters implements SetupPaymentSheetParameters { /// If this value is true, the payment sheet will allow to select a payment method /// and a later confirmation will be needed by calling [confirmPaymentSheetPayment] /// By default, false. - bool get customFlow => throw _privateConstructorUsedError; + bool get customFlow; @override /// The identifier of the Stripe Customer object. /// See https://stripe.com/docs/api/customers/object#customer_object-id - String? get customerId => throw _privateConstructorUsedError; + String? get customerId; @override ///A temp key can be used for API operations that require a secret key. - String? get customerEphemeralKeySecret => throw _privateConstructorUsedError; + String? get customerEphemeralKeySecret; @override /// Secret used for client-side retrieval using a publishable key. /// /// If this value is null make sure to add a [setupIntentClientSecret] - String? get paymentIntentClientSecret => throw _privateConstructorUsedError; + String? get paymentIntentClientSecret; @override /// The client secret of this SetupIntent /// /// If this value is null make sure to add a [paymentIntentClientSecret] - String? get setupIntentClientSecret => throw _privateConstructorUsedError; + String? get setupIntentClientSecret; @override /// Display name of the merchant - String? get merchantDisplayName => throw _privateConstructorUsedError; + String? get merchantDisplayName; @override /// Configuration related to Apple Pay /// If set, PaymentSheet displays Apple Pay as a payment option - PaymentSheetApplePay? get applePay => throw _privateConstructorUsedError; + PaymentSheetApplePay? get applePay; @override /// Style options for colors in PaymentSheet /// /// Parts can be overridden by [appearance]. @JsonKey(toJson: UserInterfaceStyleKey.toJson) - ThemeMode? get style => throw _privateConstructorUsedError; + ThemeMode? get style; @override /// Configuration related to Google Pay /// If set, PaymentSheet displays Google Pay as a payment option - PaymentSheetGooglePay? get googlePay => throw _privateConstructorUsedError; + PaymentSheetGooglePay? get googlePay; @override /// Flag that allows payment methods that do not move money at the send of the checkout. /// /// Defaul value is false. - bool get allowsDelayedPaymentMethods => throw _privateConstructorUsedError; + bool get allowsDelayedPaymentMethods; @override /// Appearance of the paymentsheet. /// /// When no appearance defined it will fallback to [style] or Stripe default. - PaymentSheetAppearance? get appearance => throw _privateConstructorUsedError; + PaymentSheetAppearance? get appearance; @override /// Default billing information of the customer. @@ -615,11 +617,11 @@ abstract class _SetupParameters implements SetupPaymentSheetParameters { /// alternative localization options. This does not set the billingDetails on the /// paymentIntent since the customer can change those. @JsonKey(name: 'defaultBillingDetails') - BillingDetails? get billingDetails => throw _privateConstructorUsedError; + BillingDetails? get billingDetails; @override /// Return URL is required for IDEAL and few other payment methods - String? get returnURL => throw _privateConstructorUsedError; + String? get returnURL; @override @JsonKey(ignore: true) _$$_SetupParametersCopyWith<_$_SetupParameters> get copyWith => @@ -785,7 +787,9 @@ class _$_PaymentSheetApplePay implements _PaymentSheetApplePay { @override Map toJson() { - return _$$_PaymentSheetApplePayToJson(this); + return _$$_PaymentSheetApplePayToJson( + this, + ); } } @@ -801,13 +805,12 @@ abstract class _PaymentSheetApplePay implements PaymentSheetApplePay { @override ///The two-letter ISO 3166 code of the country of your business, e.g. "US" - String get merchantCountryCode => throw _privateConstructorUsedError; + String get merchantCountryCode; @override ///An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent /// for a recurring payment, you should set this to display the amount you intend to charge. - List? get paymentSummaryItems => - throw _privateConstructorUsedError; + List? get paymentSummaryItems; @override @JsonKey(ignore: true) _$$_PaymentSheetApplePayCopyWith<_$_PaymentSheetApplePay> get copyWith => @@ -979,7 +982,9 @@ class _$_PaymentSheetGooglePay implements _PaymentSheetGooglePay { @override Map toJson() { - return _$$_PaymentSheetGooglePayToJson(this); + return _$$_PaymentSheetGooglePayToJson( + this, + ); } } @@ -995,15 +1000,15 @@ abstract class _PaymentSheetGooglePay implements PaymentSheetGooglePay { @override ///The two-letter ISO 3166 code of the country of your business, e.g. "US" - String get merchantCountryCode => throw _privateConstructorUsedError; + String get merchantCountryCode; @override /// The three-letter ISO 4217 alphabetic currency code, e.g. "USD" or "EUR". Required in order to support Google Pay when processing a Setup Intent. - String? get currencyCode => throw _privateConstructorUsedError; + String? get currencyCode; @override /// Whether or not to use the google pay test environment. Set to `true` until you have applied for and been granted access to the Production environment. - bool get testEnv => throw _privateConstructorUsedError; + bool get testEnv; @override @JsonKey(ignore: true) _$$_PaymentSheetGooglePayCopyWith<_$_PaymentSheetGooglePay> get copyWith => @@ -1224,7 +1229,9 @@ class _$_PaymentSheetAppearance implements _PaymentSheetAppearance { @override Map toJson() { - return _$$_PaymentSheetAppearanceToJson(this); + return _$$_PaymentSheetAppearanceToJson( + this, + ); } } @@ -1241,17 +1248,15 @@ abstract class _PaymentSheetAppearance implements PaymentSheetAppearance { @override /// Color parameters - PaymentSheetAppearanceColors? get colors => - throw _privateConstructorUsedError; + PaymentSheetAppearanceColors? get colors; @override /// Shapes parameters - PaymentSheetShape? get shapes => throw _privateConstructorUsedError; + PaymentSheetShape? get shapes; @override /// PaymentSheet appearance - PaymentSheetPrimaryButtonAppearance? get primaryButton => - throw _privateConstructorUsedError; + PaymentSheetPrimaryButtonAppearance? get primaryButton; @override @JsonKey(ignore: true) _$$_PaymentSheetAppearanceCopyWith<_$_PaymentSheetAppearance> get copyWith => @@ -1675,7 +1680,9 @@ class _$_PaymentSheetAppearanceColors implements _PaymentSheetAppearanceColors { @override Map toJson() { - return _$$_PaymentSheetAppearanceColorsToJson(this); + return _$$_PaymentSheetAppearanceColorsToJson( + this, + ); } } @@ -1714,59 +1721,59 @@ abstract class _PaymentSheetAppearanceColors /// /// Make sure there is enough contrast with [background]. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get primary => throw _privateConstructorUsedError; + Color? get primary; @override /// Background color of the payment sheet. /// /// Make sure there is enough contrast with [primary]. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get background => throw _privateConstructorUsedError; + Color? get background; @override /// Background color of the payment sheet components. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get componentBackground => throw _privateConstructorUsedError; + Color? get componentBackground; @override /// Border color of the payment sheet components. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get componentBorder => throw _privateConstructorUsedError; + Color? get componentBorder; @override /// Divider color of the payment sheet components. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get componentDivider => throw _privateConstructorUsedError; + Color? get componentDivider; @override /// Color of the entered text in the payment components. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get componentText => throw _privateConstructorUsedError; + Color? get componentText; @override /// Primary text color. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get primaryText => throw _privateConstructorUsedError; + Color? get primaryText; @override /// Secondary text color. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get secondaryText => throw _privateConstructorUsedError; + Color? get secondaryText; @override /// Place holder text color. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get placeholderText => throw _privateConstructorUsedError; + Color? get placeholderText; @override /// Color of the displayed icons @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get icon => throw _privateConstructorUsedError; + Color? get icon; @override /// Color of the warning and error messages. @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get error => throw _privateConstructorUsedError; + Color? get error; @override @JsonKey(ignore: true) _$$_PaymentSheetAppearanceColorsCopyWith<_$_PaymentSheetAppearanceColors> @@ -1955,7 +1962,9 @@ class _$_PaymentSheetShape implements _PaymentSheetShape { @override Map toJson() { - return _$$_PaymentSheetShapeToJson(this); + return _$$_PaymentSheetShapeToJson( + this, + ); } } @@ -1971,15 +1980,15 @@ abstract class _PaymentSheetShape implements PaymentSheetShape { @override /// Borderradius for the paymentsheet corners - double? get borderRadius => throw _privateConstructorUsedError; + double? get borderRadius; @override /// Borderwidth for the paymentsheet components - double? get borderWidth => throw _privateConstructorUsedError; + double? get borderWidth; @override /// Appearance config of the payment sheet shadow - PaymentSheetShadowParams? get shadow => throw _privateConstructorUsedError; + PaymentSheetShadowParams? get shadow; @override @JsonKey(ignore: true) _$$_PaymentSheetShapeCopyWith<_$_PaymentSheetShape> get copyWith => @@ -2176,7 +2185,9 @@ class _$_PaymentSheetShadowParams implements _PaymentSheetShadowParams { @override Map toJson() { - return _$$_PaymentSheetShadowParamsToJson(this); + return _$$_PaymentSheetShadowParamsToJson( + this, + ); } } @@ -2194,15 +2205,15 @@ abstract class _PaymentSheetShadowParams implements PaymentSheetShadowParams { /// Shadow color @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get color => throw _privateConstructorUsedError; + Color? get color; @override /// Shadow opacity - double? get opacity => throw _privateConstructorUsedError; + double? get opacity; @override /// Shadow offset - PaymentSheetShadowOffset? get offset => throw _privateConstructorUsedError; + PaymentSheetShadowOffset? get offset; @override @JsonKey(ignore: true) _$$_PaymentSheetShadowParamsCopyWith<_$_PaymentSheetShadowParams> @@ -2350,7 +2361,9 @@ class _$_PaymentSheetShadowOffset implements _PaymentSheetShadowOffset { @override Map toJson() { - return _$$_PaymentSheetShadowOffsetToJson(this); + return _$$_PaymentSheetShadowOffsetToJson( + this, + ); } } @@ -2364,11 +2377,11 @@ abstract class _PaymentSheetShadowOffset implements PaymentSheetShadowOffset { @override /// X value - double? get x => throw _privateConstructorUsedError; + double? get x; @override /// Y value - double? get y => throw _privateConstructorUsedError; + double? get y; @override @JsonKey(ignore: true) _$$_PaymentSheetShadowOffsetCopyWith<_$_PaymentSheetShadowOffset> @@ -2561,7 +2574,9 @@ class _$_PaymentSheetPrimaryButtonAppearance @override Map toJson() { - return _$$_PaymentSheetPrimaryButtonAppearanceToJson(this); + return _$$_PaymentSheetPrimaryButtonAppearanceToJson( + this, + ); } } @@ -2579,13 +2594,11 @@ abstract class _PaymentSheetPrimaryButtonAppearance @override /// color theme of the primary button - PaymentSheetPrimaryButtonTheme? get colors => - throw _privateConstructorUsedError; + PaymentSheetPrimaryButtonTheme? get colors; @override /// Shape params of the primary button - PaymentSheetPrimaryButtonShape? get shapes => - throw _privateConstructorUsedError; + PaymentSheetPrimaryButtonShape? get shapes; @override @JsonKey(ignore: true) _$$_PaymentSheetPrimaryButtonAppearanceCopyWith< @@ -2782,7 +2795,9 @@ class _$_PaymentSheetPrimaryButtonShape @override Map toJson() { - return _$$_PaymentSheetPrimaryButtonShapeToJson(this); + return _$$_PaymentSheetPrimaryButtonShapeToJson( + this, + ); } } @@ -2799,15 +2814,15 @@ abstract class _PaymentSheetPrimaryButtonShape @override /// Configuration of the primary button's shadow. - PaymentSheetShadowParams? get shadow => throw _privateConstructorUsedError; + PaymentSheetShadowParams? get shadow; @override /// the blur radius of the button - double? get blurRadius => throw _privateConstructorUsedError; + double? get blurRadius; @override /// border width of the primary button on the payment sheet - double? get borderWidth => throw _privateConstructorUsedError; + double? get borderWidth; @override @JsonKey(ignore: true) _$$_PaymentSheetPrimaryButtonShapeCopyWith<_$_PaymentSheetPrimaryButtonShape> @@ -2997,7 +3012,9 @@ class _$_PaymentSheetPrimaryButtonTheme @override Map toJson() { - return _$$_PaymentSheetPrimaryButtonThemeToJson(this); + return _$$_PaymentSheetPrimaryButtonThemeToJson( + this, + ); } } @@ -3014,13 +3031,11 @@ abstract class _PaymentSheetPrimaryButtonTheme @override /// Colors when displaying button in dark theme - PaymentSheetPrimaryButtonThemeColors? get dark => - throw _privateConstructorUsedError; + PaymentSheetPrimaryButtonThemeColors? get dark; @override /// Colors when displaying button in light theme - PaymentSheetPrimaryButtonThemeColors? get light => - throw _privateConstructorUsedError; + PaymentSheetPrimaryButtonThemeColors? get light; @override @JsonKey(ignore: true) _$$_PaymentSheetPrimaryButtonThemeCopyWith<_$_PaymentSheetPrimaryButtonTheme> @@ -3218,7 +3233,9 @@ class _$_PaymentSheetPrimaryButtonThemeColors @override Map toJson() { - return _$$_PaymentSheetPrimaryButtonThemeColorsToJson(this); + return _$$_PaymentSheetPrimaryButtonThemeColorsToJson( + this, + ); } } @@ -3240,17 +3257,17 @@ abstract class _PaymentSheetPrimaryButtonThemeColors /// Primary button background color @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get background => throw _privateConstructorUsedError; + Color? get background; @override /// Primary button text color @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get text => throw _privateConstructorUsedError; + Color? get text; @override /// Primary button border color @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - Color? get border => throw _privateConstructorUsedError; + Color? get border; @override @JsonKey(ignore: true) _$$_PaymentSheetPrimaryButtonThemeColorsCopyWith< @@ -3413,7 +3430,9 @@ class _$_PresentParameters implements _PresentParameters { @override Map toJson() { - return _$$_PresentParametersToJson(this); + return _$$_PresentParametersToJson( + this, + ); } } @@ -3428,7 +3447,7 @@ abstract class _PresentParameters implements PresentPaymentSheetParameters { @override /// Key used for client-side retrieval using a publishable key. - String get clientSecret => throw _privateConstructorUsedError; + String get clientSecret; @override /// Flag that determines whether or not to present payment options or @@ -3438,7 +3457,7 @@ abstract class _PresentParameters implements PresentPaymentSheetParameters { /// is set to `true` when initializing the payment sheet. /// If value is set to `true` [SetupPaymentSheetParameters.customFlow] /// has to be set to `false` when initializing the payment sheet. - bool get confirmPayment => throw _privateConstructorUsedError; + bool get confirmPayment; @override @JsonKey(ignore: true) _$$_PresentParametersCopyWith<_$_PresentParameters> get copyWith => diff --git a/packages/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart b/packages/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart index 92d4ec307..89d2dbb4c 100644 --- a/packages/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart @@ -403,7 +403,9 @@ class _$_SetupIntent implements _SetupIntent { @override Map toJson() { - return _$$_SetupIntentToJson(this); + return _$$_SetupIntentToJson( + this, + ); } } @@ -427,51 +429,50 @@ abstract class _SetupIntent implements SetupIntent { @override /// Unique identifier. - String get id => throw _privateConstructorUsedError; + String get id; @override /// Status of the intent. /// /// See https://stripe.com/docs/payments/intents#intent-statuses. - String get status => throw _privateConstructorUsedError; + String get status; @override /// Determines whether the intent is in live mode or in test mode. - bool get livemode => throw _privateConstructorUsedError; + bool get livemode; @override /// The client is secret is used for handling the payment from the Client side. - String get clientSecret => throw _privateConstructorUsedError; + String get clientSecret; @override /// Id of the payment method used in this intent. - String get paymentMethodId => throw _privateConstructorUsedError; + String get paymentMethodId; @override /// Indicates how the intent is used in the future. - String get usage => throw _privateConstructorUsedError; + String get usage; @override /// List of payment method types associated with this intent. - List get paymentMethodTypes => - throw _privateConstructorUsedError; + List get paymentMethodTypes; @override /// Localized description that provides additional context to users. - String? get description => throw _privateConstructorUsedError; + String? get description; @override /// Timestamp since epoch that represents the time the intent is created. - String? get created => throw _privateConstructorUsedError; + String? get created; @override /// Error encountered since last configmration. - LastSetupError? get lastSetupError => throw _privateConstructorUsedError; + LastSetupError? get lastSetupError; @override /// Additional action that needs to be taken in order to complete a payment /// using the provided resource. - NextAction? get nextAction => throw _privateConstructorUsedError; + NextAction? get nextAction; @override @JsonKey(ignore: true) _$$_SetupIntentCopyWith<_$_SetupIntent> get copyWith => @@ -615,7 +616,9 @@ class _$_LastSetupError implements _LastSetupError { @override Map toJson() { - return _$$_LastSetupErrorToJson(this); + return _$$_LastSetupErrorToJson( + this, + ); } } @@ -630,11 +633,11 @@ abstract class _LastSetupError implements LastSetupError { @override /// Code. - String get code => throw _privateConstructorUsedError; + String get code; @override /// Message. - String get message => throw _privateConstructorUsedError; + String get message; @override @JsonKey(ignore: true) _$$_LastSetupErrorCopyWith<_$_LastSetupError> get copyWith => diff --git a/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart b/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart index ff5fc2458..9e00f403c 100644 --- a/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart @@ -37,7 +37,7 @@ Map _$$_SetupIntentToJson(_$_SetupIntent instance) => 'paymentMethodId': instance.paymentMethodId, 'usage': instance.usage, 'paymentMethodTypes': instance.paymentMethodTypes - .map((e) => _$PaymentMethodTypeEnumMap[e]) + .map((e) => _$PaymentMethodTypeEnumMap[e]!) .toList(), 'description': instance.description, 'created': instance.created, diff --git a/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart b/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart index 3a1a13f63..f4f5d7342 100644 --- a/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart +++ b/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart @@ -52,6 +52,9 @@ abstract class StripePlatform extends PlatformInterface { /// Display the payment sheet. Future presentPaymentSheet(); + /// Reset the payment sheet. + Future resetPaymentSheetCustomer(); + /// Confirm the payment on a payment sheet. Future confirmPaymentSheetPayment(); diff --git a/packages/stripe_platform_interface/test/method_channel_stripe_test.dart b/packages/stripe_platform_interface/test/method_channel_stripe_test.dart index 3710f0660..cfbcfe25e 100644 --- a/packages/stripe_platform_interface/test/method_channel_stripe_test.dart +++ b/packages/stripe_platform_interface/test/method_channel_stripe_test.dart @@ -497,6 +497,29 @@ void main() { }); }); + group('Reset payment sheet', () { + late Completer completer; + + setUp(() async { + completer = Completer(); + + sut = MethodChannelStripe( + platformIsIos: false, + platformIsAndroid: true, + methodChannel: MethodChannelMock( + channelName: methodChannelName, + method: 'resetPaymentSheetCustomer', + result: {}, + ).methodChannel, + ); + await sut.resetPaymentSheetCustomer().then((_) => completer.complete()); + }); + + test('It completes operation', () { + expect(completer.isCompleted, true); + }); + }); + group('presentPaymentSheet', () { late Completer completer; diff --git a/packages/stripe_web/lib/src/web_stripe.dart b/packages/stripe_web/lib/src/web_stripe.dart index ad23045c0..f950e615b 100644 --- a/packages/stripe_web/lib/src/web_stripe.dart +++ b/packages/stripe_web/lib/src/web_stripe.dart @@ -363,6 +363,11 @@ class WebStripe extends StripePlatform { // TODO: implement handleURLCallback throw UnimplementedError(); } + + @override + Future resetPaymentSheetCustomer() { + throw WebUnsupportedError.method('resetPaymentSheet'); + } } class WebUnsupportedError extends Error implements UnsupportedError {