diff --git a/stripe/example/lib/screens/no_webhook_payment_screen.dart b/stripe/example/lib/screens/no_webhook_payment_screen.dart index ff0074a9c..f5cca6f1b 100644 --- a/stripe/example/lib/screens/no_webhook_payment_screen.dart +++ b/stripe/example/lib/screens/no_webhook_payment_screen.dart @@ -8,7 +8,9 @@ class NoWebhookPaymentScreen extends StatelessWidget { appBar: AppBar(), body: Column( children: [ - CardField(), + CardField( + onCardChanged: (_) {}, + ), ElevatedButton( onPressed: _handlePayPress, child: Text('Pay'), diff --git a/stripe/example/lib/screens/setup_future_payment_screen.dart b/stripe/example/lib/screens/setup_future_payment_screen.dart index e2658b6c0..b4b82024f 100644 --- a/stripe/example/lib/screens/setup_future_payment_screen.dart +++ b/stripe/example/lib/screens/setup_future_payment_screen.dart @@ -9,7 +9,7 @@ class SetupFuturePaymentScreen extends StatefulWidget { class _SetupFuturePaymentScreenState extends State { PaymentIntent retrievedPaymentIntent; - CardFieldInputDetails card; + CardFieldInputDetails _card; @override Widget build(BuildContext context) { @@ -18,7 +18,13 @@ class _SetupFuturePaymentScreenState extends State { body: Column( children: [ TextField(), - CardField(), + CardField( + onCardChanged: (card) { + setState(() { + _card = card; + }); + }, + ), ElevatedButton( onPressed: _handlePayPress, child: Text('Save'), @@ -36,7 +42,7 @@ class _SetupFuturePaymentScreenState extends State { } Future _handlePayPress() async { - if (card == null) { + if (_card == null) { return; } @@ -47,19 +53,19 @@ class _SetupFuturePaymentScreenState extends State { final BillingDetails billingDetails = BillingDetails( email: 'email', phone: '+48888000888', - /*addressCity: 'Houston', - addressCountry: 'US', + addressCity: 'Houston', + addressCountry: 'US', // TODO country addressLine1: '1459 Circle Drive', - addressLine2: 'Texas', - addressPostalCode: '77063',*/ + addressLine2: 'test', + adressPostalCode: '77063', ); // mocked data for tests // 3. Confirm setup intent await Stripe.instance .confirmSetupIntent( clientSecret, - CardParams( - details: card, + PaymentMethodParams.card( + details: _card, //billingDetails, )) .then((setupIntentResult) { @@ -68,8 +74,8 @@ class _SetupFuturePaymentScreenState extends State { 'Success: Setup intent created. Intent status: ${setupIntentResult.status}'))); //setSetupIntent(setupIntentResult); }).catchError((error) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('Error code: ${error.code} - ${error.message}'))); + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar(content: Text('Error code: ${error}'))); }); } diff --git a/stripe/example/pubspec.lock b/stripe/example/pubspec.lock index ae33368be..3e7677627 100644 --- a/stripe/example/pubspec.lock +++ b/stripe/example/pubspec.lock @@ -7,7 +7,14 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "2.0.13" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" async: dependency: transitive description: @@ -50,13 +57,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -64,13 +78,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" - equatable: - dependency: transitive - description: - name: equatable - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" fake_async: dependency: transitive description: @@ -84,7 +91,7 @@ packages: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.0.0" flutter: dependency: "direct main" description: flutter @@ -100,6 +107,13 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.1" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -123,7 +137,7 @@ packages: dependency: "direct dev" description: flutter source: sdk - version: "0.0.0" + version: "0.9.2+2" json_annotation: dependency: transitive description: @@ -179,7 +193,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.0.0" sky_engine: dependency: transitive description: flutter @@ -191,7 +205,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" stack_trace: dependency: transitive description: @@ -247,7 +261,7 @@ packages: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.2.0" term_glyph: dependency: transitive description: @@ -282,14 +296,14 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "6.0.1-nullsafety.1" + version: "5.5.0" webdriver: dependency: transitive description: name: webdriver url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "2.1.2" sdks: dart: ">=2.12.0-224.0.dev <3.0.0" flutter: ">=1.20.0" diff --git a/stripe/lib/src/stripe.dart b/stripe/lib/src/stripe.dart index cbdf04668..cad65bb51 100644 --- a/stripe/lib/src/stripe.dart +++ b/stripe/lib/src/stripe.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:stripe_platform_interface/src/method_channel_stripe.dart'; import 'package:stripe_platform_interface/src/models/apple_pay.dart'; +import 'package:stripe_platform_interface/src/models/app_info.dart'; import 'package:stripe_platform_interface/src/models/errors.dart'; import 'package:stripe_platform_interface/src/models/payment_intents.dart'; import 'package:stripe_platform_interface/src/models/payment_methods.dart'; @@ -46,7 +47,6 @@ class Stripe { Future initialise({ required String publishableKey, - // AppInfo? appInfo, String? stripeAccountId, ThreeDSecureConfigurationParams? threeDSecureParams, String? merchantIdentifier, @@ -75,7 +75,7 @@ class Stripe { final paymentMethod = await _platform.createPaymentMethod(data, options); return paymentMethod; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + throw StripeError.generic(message: error.message, code: error.message); } } @@ -84,7 +84,7 @@ class Stripe { final paymentMethod = await _platform.retrievePaymentIntent(clientSecret); return paymentMethod; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + throw StripeError.generic(message: error.message, code: error.message); } } @@ -106,8 +106,7 @@ class Stripe { ApplePayPresentParams params, ) async { if (!isApplePaySupported.value) { - throw StripeError( - ApplePayError.canceled, 'APPLE_PAY_NOT_SUPPORTED_MESSAGE'); + //throw StripeError(ApplePayError.canceled, 'APPLE_PAY_NOT_SUPPORTED_MESSAGE'); } try { await _platform.presentApplePay(params); @@ -120,8 +119,7 @@ class Stripe { String clientSecret, ) async { if (!isApplePaySupported.value) { - throw StripeError( - ApplePayError.canceled, 'APPLE_PAY_NOT_SUPPORTED_MESSAGE'); + //throw StripeError(ApplePayError.canceled, 'APPLE_PAY_NOT_SUPPORTED_MESSAGE'); } try { await _platform.confirmApplePayPayment(clientSecret); @@ -138,7 +136,8 @@ class Stripe { await _platform.handleCardAction(paymentIntentClientSecret); return paymentIntent; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } @@ -152,7 +151,8 @@ class Stripe { paymentIntentClientSecret, data, options); return setupIntent; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } @@ -165,7 +165,8 @@ class Stripe { ); return tokenId; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } @@ -177,7 +178,8 @@ class Stripe { ); return option; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } @@ -187,7 +189,8 @@ class Stripe { final option = await _platform.presentPaymentSheet(clientSecret); return option; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } finally { _isPaymentSheetDisplayed.value = false; } @@ -198,7 +201,8 @@ class Stripe { final option = await _platform.paymentSheetConfirmPayment(); return option; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } @@ -207,7 +211,8 @@ class Stripe { final option = await _platform.presentPaymentOptions(); return option; } on StripeError catch (error) { - throw StripeError(error.code, error.message); + //throw StripeError(error.code, error.message); + rethrow; } } } diff --git a/stripe/lib/src/widgets/card_field.dart b/stripe/lib/src/widgets/card_field.dart index 6bfa2a123..02d23e15d 100644 --- a/stripe/lib/src/widgets/card_field.dart +++ b/stripe/lib/src/widgets/card_field.dart @@ -13,13 +13,21 @@ typedef CardFocusCallback = void Function(CardFieldName? focusedField); // TODO refactor this for parameters class CardField extends StatelessWidget { + final CardChangedCallback onCardChanged; + + const CardField({Key? key, required this.onCardChanged}) : super(key: key); + @override Widget build(BuildContext context) { switch (defaultTargetPlatform) { case TargetPlatform.android: - return AndroidCardField(); + return AndroidCardField( + onChange: onCardChanged, + ); case TargetPlatform.iOS: - return UiKitCardField(); + return UiKitCardField( + onChange: onCardChanged, + ); default: throw UnsupportedError("Unsupported platform view"); } @@ -266,21 +274,3 @@ class _UiKitCardFieldState extends State { super.didUpdateWidget(oldWidget); } } - -class NativeCardDetails extends CardFieldInputDetails { - NativeCardDetails({ - required String last4, - required int expiryMonth, - required int expiryYear, - String? postalCode, - required CardBrand brand, - required bool complete, - }) : super( - last4: last4, - expiryMonth: expiryMonth, - expiryYear: expiryYear, - postalCode: postalCode, - brand: brand, - complete: complete, - ); -} diff --git a/stripe/pubspec.lock b/stripe/pubspec.lock index 07d50657d..6be653b0c 100644 --- a/stripe/pubspec.lock +++ b/stripe/pubspec.lock @@ -43,13 +43,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" - equatable: - dependency: transitive - description: - name: equatable - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" fake_async: dependency: transitive description: @@ -67,6 +60,13 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.1" json_annotation: dependency: transitive description: @@ -113,7 +113,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" stack_trace: dependency: transitive description: diff --git a/stripe_platform_interface/lib/models.dart b/stripe_platform_interface/lib/models.dart index 19e4d293e..6b37d45a5 100644 --- a/stripe_platform_interface/lib/models.dart +++ b/stripe_platform_interface/lib/models.dart @@ -1,7 +1,7 @@ - export 'src/models/apple_pay.dart'; export 'src/models/apple_pay_button.dart'; +export 'src/models/app_info.dart'; export 'src/models/card_field_input.dart'; export 'src/models/errors.dart'; export 'src/models/payment_intents.dart'; @@ -9,4 +9,4 @@ export 'src/models/payment_intents.dart'; export 'src/models/payment_methods.dart'; export 'src/models/setup_intent.dart'; export 'src/models/three_d_secure.dart'; -export 'src/models/payment_sheet.dart'; \ No newline at end of file +export 'src/models/payment_sheet.dart'; diff --git a/stripe_platform_interface/lib/src/method_channel_stripe.dart b/stripe_platform_interface/lib/src/method_channel_stripe.dart index ce710147f..80ca0ea88 100644 --- a/stripe_platform_interface/lib/src/method_channel_stripe.dart +++ b/stripe_platform_interface/lib/src/method_channel_stripe.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:flutter/services.dart'; -import 'package:flutter/foundation.dart'; import 'package:stripe_platform_interface/src/models/setup_intent.dart'; import 'package:stripe_platform_interface/src/models/three_d_secure.dart'; import 'package:stripe_platform_interface/src/models/payment_methods.dart'; @@ -9,20 +8,25 @@ import 'package:stripe_platform_interface/src/models/payment_intents.dart'; import 'package:stripe_platform_interface/src/models/apple_pay.dart'; import 'package:stripe_platform_interface/stripe_platform_interface.dart'; -const Map appInfo = { - "name": "flutter_stripe", - "partnerId": "flutter_stripe", - "version": "0.0.0", - "url": "https://github.com/fluttercommunity/flutter_stripe/" -}; +import '../stripe_platform_interface.dart'; +import 'models/app_info.dart'; + +const _appInfo = AppInfo( + name: "flutter_stripe", + version: "0.0.0", + url: "https://github.com/fluttercommunity/flutter_stripe/"); /// An implementation of [StripePlatform] that uses method channels. class MethodChannelStripe extends StripePlatform { - @visibleForTesting - MethodChannel methodChannel = MethodChannel('flutter.stripe/payments'); + MethodChannelStripe({ + required MethodChannel methodChannel, + required EventChannel eventChannel, + }) : _eventChannel = eventChannel, + _methodChannel = methodChannel; + + final MethodChannel _methodChannel; - @visibleForTesting - EventChannel eventChannel = EventChannel('flutter.stripe/events'); + final EventChannel _eventChannel; @override Future initialise({ @@ -30,14 +34,27 @@ class MethodChannelStripe extends StripePlatform { String? stripeAccountId, ThreeDSecureConfigurationParams? threeDSecureParams, String? merchantIdentifier, + String? urlScheme, }) async { - await methodChannel.invokeMethod('initialise', { + await _methodChannel.invokeMethod('initialise', { 'publishableKey': publishableKey, 'stripeAccountId': stripeAccountId, 'merchantIdentifier': merchantIdentifier, - 'appInfo': appInfo - // 'threeDSecureParams': threeDSecureParams, + 'appInfo': _appInfo.toJson(), + 'threeDSecureParams': threeDSecureParams, + }); + } + + @override + Future createPaymentMethod( + PaymentMethodParams params, [ + Map options = const {}, + ]) async { + final result = await _methodChannel.invokeMethod('createPaymentMethod', { + 'data': params.toJson(), + 'options': options, }); + return PaymentMethod.fromJson(result.unfoldToNonNull()); } @override @@ -47,51 +64,66 @@ class MethodChannelStripe extends StripePlatform { } @override - Future confirmApplePayPayment(String clientSecret) { - // TODO: implement confirmApplePayPayment - throw UnimplementedError(); + Future confirmApplePayPayment(String clientSecret) async { + await _methodChannel.invokeMethod('confirmApplePayPayment', { + 'clientSecret': clientSecret, + }); } @override Future confirmPaymentMethod( - String paymentIntentClientSecret, PaymentMethodParams data, - [Map options = const {}]) { - // TODO: implement confirmPaymentMethod - throw UnimplementedError(); + String paymentIntentClientSecret, + PaymentMethodParams params, [ + Map options = const {}, + ]) async { + final result = await _methodChannel.invokeMethod('confirmPaymentMethod', { + 'paymentIntentClientSecret': paymentIntentClientSecret, + 'data': params.toJson(), + 'options': options, + }); + return PaymentIntent.fromJson(result.unfoldToNonNull()); } @override Future confirmSetupIntent( - String paymentIntentClientSecret, PaymentMethodParams data, - [Map options = const {}]) { - // TODO: implement confirmSetupIntent - throw UnimplementedError(); - } + String paymentIntentClientSecret, + PaymentMethodParams params, [ + Map options = const {}, + ]) async { + final result = await _methodChannel.invokeMethod('confirmSetupIntent', { + 'paymentIntentClientSecret': paymentIntentClientSecret, + 'data': params.toJson(), + 'options': options, + }); - @override - Future createPaymentMethod(PaymentMethodParams data, - [Map options = const {}]) { - // TODO: implement createPaymentMethod - throw UnimplementedError(); + return SetupIntent.fromJson(result.unfoldToNonNull()); } @override - Future createTokenForCVCUpdate(String cvc) { - // TODO: implement createTokenForCVCUpdate - throw UnimplementedError(); + Future createTokenForCVCUpdate(String cvc) async { + final result = await _methodChannel.invokeMethod( + 'createTokenForCVCUpdate', + {'cvc': cvc}, + ); + + return result.unfoldToNonNull(); } @override - Future handleCardAction(String paymentIntentClientSecret) { - // TODO: implement handleCardAction - throw UnimplementedError(); + Future handleCardAction( + String paymentIntentClientSecret) async { + final result = await _methodChannel.invokeMethod('handleCardAction', { + 'paymentIntentClientSecret': paymentIntentClientSecret, + }); + + return PaymentIntent.fromJson(result.unfoldToNonNull()); } @override Future isApplePaySupported() async { if (!Platform.isIOS) return false; final bool? isSupported = - await methodChannel.invokeMethod('isApplePaySupported'); + await _methodChannel.invokeMethod('isApplePaySupported'); return isSupported ?? false; } @@ -99,25 +131,28 @@ class MethodChannelStripe extends StripePlatform { Future presentApplePay(ApplePayPresentParams params) async { if (!Platform.isIOS) throw UnsupportedError('Apple Pay is only available for iOS devices'); - await methodChannel.invokeMethod('presentApplePay', params.toJson()); + await _methodChannel.invokeMethod('presentApplePay', params.toJson()); } @override - Future retrievePaymentIntent(String clientSecret) { - // TODO: implement retrievePaymentIntent - throw UnimplementedError(); + Future retrievePaymentIntent(String clientSecret) async { + final result = await _methodChannel.invokeMethod('retrievePaymentIntent', { + 'clientSecret': clientSecret, + }); + + return PaymentIntent.fromJson(result.unfoldToNonNull()); } @override Future paymentSheetConfirmPayment() async { final options = - await methodChannel.invokeMethod('paymentSheetConfirmPayment'); + await _methodChannel.invokeMethod('paymentSheetConfirmPayment'); return PaymentIntent.fromJson(Map.from(options)); } @override Future presentPaymentOptions() async { - final options = await methodChannel.invokeMethod('presentPaymentOptions'); + final options = await _methodChannel.invokeMethod('presentPaymentOptions'); return options != null ? PaymentOption.fromJson(Map.from(options)) : null; @@ -125,7 +160,7 @@ class MethodChannelStripe extends StripePlatform { @override Future presentPaymentSheet(String? clientSecret) async { - final options = await methodChannel + final options = await _methodChannel .invokeMethod('presentPaymentSheet', {clientSecret: clientSecret}); return PaymentIntent.fromJson(Map.from(options)); } @@ -134,9 +169,30 @@ class MethodChannelStripe extends StripePlatform { Future setupPaymentSheet( SetupPaymentSheetParams params) async { final options = - await methodChannel.invokeMethod('setupPaymentSheet', params.toJson()); + await _methodChannel.invokeMethod('setupPaymentSheet', params.toJson()); return options != null ? PaymentOption.fromJson(Map.from(options)) : null; } } + +class MethodChannelStripeFactory { + const MethodChannelStripeFactory(); + + StripePlatform create() { + return MethodChannelStripe( + methodChannel: MethodChannel('flutter.stripe/payments'), + eventChannel: EventChannel('flutter.stripe/events'), + ); + } +} + +extension UnfoldToNonNull on T? { + T unfoldToNonNull() { + if (this == null) { + throw AssertionError('Result should not be null'); + } else { + return this!; + } + } +} diff --git a/stripe_platform_interface/lib/src/models/address.dart b/stripe_platform_interface/lib/src/models/address.dart new file mode 100644 index 000000000..f2c8b95dd --- /dev/null +++ b/stripe_platform_interface/lib/src/models/address.dart @@ -0,0 +1,20 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'address.freezed.dart'; +part 'address.g.dart'; + +@freezed +class Address with _$Address { + @JsonSerializable(explicitToJson: true) + const factory Address({ + required String city, + required String country, + required String line1, + required String line2, + required String postalCode, + required String state, + }) = _Address; + + factory Address.fromJson(Map json) => + _$AddressFromJson(json); +} diff --git a/stripe_platform_interface/lib/src/models/address.freezed.dart b/stripe_platform_interface/lib/src/models/address.freezed.dart new file mode 100644 index 000000000..b8c9876b3 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/address.freezed.dart @@ -0,0 +1,283 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'address.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +Address _$AddressFromJson(Map json) { + return _Address.fromJson(json); +} + +/// @nodoc +class _$AddressTearOff { + const _$AddressTearOff(); + + _Address call( + {required String city, + required String country, + required String line1, + required String line2, + required String postalCode, + required String state}) { + return _Address( + city: city, + country: country, + line1: line1, + line2: line2, + postalCode: postalCode, + state: state, + ); + } + + Address fromJson(Map json) { + return Address.fromJson(json); + } +} + +/// @nodoc +const $Address = _$AddressTearOff(); + +/// @nodoc +mixin _$Address { + String get city => throw _privateConstructorUsedError; + String get country => throw _privateConstructorUsedError; + String get line1 => throw _privateConstructorUsedError; + String get line2 => throw _privateConstructorUsedError; + String get postalCode => throw _privateConstructorUsedError; + String get state => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AddressCopyWith
get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AddressCopyWith<$Res> { + factory $AddressCopyWith(Address value, $Res Function(Address) then) = + _$AddressCopyWithImpl<$Res>; + $Res call( + {String city, + String country, + String line1, + String line2, + String postalCode, + String state}); +} + +/// @nodoc +class _$AddressCopyWithImpl<$Res> implements $AddressCopyWith<$Res> { + _$AddressCopyWithImpl(this._value, this._then); + + final Address _value; + // ignore: unused_field + final $Res Function(Address) _then; + + @override + $Res call({ + Object? city = freezed, + Object? country = freezed, + Object? line1 = freezed, + Object? line2 = freezed, + Object? postalCode = freezed, + Object? state = freezed, + }) { + return _then(_value.copyWith( + city: city == freezed + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + line1: line1 == freezed + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as String, + line2: line2 == freezed + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as String, + postalCode: postalCode == freezed + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String, + state: state == freezed + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +abstract class _$AddressCopyWith<$Res> implements $AddressCopyWith<$Res> { + factory _$AddressCopyWith(_Address value, $Res Function(_Address) then) = + __$AddressCopyWithImpl<$Res>; + @override + $Res call( + {String city, + String country, + String line1, + String line2, + String postalCode, + String state}); +} + +/// @nodoc +class __$AddressCopyWithImpl<$Res> extends _$AddressCopyWithImpl<$Res> + implements _$AddressCopyWith<$Res> { + __$AddressCopyWithImpl(_Address _value, $Res Function(_Address) _then) + : super(_value, (v) => _then(v as _Address)); + + @override + _Address get _value => super._value as _Address; + + @override + $Res call({ + Object? city = freezed, + Object? country = freezed, + Object? line1 = freezed, + Object? line2 = freezed, + Object? postalCode = freezed, + Object? state = freezed, + }) { + return _then(_Address( + city: city == freezed + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + line1: line1 == freezed + ? _value.line1 + : line1 // ignore: cast_nullable_to_non_nullable + as String, + line2: line2 == freezed + ? _value.line2 + : line2 // ignore: cast_nullable_to_non_nullable + as String, + postalCode: postalCode == freezed + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String, + state: state == freezed + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Address implements _Address { + const _$_Address( + {required this.city, + required this.country, + required this.line1, + required this.line2, + required this.postalCode, + required this.state}); + + factory _$_Address.fromJson(Map json) => + _$_$_AddressFromJson(json); + + @override + final String city; + @override + final String country; + @override + final String line1; + @override + final String line2; + @override + final String postalCode; + @override + final String state; + + @override + String toString() { + return 'Address(city: $city, country: $country, line1: $line1, line2: $line2, postalCode: $postalCode, state: $state)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Address && + (identical(other.city, city) || + const DeepCollectionEquality().equals(other.city, city)) && + (identical(other.country, country) || + const DeepCollectionEquality() + .equals(other.country, country)) && + (identical(other.line1, line1) || + const DeepCollectionEquality().equals(other.line1, line1)) && + (identical(other.line2, line2) || + const DeepCollectionEquality().equals(other.line2, line2)) && + (identical(other.postalCode, postalCode) || + const DeepCollectionEquality() + .equals(other.postalCode, postalCode)) && + (identical(other.state, state) || + const DeepCollectionEquality().equals(other.state, state))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(city) ^ + const DeepCollectionEquality().hash(country) ^ + const DeepCollectionEquality().hash(line1) ^ + const DeepCollectionEquality().hash(line2) ^ + const DeepCollectionEquality().hash(postalCode) ^ + const DeepCollectionEquality().hash(state); + + @JsonKey(ignore: true) + @override + _$AddressCopyWith<_Address> get copyWith => + __$AddressCopyWithImpl<_Address>(this, _$identity); + + @override + Map toJson() { + return _$_$_AddressToJson(this); + } +} + +abstract class _Address implements Address { + const factory _Address( + {required String city, + required String country, + required String line1, + required String line2, + required String postalCode, + required String state}) = _$_Address; + + factory _Address.fromJson(Map json) = _$_Address.fromJson; + + @override + String get city => throw _privateConstructorUsedError; + @override + String get country => throw _privateConstructorUsedError; + @override + String get line1 => throw _privateConstructorUsedError; + @override + String get line2 => throw _privateConstructorUsedError; + @override + String get postalCode => throw _privateConstructorUsedError; + @override + String get state => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$AddressCopyWith<_Address> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/address.g.dart b/stripe_platform_interface/lib/src/models/address.g.dart new file mode 100644 index 000000000..63925ced4 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/address.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'address.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_Address _$_$_AddressFromJson(Map json) { + return _$_Address( + city: json['city'] as String, + country: json['country'] as String, + line1: json['line1'] as String, + line2: json['line2'] as String, + postalCode: json['postalCode'] as String, + state: json['state'] as String, + ); +} + +Map _$_$_AddressToJson(_$_Address instance) => + { + 'city': instance.city, + 'country': instance.country, + 'line1': instance.line1, + 'line2': instance.line2, + 'postalCode': instance.postalCode, + 'state': instance.state, + }; diff --git a/stripe_platform_interface/lib/src/models/app_info.dart b/stripe_platform_interface/lib/src/models/app_info.dart new file mode 100644 index 000000000..ababc6e44 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/app_info.dart @@ -0,0 +1,18 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'app_info.freezed.dart'; +part 'app_info.g.dart'; + +@freezed +class AppInfo with _$AppInfo { + @JsonSerializable(explicitToJson: true) + const factory AppInfo({ + String? name, + String? partnerId, + String? url, + String? version, + }) = _AppInfo; + + factory AppInfo.fromJson(Map json) => + _$AppInfoFromJson(json); +} diff --git a/stripe_platform_interface/lib/src/models/app_info.freezed.dart b/stripe_platform_interface/lib/src/models/app_info.freezed.dart new file mode 100644 index 000000000..e1e63528e --- /dev/null +++ b/stripe_platform_interface/lib/src/models/app_info.freezed.dart @@ -0,0 +1,219 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'app_info.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +AppInfo _$AppInfoFromJson(Map json) { + return _AppInfo.fromJson(json); +} + +/// @nodoc +class _$AppInfoTearOff { + const _$AppInfoTearOff(); + + _AppInfo call( + {String? name, String? partnerId, String? url, String? version}) { + return _AppInfo( + name: name, + partnerId: partnerId, + url: url, + version: version, + ); + } + + AppInfo fromJson(Map json) { + return AppInfo.fromJson(json); + } +} + +/// @nodoc +const $AppInfo = _$AppInfoTearOff(); + +/// @nodoc +mixin _$AppInfo { + String? get name => throw _privateConstructorUsedError; + String? get partnerId => throw _privateConstructorUsedError; + String? get url => throw _privateConstructorUsedError; + String? get version => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AppInfoCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AppInfoCopyWith<$Res> { + factory $AppInfoCopyWith(AppInfo value, $Res Function(AppInfo) then) = + _$AppInfoCopyWithImpl<$Res>; + $Res call({String? name, String? partnerId, String? url, String? version}); +} + +/// @nodoc +class _$AppInfoCopyWithImpl<$Res> implements $AppInfoCopyWith<$Res> { + _$AppInfoCopyWithImpl(this._value, this._then); + + final AppInfo _value; + // ignore: unused_field + final $Res Function(AppInfo) _then; + + @override + $Res call({ + Object? name = freezed, + Object? partnerId = freezed, + Object? url = freezed, + Object? version = freezed, + }) { + return _then(_value.copyWith( + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + partnerId: partnerId == freezed + ? _value.partnerId + : partnerId // ignore: cast_nullable_to_non_nullable + as String?, + url: url == freezed + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + version: version == freezed + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$AppInfoCopyWith<$Res> implements $AppInfoCopyWith<$Res> { + factory _$AppInfoCopyWith(_AppInfo value, $Res Function(_AppInfo) then) = + __$AppInfoCopyWithImpl<$Res>; + @override + $Res call({String? name, String? partnerId, String? url, String? version}); +} + +/// @nodoc +class __$AppInfoCopyWithImpl<$Res> extends _$AppInfoCopyWithImpl<$Res> + implements _$AppInfoCopyWith<$Res> { + __$AppInfoCopyWithImpl(_AppInfo _value, $Res Function(_AppInfo) _then) + : super(_value, (v) => _then(v as _AppInfo)); + + @override + _AppInfo get _value => super._value as _AppInfo; + + @override + $Res call({ + Object? name = freezed, + Object? partnerId = freezed, + Object? url = freezed, + Object? version = freezed, + }) { + return _then(_AppInfo( + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + partnerId: partnerId == freezed + ? _value.partnerId + : partnerId // ignore: cast_nullable_to_non_nullable + as String?, + url: url == freezed + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + version: version == freezed + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_AppInfo implements _AppInfo { + const _$_AppInfo({this.name, this.partnerId, this.url, this.version}); + + factory _$_AppInfo.fromJson(Map json) => + _$_$_AppInfoFromJson(json); + + @override + final String? name; + @override + final String? partnerId; + @override + final String? url; + @override + final String? version; + + @override + String toString() { + return 'AppInfo(name: $name, partnerId: $partnerId, url: $url, version: $version)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _AppInfo && + (identical(other.name, name) || + const DeepCollectionEquality().equals(other.name, name)) && + (identical(other.partnerId, partnerId) || + const DeepCollectionEquality() + .equals(other.partnerId, partnerId)) && + (identical(other.url, url) || + const DeepCollectionEquality().equals(other.url, url)) && + (identical(other.version, version) || + const DeepCollectionEquality().equals(other.version, version))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(name) ^ + const DeepCollectionEquality().hash(partnerId) ^ + const DeepCollectionEquality().hash(url) ^ + const DeepCollectionEquality().hash(version); + + @JsonKey(ignore: true) + @override + _$AppInfoCopyWith<_AppInfo> get copyWith => + __$AppInfoCopyWithImpl<_AppInfo>(this, _$identity); + + @override + Map toJson() { + return _$_$_AppInfoToJson(this); + } +} + +abstract class _AppInfo implements AppInfo { + const factory _AppInfo( + {String? name, + String? partnerId, + String? url, + String? version}) = _$_AppInfo; + + factory _AppInfo.fromJson(Map json) = _$_AppInfo.fromJson; + + @override + String? get name => throw _privateConstructorUsedError; + @override + String? get partnerId => throw _privateConstructorUsedError; + @override + String? get url => throw _privateConstructorUsedError; + @override + String? get version => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$AppInfoCopyWith<_AppInfo> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/app_info.g.dart b/stripe_platform_interface/lib/src/models/app_info.g.dart new file mode 100644 index 000000000..9e47c2da3 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/app_info.g.dart @@ -0,0 +1,24 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_info.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_AppInfo _$_$_AppInfoFromJson(Map json) { + return _$_AppInfo( + name: json['name'] as String?, + partnerId: json['partnerId'] as String?, + url: json['url'] as String?, + version: json['version'] as String?, + ); +} + +Map _$_$_AppInfoToJson(_$_AppInfo instance) => + { + 'name': instance.name, + 'partnerId': instance.partnerId, + 'url': instance.url, + 'version': instance.version, + }; diff --git a/stripe_platform_interface/lib/src/models/apple_pay.dart b/stripe_platform_interface/lib/src/models/apple_pay.dart index ccc727a90..8477f49b2 100644 --- a/stripe_platform_interface/lib/src/models/apple_pay.dart +++ b/stripe_platform_interface/lib/src/models/apple_pay.dart @@ -1,5 +1,6 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'apple_pay.freezed.dart'; part 'apple_pay.g.dart'; enum ApplePayShippingMethodType { @@ -15,60 +16,44 @@ enum ApplePayContactFieldsType { postalAddress } -@JsonSerializable(explicitToJson: true) -class ApplePayShippingMethod { - ApplePayShippingMethod({ - required this.label, - required this.amount, - required this.identifier, - this.type, - this.detail, - }); - final String label; - final String amount; - final ApplePayShippingMethodType? type; - final String identifier; - final String? detail; - +@freezed +class ApplePayShippingMethod with _$ApplePayShippingMethod { + @JsonSerializable(explicitToJson: true) + const factory ApplePayShippingMethod({ + required String label, + required String amount, + required String identifier, + ApplePayShippingMethodType? type, + String? detail, + }) = _ApplePayShippingMethod; factory ApplePayShippingMethod.fromJson(Map json) => _$ApplePayShippingMethodFromJson(json); - Map toJson() => _$ApplePayShippingMethodToJson(this); } -@JsonSerializable(explicitToJson: true) -class ApplePayCartSummaryItem { - ApplePayCartSummaryItem({ - required this.label, - required this.amount, - }); - final String label; - final String amount; - +@freezed +class ApplePayCartSummaryItem with _$ApplePayCartSummaryItem { + const factory ApplePayCartSummaryItem({ + required String label, + required String amount, + }) = _ApplePayCartSummaryItem; factory ApplePayCartSummaryItem.fromJson(Map json) => _$ApplePayCartSummaryItemFromJson(json); - Map toJson() => _$ApplePayCartSummaryItemToJson(this); } -@JsonSerializable(explicitToJson: true) -class ApplePayPresentParams { - ApplePayPresentParams({ - required this.cartItems, - required this.country, - required this.currency, - this.requiredBillingContactFields, - this.requiredShippingAddressFields, - this.shippingMethods, - }); - final List cartItems; - final String country; - final String currency; - final List? requiredShippingAddressFields; - final List? requiredBillingContactFields; - final List? shippingMethods; - - factory ApplePayPresentParams.fromJson(Map json) => +@freezed +class ApplePayPresentParams with _$ApplePayPresentParams { + @JsonSerializable(explicitToJson: true) + const factory ApplePayPresentParams({ + required List cartItems, + required String country, + required String currency, + List? requiredShippingAddressFields, + List? requiredBillingContactFields, + List? shippingMethods, + }) = _ApplePayPresentParams; + + factory ApplePayPresentParams.fromJson(Map json) => _$ApplePayPresentParamsFromJson(json); - Map toJson() => _$ApplePayPresentParamsToJson(this); } diff --git a/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart b/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart new file mode 100644 index 000000000..2309f53ab --- /dev/null +++ b/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart @@ -0,0 +1,741 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'apple_pay.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +ApplePayShippingMethod _$ApplePayShippingMethodFromJson( + Map json) { + return _ApplePayShippingMethod.fromJson(json); +} + +/// @nodoc +class _$ApplePayShippingMethodTearOff { + const _$ApplePayShippingMethodTearOff(); + + _ApplePayShippingMethod call( + {required String label, + required String amount, + required String identifier, + ApplePayShippingMethodType? type, + String? detail}) { + return _ApplePayShippingMethod( + label: label, + amount: amount, + identifier: identifier, + type: type, + detail: detail, + ); + } + + ApplePayShippingMethod fromJson(Map json) { + return ApplePayShippingMethod.fromJson(json); + } +} + +/// @nodoc +const $ApplePayShippingMethod = _$ApplePayShippingMethodTearOff(); + +/// @nodoc +mixin _$ApplePayShippingMethod { + String get label => throw _privateConstructorUsedError; + String get amount => throw _privateConstructorUsedError; + String get identifier => throw _privateConstructorUsedError; + ApplePayShippingMethodType? get type => throw _privateConstructorUsedError; + String? get detail => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ApplePayShippingMethodCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ApplePayShippingMethodCopyWith<$Res> { + factory $ApplePayShippingMethodCopyWith(ApplePayShippingMethod value, + $Res Function(ApplePayShippingMethod) then) = + _$ApplePayShippingMethodCopyWithImpl<$Res>; + $Res call( + {String label, + String amount, + String identifier, + ApplePayShippingMethodType? type, + String? detail}); +} + +/// @nodoc +class _$ApplePayShippingMethodCopyWithImpl<$Res> + implements $ApplePayShippingMethodCopyWith<$Res> { + _$ApplePayShippingMethodCopyWithImpl(this._value, this._then); + + final ApplePayShippingMethod _value; + // ignore: unused_field + final $Res Function(ApplePayShippingMethod) _then; + + @override + $Res call({ + Object? label = freezed, + Object? amount = freezed, + Object? identifier = freezed, + Object? type = freezed, + Object? detail = freezed, + }) { + return _then(_value.copyWith( + label: label == freezed + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as String, + identifier: identifier == freezed + ? _value.identifier + : identifier // ignore: cast_nullable_to_non_nullable + as String, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ApplePayShippingMethodType?, + detail: detail == freezed + ? _value.detail + : detail // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$ApplePayShippingMethodCopyWith<$Res> + implements $ApplePayShippingMethodCopyWith<$Res> { + factory _$ApplePayShippingMethodCopyWith(_ApplePayShippingMethod value, + $Res Function(_ApplePayShippingMethod) then) = + __$ApplePayShippingMethodCopyWithImpl<$Res>; + @override + $Res call( + {String label, + String amount, + String identifier, + ApplePayShippingMethodType? type, + String? detail}); +} + +/// @nodoc +class __$ApplePayShippingMethodCopyWithImpl<$Res> + extends _$ApplePayShippingMethodCopyWithImpl<$Res> + implements _$ApplePayShippingMethodCopyWith<$Res> { + __$ApplePayShippingMethodCopyWithImpl(_ApplePayShippingMethod _value, + $Res Function(_ApplePayShippingMethod) _then) + : super(_value, (v) => _then(v as _ApplePayShippingMethod)); + + @override + _ApplePayShippingMethod get _value => super._value as _ApplePayShippingMethod; + + @override + $Res call({ + Object? label = freezed, + Object? amount = freezed, + Object? identifier = freezed, + Object? type = freezed, + Object? detail = freezed, + }) { + return _then(_ApplePayShippingMethod( + label: label == freezed + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as String, + identifier: identifier == freezed + ? _value.identifier + : identifier // ignore: cast_nullable_to_non_nullable + as String, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ApplePayShippingMethodType?, + detail: detail == freezed + ? _value.detail + : detail // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_ApplePayShippingMethod implements _ApplePayShippingMethod { + const _$_ApplePayShippingMethod( + {required this.label, + required this.amount, + required this.identifier, + this.type, + this.detail}); + + factory _$_ApplePayShippingMethod.fromJson(Map json) => + _$_$_ApplePayShippingMethodFromJson(json); + + @override + final String label; + @override + final String amount; + @override + final String identifier; + @override + final ApplePayShippingMethodType? type; + @override + final String? detail; + + @override + String toString() { + return 'ApplePayShippingMethod(label: $label, amount: $amount, identifier: $identifier, type: $type, detail: $detail)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _ApplePayShippingMethod && + (identical(other.label, label) || + const DeepCollectionEquality().equals(other.label, label)) && + (identical(other.amount, amount) || + const DeepCollectionEquality().equals(other.amount, amount)) && + (identical(other.identifier, identifier) || + const DeepCollectionEquality() + .equals(other.identifier, identifier)) && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type)) && + (identical(other.detail, detail) || + const DeepCollectionEquality().equals(other.detail, detail))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(label) ^ + const DeepCollectionEquality().hash(amount) ^ + const DeepCollectionEquality().hash(identifier) ^ + const DeepCollectionEquality().hash(type) ^ + const DeepCollectionEquality().hash(detail); + + @JsonKey(ignore: true) + @override + _$ApplePayShippingMethodCopyWith<_ApplePayShippingMethod> get copyWith => + __$ApplePayShippingMethodCopyWithImpl<_ApplePayShippingMethod>( + this, _$identity); + + @override + Map toJson() { + return _$_$_ApplePayShippingMethodToJson(this); + } +} + +abstract class _ApplePayShippingMethod implements ApplePayShippingMethod { + const factory _ApplePayShippingMethod( + {required String label, + required String amount, + required String identifier, + ApplePayShippingMethodType? type, + String? detail}) = _$_ApplePayShippingMethod; + + factory _ApplePayShippingMethod.fromJson(Map json) = + _$_ApplePayShippingMethod.fromJson; + + @override + String get label => throw _privateConstructorUsedError; + @override + String get amount => throw _privateConstructorUsedError; + @override + String get identifier => throw _privateConstructorUsedError; + @override + ApplePayShippingMethodType? get type => throw _privateConstructorUsedError; + @override + String? get detail => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$ApplePayShippingMethodCopyWith<_ApplePayShippingMethod> get copyWith => + throw _privateConstructorUsedError; +} + +ApplePayCartSummaryItem _$ApplePayCartSummaryItemFromJson( + Map json) { + return _ApplePayCartSummaryItem.fromJson(json); +} + +/// @nodoc +class _$ApplePayCartSummaryItemTearOff { + const _$ApplePayCartSummaryItemTearOff(); + + _ApplePayCartSummaryItem call( + {required String label, required String amount}) { + return _ApplePayCartSummaryItem( + label: label, + amount: amount, + ); + } + + ApplePayCartSummaryItem fromJson(Map json) { + return ApplePayCartSummaryItem.fromJson(json); + } +} + +/// @nodoc +const $ApplePayCartSummaryItem = _$ApplePayCartSummaryItemTearOff(); + +/// @nodoc +mixin _$ApplePayCartSummaryItem { + String get label => throw _privateConstructorUsedError; + String get amount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ApplePayCartSummaryItemCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ApplePayCartSummaryItemCopyWith<$Res> { + factory $ApplePayCartSummaryItemCopyWith(ApplePayCartSummaryItem value, + $Res Function(ApplePayCartSummaryItem) then) = + _$ApplePayCartSummaryItemCopyWithImpl<$Res>; + $Res call({String label, String amount}); +} + +/// @nodoc +class _$ApplePayCartSummaryItemCopyWithImpl<$Res> + implements $ApplePayCartSummaryItemCopyWith<$Res> { + _$ApplePayCartSummaryItemCopyWithImpl(this._value, this._then); + + final ApplePayCartSummaryItem _value; + // ignore: unused_field + final $Res Function(ApplePayCartSummaryItem) _then; + + @override + $Res call({ + Object? label = freezed, + Object? amount = freezed, + }) { + return _then(_value.copyWith( + label: label == freezed + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +abstract class _$ApplePayCartSummaryItemCopyWith<$Res> + implements $ApplePayCartSummaryItemCopyWith<$Res> { + factory _$ApplePayCartSummaryItemCopyWith(_ApplePayCartSummaryItem value, + $Res Function(_ApplePayCartSummaryItem) then) = + __$ApplePayCartSummaryItemCopyWithImpl<$Res>; + @override + $Res call({String label, String amount}); +} + +/// @nodoc +class __$ApplePayCartSummaryItemCopyWithImpl<$Res> + extends _$ApplePayCartSummaryItemCopyWithImpl<$Res> + implements _$ApplePayCartSummaryItemCopyWith<$Res> { + __$ApplePayCartSummaryItemCopyWithImpl(_ApplePayCartSummaryItem _value, + $Res Function(_ApplePayCartSummaryItem) _then) + : super(_value, (v) => _then(v as _ApplePayCartSummaryItem)); + + @override + _ApplePayCartSummaryItem get _value => + super._value as _ApplePayCartSummaryItem; + + @override + $Res call({ + Object? label = freezed, + Object? amount = freezed, + }) { + return _then(_ApplePayCartSummaryItem( + label: label == freezed + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +@JsonSerializable() + +/// @nodoc +class _$_ApplePayCartSummaryItem implements _ApplePayCartSummaryItem { + const _$_ApplePayCartSummaryItem({required this.label, required this.amount}); + + factory _$_ApplePayCartSummaryItem.fromJson(Map json) => + _$_$_ApplePayCartSummaryItemFromJson(json); + + @override + final String label; + @override + final String amount; + + @override + String toString() { + return 'ApplePayCartSummaryItem(label: $label, amount: $amount)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _ApplePayCartSummaryItem && + (identical(other.label, label) || + const DeepCollectionEquality().equals(other.label, label)) && + (identical(other.amount, amount) || + const DeepCollectionEquality().equals(other.amount, amount))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(label) ^ + const DeepCollectionEquality().hash(amount); + + @JsonKey(ignore: true) + @override + _$ApplePayCartSummaryItemCopyWith<_ApplePayCartSummaryItem> get copyWith => + __$ApplePayCartSummaryItemCopyWithImpl<_ApplePayCartSummaryItem>( + this, _$identity); + + @override + Map toJson() { + return _$_$_ApplePayCartSummaryItemToJson(this); + } +} + +abstract class _ApplePayCartSummaryItem implements ApplePayCartSummaryItem { + const factory _ApplePayCartSummaryItem( + {required String label, + required String amount}) = _$_ApplePayCartSummaryItem; + + factory _ApplePayCartSummaryItem.fromJson(Map json) = + _$_ApplePayCartSummaryItem.fromJson; + + @override + String get label => throw _privateConstructorUsedError; + @override + String get amount => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$ApplePayCartSummaryItemCopyWith<_ApplePayCartSummaryItem> get copyWith => + throw _privateConstructorUsedError; +} + +ApplePayPresentParams _$ApplePayPresentParamsFromJson( + Map json) { + return _ApplePayPresentParams.fromJson(json); +} + +/// @nodoc +class _$ApplePayPresentParamsTearOff { + const _$ApplePayPresentParamsTearOff(); + + _ApplePayPresentParams call( + {required List cartItems, + required String country, + required String currency, + List? requiredShippingAddressFields, + List? requiredBillingContactFields, + List? shippingMethods}) { + return _ApplePayPresentParams( + cartItems: cartItems, + country: country, + currency: currency, + requiredShippingAddressFields: requiredShippingAddressFields, + requiredBillingContactFields: requiredBillingContactFields, + shippingMethods: shippingMethods, + ); + } + + ApplePayPresentParams fromJson(Map json) { + return ApplePayPresentParams.fromJson(json); + } +} + +/// @nodoc +const $ApplePayPresentParams = _$ApplePayPresentParamsTearOff(); + +/// @nodoc +mixin _$ApplePayPresentParams { + List get cartItems => + throw _privateConstructorUsedError; + String get country => throw _privateConstructorUsedError; + String get currency => throw _privateConstructorUsedError; + List? get requiredShippingAddressFields => + throw _privateConstructorUsedError; + List? get requiredBillingContactFields => + throw _privateConstructorUsedError; + List? get shippingMethods => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ApplePayPresentParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ApplePayPresentParamsCopyWith<$Res> { + factory $ApplePayPresentParamsCopyWith(ApplePayPresentParams value, + $Res Function(ApplePayPresentParams) then) = + _$ApplePayPresentParamsCopyWithImpl<$Res>; + $Res call( + {List cartItems, + String country, + String currency, + List? requiredShippingAddressFields, + List? requiredBillingContactFields, + List? shippingMethods}); +} + +/// @nodoc +class _$ApplePayPresentParamsCopyWithImpl<$Res> + implements $ApplePayPresentParamsCopyWith<$Res> { + _$ApplePayPresentParamsCopyWithImpl(this._value, this._then); + + final ApplePayPresentParams _value; + // ignore: unused_field + final $Res Function(ApplePayPresentParams) _then; + + @override + $Res call({ + Object? cartItems = freezed, + Object? country = freezed, + Object? currency = freezed, + Object? requiredShippingAddressFields = freezed, + Object? requiredBillingContactFields = freezed, + Object? shippingMethods = freezed, + }) { + return _then(_value.copyWith( + cartItems: cartItems == freezed + ? _value.cartItems + : cartItems // ignore: cast_nullable_to_non_nullable + as List, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + currency: currency == freezed + ? _value.currency + : currency // ignore: cast_nullable_to_non_nullable + as String, + requiredShippingAddressFields: requiredShippingAddressFields == freezed + ? _value.requiredShippingAddressFields + : requiredShippingAddressFields // ignore: cast_nullable_to_non_nullable + as List?, + requiredBillingContactFields: requiredBillingContactFields == freezed + ? _value.requiredBillingContactFields + : requiredBillingContactFields // ignore: cast_nullable_to_non_nullable + as List?, + shippingMethods: shippingMethods == freezed + ? _value.shippingMethods + : shippingMethods // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +abstract class _$ApplePayPresentParamsCopyWith<$Res> + implements $ApplePayPresentParamsCopyWith<$Res> { + factory _$ApplePayPresentParamsCopyWith(_ApplePayPresentParams value, + $Res Function(_ApplePayPresentParams) then) = + __$ApplePayPresentParamsCopyWithImpl<$Res>; + @override + $Res call( + {List cartItems, + String country, + String currency, + List? requiredShippingAddressFields, + List? requiredBillingContactFields, + List? shippingMethods}); +} + +/// @nodoc +class __$ApplePayPresentParamsCopyWithImpl<$Res> + extends _$ApplePayPresentParamsCopyWithImpl<$Res> + implements _$ApplePayPresentParamsCopyWith<$Res> { + __$ApplePayPresentParamsCopyWithImpl(_ApplePayPresentParams _value, + $Res Function(_ApplePayPresentParams) _then) + : super(_value, (v) => _then(v as _ApplePayPresentParams)); + + @override + _ApplePayPresentParams get _value => super._value as _ApplePayPresentParams; + + @override + $Res call({ + Object? cartItems = freezed, + Object? country = freezed, + Object? currency = freezed, + Object? requiredShippingAddressFields = freezed, + Object? requiredBillingContactFields = freezed, + Object? shippingMethods = freezed, + }) { + return _then(_ApplePayPresentParams( + cartItems: cartItems == freezed + ? _value.cartItems + : cartItems // ignore: cast_nullable_to_non_nullable + as List, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + currency: currency == freezed + ? _value.currency + : currency // ignore: cast_nullable_to_non_nullable + as String, + requiredShippingAddressFields: requiredShippingAddressFields == freezed + ? _value.requiredShippingAddressFields + : requiredShippingAddressFields // ignore: cast_nullable_to_non_nullable + as List?, + requiredBillingContactFields: requiredBillingContactFields == freezed + ? _value.requiredBillingContactFields + : requiredBillingContactFields // ignore: cast_nullable_to_non_nullable + as List?, + shippingMethods: shippingMethods == freezed + ? _value.shippingMethods + : shippingMethods // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_ApplePayPresentParams implements _ApplePayPresentParams { + const _$_ApplePayPresentParams( + {required this.cartItems, + required this.country, + required this.currency, + this.requiredShippingAddressFields, + this.requiredBillingContactFields, + this.shippingMethods}); + + factory _$_ApplePayPresentParams.fromJson(Map json) => + _$_$_ApplePayPresentParamsFromJson(json); + + @override + final List cartItems; + @override + final String country; + @override + final String currency; + @override + final List? requiredShippingAddressFields; + @override + final List? requiredBillingContactFields; + @override + final List? shippingMethods; + + @override + String toString() { + return 'ApplePayPresentParams(cartItems: $cartItems, country: $country, currency: $currency, requiredShippingAddressFields: $requiredShippingAddressFields, requiredBillingContactFields: $requiredBillingContactFields, shippingMethods: $shippingMethods)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _ApplePayPresentParams && + (identical(other.cartItems, cartItems) || + const DeepCollectionEquality() + .equals(other.cartItems, cartItems)) && + (identical(other.country, country) || + const DeepCollectionEquality() + .equals(other.country, country)) && + (identical(other.currency, currency) || + const DeepCollectionEquality() + .equals(other.currency, currency)) && + (identical(other.requiredShippingAddressFields, + requiredShippingAddressFields) || + const DeepCollectionEquality().equals( + other.requiredShippingAddressFields, + requiredShippingAddressFields)) && + (identical(other.requiredBillingContactFields, + requiredBillingContactFields) || + const DeepCollectionEquality().equals( + other.requiredBillingContactFields, + requiredBillingContactFields)) && + (identical(other.shippingMethods, shippingMethods) || + const DeepCollectionEquality() + .equals(other.shippingMethods, shippingMethods))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(cartItems) ^ + const DeepCollectionEquality().hash(country) ^ + const DeepCollectionEquality().hash(currency) ^ + const DeepCollectionEquality().hash(requiredShippingAddressFields) ^ + const DeepCollectionEquality().hash(requiredBillingContactFields) ^ + const DeepCollectionEquality().hash(shippingMethods); + + @JsonKey(ignore: true) + @override + _$ApplePayPresentParamsCopyWith<_ApplePayPresentParams> get copyWith => + __$ApplePayPresentParamsCopyWithImpl<_ApplePayPresentParams>( + this, _$identity); + + @override + Map toJson() { + return _$_$_ApplePayPresentParamsToJson(this); + } +} + +abstract class _ApplePayPresentParams implements ApplePayPresentParams { + const factory _ApplePayPresentParams( + {required List cartItems, + required String country, + required String currency, + List? requiredShippingAddressFields, + List? requiredBillingContactFields, + List? shippingMethods}) = + _$_ApplePayPresentParams; + + factory _ApplePayPresentParams.fromJson(Map json) = + _$_ApplePayPresentParams.fromJson; + + @override + List get cartItems => + throw _privateConstructorUsedError; + @override + String get country => throw _privateConstructorUsedError; + @override + String get currency => throw _privateConstructorUsedError; + @override + List? get requiredShippingAddressFields => + throw _privateConstructorUsedError; + @override + List? get requiredBillingContactFields => + throw _privateConstructorUsedError; + @override + List? get shippingMethods => + throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$ApplePayPresentParamsCopyWith<_ApplePayPresentParams> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/apple_pay.g.dart b/stripe_platform_interface/lib/src/models/apple_pay.g.dart index 4aea29f06..8798a567f 100644 --- a/stripe_platform_interface/lib/src/models/apple_pay.g.dart +++ b/stripe_platform_interface/lib/src/models/apple_pay.g.dart @@ -6,9 +6,9 @@ part of 'apple_pay.dart'; // JsonSerializableGenerator // ************************************************************************** -ApplePayShippingMethod _$ApplePayShippingMethodFromJson( +_$_ApplePayShippingMethod _$_$_ApplePayShippingMethodFromJson( Map json) { - return ApplePayShippingMethod( + return _$_ApplePayShippingMethod( label: json['label'] as String, amount: json['amount'] as String, identifier: json['identifier'] as String, @@ -18,13 +18,13 @@ ApplePayShippingMethod _$ApplePayShippingMethodFromJson( ); } -Map _$ApplePayShippingMethodToJson( - ApplePayShippingMethod instance) => +Map _$_$_ApplePayShippingMethodToJson( + _$_ApplePayShippingMethod instance) => { 'label': instance.label, 'amount': instance.amount, - 'type': _$ApplePayShippingMethodTypeEnumMap[instance.type], 'identifier': instance.identifier, + 'type': _$ApplePayShippingMethodTypeEnumMap[instance.type], 'detail': instance.detail, }; @@ -70,45 +70,45 @@ const _$ApplePayShippingMethodTypeEnumMap = { ApplePayShippingMethodType.pending: 'pending', }; -ApplePayCartSummaryItem _$ApplePayCartSummaryItemFromJson( +_$_ApplePayCartSummaryItem _$_$_ApplePayCartSummaryItemFromJson( Map json) { - return ApplePayCartSummaryItem( + return _$_ApplePayCartSummaryItem( label: json['label'] as String, amount: json['amount'] as String, ); } -Map _$ApplePayCartSummaryItemToJson( - ApplePayCartSummaryItem instance) => +Map _$_$_ApplePayCartSummaryItemToJson( + _$_ApplePayCartSummaryItem instance) => { 'label': instance.label, 'amount': instance.amount, }; -ApplePayPresentParams _$ApplePayPresentParamsFromJson( +_$_ApplePayPresentParams _$_$_ApplePayPresentParamsFromJson( Map json) { - return ApplePayPresentParams( + return _$_ApplePayPresentParams( cartItems: (json['cartItems'] as List) .map((e) => ApplePayCartSummaryItem.fromJson(e as Map)) .toList(), country: json['country'] as String, currency: json['currency'] as String, - requiredBillingContactFields: - (json['requiredBillingContactFields'] as List?) - ?.map((e) => _$enumDecode(_$ApplePayContactFieldsTypeEnumMap, e)) - .toList(), requiredShippingAddressFields: (json['requiredShippingAddressFields'] as List?) ?.map((e) => _$enumDecode(_$ApplePayContactFieldsTypeEnumMap, e)) .toList(), + requiredBillingContactFields: + (json['requiredBillingContactFields'] as List?) + ?.map((e) => _$enumDecode(_$ApplePayContactFieldsTypeEnumMap, e)) + .toList(), shippingMethods: (json['shippingMethods'] as List?) ?.map((e) => ApplePayShippingMethod.fromJson(e as Map)) .toList(), ); } -Map _$ApplePayPresentParamsToJson( - ApplePayPresentParams instance) => +Map _$_$_ApplePayPresentParamsToJson( + _$_ApplePayPresentParams instance) => { 'cartItems': instance.cartItems.map((e) => e.toJson()).toList(), 'country': instance.country, diff --git a/stripe_platform_interface/lib/src/models/card_field_input.dart b/stripe_platform_interface/lib/src/models/card_field_input.dart index 85d710ca7..d4531455d 100644 --- a/stripe_platform_interface/lib/src/models/card_field_input.dart +++ b/stripe_platform_interface/lib/src/models/card_field_input.dart @@ -1,42 +1,27 @@ -import 'package:equatable/equatable.dart'; import 'package:flutter/painting.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; part 'card_field_input.g.dart'; - -@JsonSerializable() -class CardDecoration extends Equatable { - - CardDecoration( { - this.backgroundColor, - this.textColor, - this.borderColor, - this.borderWidth, - this.textErrorColor, - this.borderRadius, - }); - - @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - final Color? backgroundColor; - - @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - final Color? textColor; - - @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - final Color? borderColor; - - final double? borderWidth; - final double? borderRadius; - - @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) - final Color? textErrorColor; - - @override - List get props => [backgroundColor, textColor,borderColor, textErrorColor, borderWidth ]; +part 'card_field_input.freezed.dart'; + +@freezed +class CardDecoration with _$CardDecoration { + @JsonSerializable(explicitToJson: true) + factory CardDecoration({ + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? borderColor, + double? borderWidth, + double? borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textErrorColor, + }) = _CardDecoration; factory CardDecoration.fromJson(Map json) => _$CardDecorationFromJson(json); - Map toJson() => _$CardDecorationToJson(this); - } class ColorKey { @@ -54,38 +39,30 @@ class ColorKey { } } -@JsonSerializable() -class CardFieldInputDetails { - CardFieldInputDetails({ - required this.last4, - required this.expiryMonth, - required this.expiryYear, - this.postalCode, - required this.brand, - required this.complete, - }); - - final String last4; - final int expiryMonth; - final int expiryYear; - final String? postalCode; - final CardBrand brand; - final bool complete; +@freezed +class CardFieldInputDetails with _$CardFieldInputDetails { + @JsonSerializable(explicitToJson: true) + const factory CardFieldInputDetails({ + required String last4, + required int expiryMonth, + required int expiryYear, + required CardBrand brand, + required bool complete, + required String? postalCode, + }) = _CardFieldInputDetails; factory CardFieldInputDetails.fromJson(Map json) => _$CardFieldInputDetailsFromJson(json); - Map toJson() => _$CardFieldInputDetailsToJson(this); } -@JsonSerializable() -class CardFieldFocusName { - final CardFieldName? focusedField; - - CardFieldFocusName(this.focusedField); +@freezed +class CardFieldFocusName with _$CardFieldFocusName { + @JsonSerializable(explicitToJson: true) + factory CardFieldFocusName({CardFieldName? focusedField}) = + _CardFieldFocusName; factory CardFieldFocusName.fromJson(Map json) => _$CardFieldFocusNameFromJson(json); - Map toJson() => _$CardFieldFocusNameToJson(this); } enum CardFieldName { diff --git a/stripe_platform_interface/lib/src/models/card_field_input.freezed.dart b/stripe_platform_interface/lib/src/models/card_field_input.freezed.dart new file mode 100644 index 000000000..3343335e7 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/card_field_input.freezed.dart @@ -0,0 +1,761 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'card_field_input.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +CardDecoration _$CardDecorationFromJson(Map json) { + return _CardDecoration.fromJson(json); +} + +/// @nodoc +class _$CardDecorationTearOff { + const _$CardDecorationTearOff(); + + _CardDecoration call( + {@JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? borderColor, + double? borderWidth, + double? borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textErrorColor}) { + return _CardDecoration( + backgroundColor: backgroundColor, + textColor: textColor, + borderColor: borderColor, + borderWidth: borderWidth, + borderRadius: borderRadius, + textErrorColor: textErrorColor, + ); + } + + CardDecoration fromJson(Map json) { + return CardDecoration.fromJson(json); + } +} + +/// @nodoc +const $CardDecoration = _$CardDecorationTearOff(); + +/// @nodoc +mixin _$CardDecoration { + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get backgroundColor => throw _privateConstructorUsedError; + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get textColor => throw _privateConstructorUsedError; + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get borderColor => throw _privateConstructorUsedError; + double? get borderWidth => throw _privateConstructorUsedError; + double? get borderRadius => throw _privateConstructorUsedError; + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get textErrorColor => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CardDecorationCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CardDecorationCopyWith<$Res> { + factory $CardDecorationCopyWith( + CardDecoration value, $Res Function(CardDecoration) then) = + _$CardDecorationCopyWithImpl<$Res>; + $Res call( + {@JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? borderColor, + double? borderWidth, + double? borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textErrorColor}); +} + +/// @nodoc +class _$CardDecorationCopyWithImpl<$Res> + implements $CardDecorationCopyWith<$Res> { + _$CardDecorationCopyWithImpl(this._value, this._then); + + final CardDecoration _value; + // ignore: unused_field + final $Res Function(CardDecoration) _then; + + @override + $Res call({ + Object? backgroundColor = freezed, + Object? textColor = freezed, + Object? borderColor = freezed, + Object? borderWidth = freezed, + Object? borderRadius = freezed, + Object? textErrorColor = freezed, + }) { + return _then(_value.copyWith( + backgroundColor: backgroundColor == freezed + ? _value.backgroundColor + : backgroundColor // ignore: cast_nullable_to_non_nullable + as Color?, + textColor: textColor == freezed + ? _value.textColor + : textColor // ignore: cast_nullable_to_non_nullable + as Color?, + borderColor: borderColor == freezed + ? _value.borderColor + : borderColor // ignore: cast_nullable_to_non_nullable + as Color?, + borderWidth: borderWidth == freezed + ? _value.borderWidth + : borderWidth // ignore: cast_nullable_to_non_nullable + as double?, + borderRadius: borderRadius == freezed + ? _value.borderRadius + : borderRadius // ignore: cast_nullable_to_non_nullable + as double?, + textErrorColor: textErrorColor == freezed + ? _value.textErrorColor + : textErrorColor // ignore: cast_nullable_to_non_nullable + as Color?, + )); + } +} + +/// @nodoc +abstract class _$CardDecorationCopyWith<$Res> + implements $CardDecorationCopyWith<$Res> { + factory _$CardDecorationCopyWith( + _CardDecoration value, $Res Function(_CardDecoration) then) = + __$CardDecorationCopyWithImpl<$Res>; + @override + $Res call( + {@JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? borderColor, + double? borderWidth, + double? borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textErrorColor}); +} + +/// @nodoc +class __$CardDecorationCopyWithImpl<$Res> + extends _$CardDecorationCopyWithImpl<$Res> + implements _$CardDecorationCopyWith<$Res> { + __$CardDecorationCopyWithImpl( + _CardDecoration _value, $Res Function(_CardDecoration) _then) + : super(_value, (v) => _then(v as _CardDecoration)); + + @override + _CardDecoration get _value => super._value as _CardDecoration; + + @override + $Res call({ + Object? backgroundColor = freezed, + Object? textColor = freezed, + Object? borderColor = freezed, + Object? borderWidth = freezed, + Object? borderRadius = freezed, + Object? textErrorColor = freezed, + }) { + return _then(_CardDecoration( + backgroundColor: backgroundColor == freezed + ? _value.backgroundColor + : backgroundColor // ignore: cast_nullable_to_non_nullable + as Color?, + textColor: textColor == freezed + ? _value.textColor + : textColor // ignore: cast_nullable_to_non_nullable + as Color?, + borderColor: borderColor == freezed + ? _value.borderColor + : borderColor // ignore: cast_nullable_to_non_nullable + as Color?, + borderWidth: borderWidth == freezed + ? _value.borderWidth + : borderWidth // ignore: cast_nullable_to_non_nullable + as double?, + borderRadius: borderRadius == freezed + ? _value.borderRadius + : borderRadius // ignore: cast_nullable_to_non_nullable + as double?, + textErrorColor: textErrorColor == freezed + ? _value.textErrorColor + : textErrorColor // ignore: cast_nullable_to_non_nullable + as Color?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_CardDecoration implements _CardDecoration { + _$_CardDecoration( + {@JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + this.backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + this.textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + this.borderColor, + this.borderWidth, + this.borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + this.textErrorColor}); + + factory _$_CardDecoration.fromJson(Map json) => + _$_$_CardDecorationFromJson(json); + + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + final Color? backgroundColor; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + final Color? textColor; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + final Color? borderColor; + @override + final double? borderWidth; + @override + final double? borderRadius; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + final Color? textErrorColor; + + @override + String toString() { + return 'CardDecoration(backgroundColor: $backgroundColor, textColor: $textColor, borderColor: $borderColor, borderWidth: $borderWidth, borderRadius: $borderRadius, textErrorColor: $textErrorColor)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _CardDecoration && + (identical(other.backgroundColor, backgroundColor) || + const DeepCollectionEquality() + .equals(other.backgroundColor, backgroundColor)) && + (identical(other.textColor, textColor) || + const DeepCollectionEquality() + .equals(other.textColor, textColor)) && + (identical(other.borderColor, borderColor) || + const DeepCollectionEquality() + .equals(other.borderColor, borderColor)) && + (identical(other.borderWidth, borderWidth) || + const DeepCollectionEquality() + .equals(other.borderWidth, borderWidth)) && + (identical(other.borderRadius, borderRadius) || + const DeepCollectionEquality() + .equals(other.borderRadius, borderRadius)) && + (identical(other.textErrorColor, textErrorColor) || + const DeepCollectionEquality() + .equals(other.textErrorColor, textErrorColor))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(backgroundColor) ^ + const DeepCollectionEquality().hash(textColor) ^ + const DeepCollectionEquality().hash(borderColor) ^ + const DeepCollectionEquality().hash(borderWidth) ^ + const DeepCollectionEquality().hash(borderRadius) ^ + const DeepCollectionEquality().hash(textErrorColor); + + @JsonKey(ignore: true) + @override + _$CardDecorationCopyWith<_CardDecoration> get copyWith => + __$CardDecorationCopyWithImpl<_CardDecoration>(this, _$identity); + + @override + Map toJson() { + return _$_$_CardDecorationToJson(this); + } +} + +abstract class _CardDecoration implements CardDecoration { + factory _CardDecoration( + {@JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? backgroundColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textColor, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? borderColor, + double? borderWidth, + double? borderRadius, + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? textErrorColor}) = _$_CardDecoration; + + factory _CardDecoration.fromJson(Map json) = + _$_CardDecoration.fromJson; + + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get backgroundColor => throw _privateConstructorUsedError; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get textColor => throw _privateConstructorUsedError; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get borderColor => throw _privateConstructorUsedError; + @override + double? get borderWidth => throw _privateConstructorUsedError; + @override + double? get borderRadius => throw _privateConstructorUsedError; + @override + @JsonKey(toJson: ColorKey.toJson, fromJson: ColorKey.fromJson) + Color? get textErrorColor => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$CardDecorationCopyWith<_CardDecoration> get copyWith => + throw _privateConstructorUsedError; +} + +CardFieldInputDetails _$CardFieldInputDetailsFromJson( + Map json) { + return _CardFieldInputDetails.fromJson(json); +} + +/// @nodoc +class _$CardFieldInputDetailsTearOff { + const _$CardFieldInputDetailsTearOff(); + + _CardFieldInputDetails call( + {required String last4, + required int expiryMonth, + required int expiryYear, + required CardBrand brand, + required bool complete, + required String? postalCode}) { + return _CardFieldInputDetails( + last4: last4, + expiryMonth: expiryMonth, + expiryYear: expiryYear, + brand: brand, + complete: complete, + postalCode: postalCode, + ); + } + + CardFieldInputDetails fromJson(Map json) { + return CardFieldInputDetails.fromJson(json); + } +} + +/// @nodoc +const $CardFieldInputDetails = _$CardFieldInputDetailsTearOff(); + +/// @nodoc +mixin _$CardFieldInputDetails { + String get last4 => throw _privateConstructorUsedError; + int get expiryMonth => throw _privateConstructorUsedError; + int get expiryYear => throw _privateConstructorUsedError; + CardBrand get brand => throw _privateConstructorUsedError; + bool get complete => throw _privateConstructorUsedError; + String? get postalCode => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CardFieldInputDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CardFieldInputDetailsCopyWith<$Res> { + factory $CardFieldInputDetailsCopyWith(CardFieldInputDetails value, + $Res Function(CardFieldInputDetails) then) = + _$CardFieldInputDetailsCopyWithImpl<$Res>; + $Res call( + {String last4, + int expiryMonth, + int expiryYear, + CardBrand brand, + bool complete, + String? postalCode}); +} + +/// @nodoc +class _$CardFieldInputDetailsCopyWithImpl<$Res> + implements $CardFieldInputDetailsCopyWith<$Res> { + _$CardFieldInputDetailsCopyWithImpl(this._value, this._then); + + final CardFieldInputDetails _value; + // ignore: unused_field + final $Res Function(CardFieldInputDetails) _then; + + @override + $Res call({ + Object? last4 = freezed, + Object? expiryMonth = freezed, + Object? expiryYear = freezed, + Object? brand = freezed, + Object? complete = freezed, + Object? postalCode = freezed, + }) { + return _then(_value.copyWith( + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String, + expiryMonth: expiryMonth == freezed + ? _value.expiryMonth + : expiryMonth // ignore: cast_nullable_to_non_nullable + as int, + expiryYear: expiryYear == freezed + ? _value.expiryYear + : expiryYear // ignore: cast_nullable_to_non_nullable + as int, + brand: brand == freezed + ? _value.brand + : brand // ignore: cast_nullable_to_non_nullable + as CardBrand, + complete: complete == freezed + ? _value.complete + : complete // ignore: cast_nullable_to_non_nullable + as bool, + postalCode: postalCode == freezed + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$CardFieldInputDetailsCopyWith<$Res> + implements $CardFieldInputDetailsCopyWith<$Res> { + factory _$CardFieldInputDetailsCopyWith(_CardFieldInputDetails value, + $Res Function(_CardFieldInputDetails) then) = + __$CardFieldInputDetailsCopyWithImpl<$Res>; + @override + $Res call( + {String last4, + int expiryMonth, + int expiryYear, + CardBrand brand, + bool complete, + String? postalCode}); +} + +/// @nodoc +class __$CardFieldInputDetailsCopyWithImpl<$Res> + extends _$CardFieldInputDetailsCopyWithImpl<$Res> + implements _$CardFieldInputDetailsCopyWith<$Res> { + __$CardFieldInputDetailsCopyWithImpl(_CardFieldInputDetails _value, + $Res Function(_CardFieldInputDetails) _then) + : super(_value, (v) => _then(v as _CardFieldInputDetails)); + + @override + _CardFieldInputDetails get _value => super._value as _CardFieldInputDetails; + + @override + $Res call({ + Object? last4 = freezed, + Object? expiryMonth = freezed, + Object? expiryYear = freezed, + Object? brand = freezed, + Object? complete = freezed, + Object? postalCode = freezed, + }) { + return _then(_CardFieldInputDetails( + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String, + expiryMonth: expiryMonth == freezed + ? _value.expiryMonth + : expiryMonth // ignore: cast_nullable_to_non_nullable + as int, + expiryYear: expiryYear == freezed + ? _value.expiryYear + : expiryYear // ignore: cast_nullable_to_non_nullable + as int, + brand: brand == freezed + ? _value.brand + : brand // ignore: cast_nullable_to_non_nullable + as CardBrand, + complete: complete == freezed + ? _value.complete + : complete // ignore: cast_nullable_to_non_nullable + as bool, + postalCode: postalCode == freezed + ? _value.postalCode + : postalCode // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_CardFieldInputDetails implements _CardFieldInputDetails { + const _$_CardFieldInputDetails( + {required this.last4, + required this.expiryMonth, + required this.expiryYear, + required this.brand, + required this.complete, + required this.postalCode}); + + factory _$_CardFieldInputDetails.fromJson(Map json) => + _$_$_CardFieldInputDetailsFromJson(json); + + @override + final String last4; + @override + final int expiryMonth; + @override + final int expiryYear; + @override + final CardBrand brand; + @override + final bool complete; + @override + final String? postalCode; + + @override + String toString() { + return 'CardFieldInputDetails(last4: $last4, expiryMonth: $expiryMonth, expiryYear: $expiryYear, brand: $brand, complete: $complete, postalCode: $postalCode)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _CardFieldInputDetails && + (identical(other.last4, last4) || + const DeepCollectionEquality().equals(other.last4, last4)) && + (identical(other.expiryMonth, expiryMonth) || + const DeepCollectionEquality() + .equals(other.expiryMonth, expiryMonth)) && + (identical(other.expiryYear, expiryYear) || + const DeepCollectionEquality() + .equals(other.expiryYear, expiryYear)) && + (identical(other.brand, brand) || + const DeepCollectionEquality().equals(other.brand, brand)) && + (identical(other.complete, complete) || + const DeepCollectionEquality() + .equals(other.complete, complete)) && + (identical(other.postalCode, postalCode) || + const DeepCollectionEquality() + .equals(other.postalCode, postalCode))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(last4) ^ + const DeepCollectionEquality().hash(expiryMonth) ^ + const DeepCollectionEquality().hash(expiryYear) ^ + const DeepCollectionEquality().hash(brand) ^ + const DeepCollectionEquality().hash(complete) ^ + const DeepCollectionEquality().hash(postalCode); + + @JsonKey(ignore: true) + @override + _$CardFieldInputDetailsCopyWith<_CardFieldInputDetails> get copyWith => + __$CardFieldInputDetailsCopyWithImpl<_CardFieldInputDetails>( + this, _$identity); + + @override + Map toJson() { + return _$_$_CardFieldInputDetailsToJson(this); + } +} + +abstract class _CardFieldInputDetails implements CardFieldInputDetails { + const factory _CardFieldInputDetails( + {required String last4, + required int expiryMonth, + required int expiryYear, + required CardBrand brand, + required bool complete, + required String? postalCode}) = _$_CardFieldInputDetails; + + factory _CardFieldInputDetails.fromJson(Map json) = + _$_CardFieldInputDetails.fromJson; + + @override + String get last4 => throw _privateConstructorUsedError; + @override + int get expiryMonth => throw _privateConstructorUsedError; + @override + int get expiryYear => throw _privateConstructorUsedError; + @override + CardBrand get brand => throw _privateConstructorUsedError; + @override + bool get complete => throw _privateConstructorUsedError; + @override + String? get postalCode => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$CardFieldInputDetailsCopyWith<_CardFieldInputDetails> get copyWith => + throw _privateConstructorUsedError; +} + +CardFieldFocusName _$CardFieldFocusNameFromJson(Map json) { + return _CardFieldFocusName.fromJson(json); +} + +/// @nodoc +class _$CardFieldFocusNameTearOff { + const _$CardFieldFocusNameTearOff(); + + _CardFieldFocusName call({CardFieldName? focusedField}) { + return _CardFieldFocusName( + focusedField: focusedField, + ); + } + + CardFieldFocusName fromJson(Map json) { + return CardFieldFocusName.fromJson(json); + } +} + +/// @nodoc +const $CardFieldFocusName = _$CardFieldFocusNameTearOff(); + +/// @nodoc +mixin _$CardFieldFocusName { + CardFieldName? get focusedField => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CardFieldFocusNameCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CardFieldFocusNameCopyWith<$Res> { + factory $CardFieldFocusNameCopyWith( + CardFieldFocusName value, $Res Function(CardFieldFocusName) then) = + _$CardFieldFocusNameCopyWithImpl<$Res>; + $Res call({CardFieldName? focusedField}); +} + +/// @nodoc +class _$CardFieldFocusNameCopyWithImpl<$Res> + implements $CardFieldFocusNameCopyWith<$Res> { + _$CardFieldFocusNameCopyWithImpl(this._value, this._then); + + final CardFieldFocusName _value; + // ignore: unused_field + final $Res Function(CardFieldFocusName) _then; + + @override + $Res call({ + Object? focusedField = freezed, + }) { + return _then(_value.copyWith( + focusedField: focusedField == freezed + ? _value.focusedField + : focusedField // ignore: cast_nullable_to_non_nullable + as CardFieldName?, + )); + } +} + +/// @nodoc +abstract class _$CardFieldFocusNameCopyWith<$Res> + implements $CardFieldFocusNameCopyWith<$Res> { + factory _$CardFieldFocusNameCopyWith( + _CardFieldFocusName value, $Res Function(_CardFieldFocusName) then) = + __$CardFieldFocusNameCopyWithImpl<$Res>; + @override + $Res call({CardFieldName? focusedField}); +} + +/// @nodoc +class __$CardFieldFocusNameCopyWithImpl<$Res> + extends _$CardFieldFocusNameCopyWithImpl<$Res> + implements _$CardFieldFocusNameCopyWith<$Res> { + __$CardFieldFocusNameCopyWithImpl( + _CardFieldFocusName _value, $Res Function(_CardFieldFocusName) _then) + : super(_value, (v) => _then(v as _CardFieldFocusName)); + + @override + _CardFieldFocusName get _value => super._value as _CardFieldFocusName; + + @override + $Res call({ + Object? focusedField = freezed, + }) { + return _then(_CardFieldFocusName( + focusedField: focusedField == freezed + ? _value.focusedField + : focusedField // ignore: cast_nullable_to_non_nullable + as CardFieldName?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_CardFieldFocusName implements _CardFieldFocusName { + _$_CardFieldFocusName({this.focusedField}); + + factory _$_CardFieldFocusName.fromJson(Map json) => + _$_$_CardFieldFocusNameFromJson(json); + + @override + final CardFieldName? focusedField; + + @override + String toString() { + return 'CardFieldFocusName(focusedField: $focusedField)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _CardFieldFocusName && + (identical(other.focusedField, focusedField) || + const DeepCollectionEquality() + .equals(other.focusedField, focusedField))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ const DeepCollectionEquality().hash(focusedField); + + @JsonKey(ignore: true) + @override + _$CardFieldFocusNameCopyWith<_CardFieldFocusName> get copyWith => + __$CardFieldFocusNameCopyWithImpl<_CardFieldFocusName>(this, _$identity); + + @override + Map toJson() { + return _$_$_CardFieldFocusNameToJson(this); + } +} + +abstract class _CardFieldFocusName implements CardFieldFocusName { + factory _CardFieldFocusName({CardFieldName? focusedField}) = + _$_CardFieldFocusName; + + factory _CardFieldFocusName.fromJson(Map json) = + _$_CardFieldFocusName.fromJson; + + @override + CardFieldName? get focusedField => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$CardFieldFocusNameCopyWith<_CardFieldFocusName> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/card_field_input.g.dart b/stripe_platform_interface/lib/src/models/card_field_input.g.dart index 635f52af6..3f95439ee 100644 --- a/stripe_platform_interface/lib/src/models/card_field_input.g.dart +++ b/stripe_platform_interface/lib/src/models/card_field_input.g.dart @@ -6,18 +6,18 @@ part of 'card_field_input.dart'; // JsonSerializableGenerator // ************************************************************************** -CardDecoration _$CardDecorationFromJson(Map json) { - return CardDecoration( +_$_CardDecoration _$_$_CardDecorationFromJson(Map json) { + return _$_CardDecoration( backgroundColor: ColorKey.fromJson(json['backgroundColor']), textColor: ColorKey.fromJson(json['textColor']), borderColor: ColorKey.fromJson(json['borderColor']), borderWidth: (json['borderWidth'] as num?)?.toDouble(), - textErrorColor: ColorKey.fromJson(json['textErrorColor']), borderRadius: (json['borderRadius'] as num?)?.toDouble(), + textErrorColor: ColorKey.fromJson(json['textErrorColor']), ); } -Map _$CardDecorationToJson(CardDecoration instance) => +Map _$_$_CardDecorationToJson(_$_CardDecoration instance) => { 'backgroundColor': ColorKey.toJson(instance.backgroundColor), 'textColor': ColorKey.toJson(instance.textColor), @@ -27,27 +27,27 @@ Map _$CardDecorationToJson(CardDecoration instance) => 'textErrorColor': ColorKey.toJson(instance.textErrorColor), }; -CardFieldInputDetails _$CardFieldInputDetailsFromJson( +_$_CardFieldInputDetails _$_$_CardFieldInputDetailsFromJson( Map json) { - return CardFieldInputDetails( + return _$_CardFieldInputDetails( last4: json['last4'] as String, expiryMonth: json['expiryMonth'] as int, expiryYear: json['expiryYear'] as int, - postalCode: json['postalCode'] as String?, brand: _$enumDecode(_$CardBrandEnumMap, json['brand']), complete: json['complete'] as bool, + postalCode: json['postalCode'] as String?, ); } -Map _$CardFieldInputDetailsToJson( - CardFieldInputDetails instance) => +Map _$_$_CardFieldInputDetailsToJson( + _$_CardFieldInputDetails instance) => { 'last4': instance.last4, 'expiryMonth': instance.expiryMonth, 'expiryYear': instance.expiryYear, - 'postalCode': instance.postalCode, 'brand': _$CardBrandEnumMap[instance.brand], 'complete': instance.complete, + 'postalCode': instance.postalCode, }; K _$enumDecode( @@ -87,13 +87,16 @@ const _$CardBrandEnumMap = { CardBrand.unknown: 'unknown', }; -CardFieldFocusName _$CardFieldFocusNameFromJson(Map json) { - return CardFieldFocusName( - _$enumDecodeNullable(_$CardFieldNameEnumMap, json['focusedField']), +_$_CardFieldFocusName _$_$_CardFieldFocusNameFromJson( + Map json) { + return _$_CardFieldFocusName( + focusedField: + _$enumDecodeNullable(_$CardFieldNameEnumMap, json['focusedField']), ); } -Map _$CardFieldFocusNameToJson(CardFieldFocusName instance) => +Map _$_$_CardFieldFocusNameToJson( + _$_CardFieldFocusName instance) => { 'focusedField': _$CardFieldNameEnumMap[instance.focusedField], }; diff --git a/stripe_platform_interface/lib/src/models/errors.dart b/stripe_platform_interface/lib/src/models/errors.dart index 3df64cd37..465447e05 100644 --- a/stripe_platform_interface/lib/src/models/errors.dart +++ b/stripe_platform_interface/lib/src/models/errors.dart @@ -1,3 +1,9 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../models.dart'; + +part 'errors.freezed.dart'; + enum ConfirmPaymentError { canceled, failed, unkown } enum CardActionError { canceled, failed, unkown } @@ -9,9 +15,28 @@ enum RetrievePaymentIntentError { canceled } enum ApplePayError { canceled, failed, unkown } -class StripeError { - final String message; - final T code; +@freezed +class StripeError with _$StripeError { + const factory StripeError.generic({ + required String message, + required T code, + }) = _StripeErrorGeneric; + + const factory StripeError.lastPayment({ + required String code, + required LastPaymentErrorType type, + required PaymentMethod paymentMethod, + required String message, + }) = _StripeErrorLastPayment; +} - StripeError(this.code, this.message); +enum LastPaymentErrorType { + ApiConnection, + Api, + Authentication, + Card, + Idempotency, + InvalidRequest, + RateLimit, + Unknown } diff --git a/stripe_platform_interface/lib/src/models/errors.freezed.dart b/stripe_platform_interface/lib/src/models/errors.freezed.dart new file mode 100644 index 000000000..2af2e1232 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/errors.freezed.dart @@ -0,0 +1,432 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'errors.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +class _$StripeErrorTearOff { + const _$StripeErrorTearOff(); + + _StripeErrorGeneric generic( + {required String message, required T code}) { + return _StripeErrorGeneric( + message: message, + code: code, + ); + } + + _StripeErrorLastPayment lastPayment( + {required String code, + required LastPaymentErrorType type, + required PaymentMethod paymentMethod, + required String message}) { + return _StripeErrorLastPayment( + code: code, + type: type, + paymentMethod: paymentMethod, + message: message, + ); + } +} + +/// @nodoc +const $StripeError = _$StripeErrorTearOff(); + +/// @nodoc +mixin _$StripeError { + String get message => throw _privateConstructorUsedError; + + @optionalTypeArgs + TResult when({ + required TResult Function(String message, T code) generic, + required TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message) + lastPayment, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String message, T code)? generic, + TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message)? + lastPayment, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(_StripeErrorGeneric value) generic, + required TResult Function(_StripeErrorLastPayment value) lastPayment, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_StripeErrorGeneric value)? generic, + TResult Function(_StripeErrorLastPayment value)? lastPayment, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $StripeErrorCopyWith> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $StripeErrorCopyWith { + factory $StripeErrorCopyWith( + StripeError value, $Res Function(StripeError) then) = + _$StripeErrorCopyWithImpl; + $Res call({String message}); +} + +/// @nodoc +class _$StripeErrorCopyWithImpl + implements $StripeErrorCopyWith { + _$StripeErrorCopyWithImpl(this._value, this._then); + + final StripeError _value; + // ignore: unused_field + final $Res Function(StripeError) _then; + + @override + $Res call({ + Object? message = freezed, + }) { + return _then(_value.copyWith( + message: message == freezed + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +abstract class _$StripeErrorGenericCopyWith + implements $StripeErrorCopyWith { + factory _$StripeErrorGenericCopyWith(_StripeErrorGeneric value, + $Res Function(_StripeErrorGeneric) then) = + __$StripeErrorGenericCopyWithImpl; + @override + $Res call({String message, T code}); +} + +/// @nodoc +class __$StripeErrorGenericCopyWithImpl + extends _$StripeErrorCopyWithImpl + implements _$StripeErrorGenericCopyWith { + __$StripeErrorGenericCopyWithImpl(_StripeErrorGeneric _value, + $Res Function(_StripeErrorGeneric) _then) + : super(_value, (v) => _then(v as _StripeErrorGeneric)); + + @override + _StripeErrorGeneric get _value => super._value as _StripeErrorGeneric; + + @override + $Res call({ + Object? message = freezed, + Object? code = freezed, + }) { + return _then(_StripeErrorGeneric( + message: message == freezed + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + code: code == freezed + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as T, + )); + } +} + +/// @nodoc +class _$_StripeErrorGeneric implements _StripeErrorGeneric { + const _$_StripeErrorGeneric({required this.message, required this.code}); + + @override + final String message; + @override + final T code; + + @override + String toString() { + return 'StripeError<$T>.generic(message: $message, code: $code)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _StripeErrorGeneric && + (identical(other.message, message) || + const DeepCollectionEquality() + .equals(other.message, message)) && + (identical(other.code, code) || + const DeepCollectionEquality().equals(other.code, code))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(message) ^ + const DeepCollectionEquality().hash(code); + + @JsonKey(ignore: true) + @override + _$StripeErrorGenericCopyWith> get copyWith => + __$StripeErrorGenericCopyWithImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String message, T code) generic, + required TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message) + lastPayment, + }) { + return generic(message, code); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String message, T code)? generic, + TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message)? + lastPayment, + required TResult orElse(), + }) { + if (generic != null) { + return generic(message, code); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_StripeErrorGeneric value) generic, + required TResult Function(_StripeErrorLastPayment value) lastPayment, + }) { + return generic(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_StripeErrorGeneric value)? generic, + TResult Function(_StripeErrorLastPayment value)? lastPayment, + required TResult orElse(), + }) { + if (generic != null) { + return generic(this); + } + return orElse(); + } +} + +abstract class _StripeErrorGeneric implements StripeError { + const factory _StripeErrorGeneric( + {required String message, required T code}) = _$_StripeErrorGeneric; + + @override + String get message => throw _privateConstructorUsedError; + T get code => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$StripeErrorGenericCopyWith> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$StripeErrorLastPaymentCopyWith + implements $StripeErrorCopyWith { + factory _$StripeErrorLastPaymentCopyWith(_StripeErrorLastPayment value, + $Res Function(_StripeErrorLastPayment) then) = + __$StripeErrorLastPaymentCopyWithImpl; + @override + $Res call( + {String code, + LastPaymentErrorType type, + PaymentMethod paymentMethod, + String message}); + + $PaymentMethodCopyWith<$Res> get paymentMethod; +} + +/// @nodoc +class __$StripeErrorLastPaymentCopyWithImpl + extends _$StripeErrorCopyWithImpl + implements _$StripeErrorLastPaymentCopyWith { + __$StripeErrorLastPaymentCopyWithImpl(_StripeErrorLastPayment _value, + $Res Function(_StripeErrorLastPayment) _then) + : super(_value, (v) => _then(v as _StripeErrorLastPayment)); + + @override + _StripeErrorLastPayment get _value => + super._value as _StripeErrorLastPayment; + + @override + $Res call({ + Object? code = freezed, + Object? type = freezed, + Object? paymentMethod = freezed, + Object? message = freezed, + }) { + return _then(_StripeErrorLastPayment( + code: code == freezed + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as LastPaymentErrorType, + paymentMethod: paymentMethod == freezed + ? _value.paymentMethod + : paymentMethod // ignore: cast_nullable_to_non_nullable + as PaymentMethod, + message: message == freezed + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + )); + } + + @override + $PaymentMethodCopyWith<$Res> get paymentMethod { + return $PaymentMethodCopyWith<$Res>(_value.paymentMethod, (value) { + return _then(_value.copyWith(paymentMethod: value)); + }); + } +} + +/// @nodoc +class _$_StripeErrorLastPayment implements _StripeErrorLastPayment { + const _$_StripeErrorLastPayment( + {required this.code, + required this.type, + required this.paymentMethod, + required this.message}); + + @override + final String code; + @override + final LastPaymentErrorType type; + @override + final PaymentMethod paymentMethod; + @override + final String message; + + @override + String toString() { + return 'StripeError<$T>.lastPayment(code: $code, type: $type, paymentMethod: $paymentMethod, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _StripeErrorLastPayment && + (identical(other.code, code) || + const DeepCollectionEquality().equals(other.code, code)) && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type)) && + (identical(other.paymentMethod, paymentMethod) || + const DeepCollectionEquality() + .equals(other.paymentMethod, paymentMethod)) && + (identical(other.message, message) || + const DeepCollectionEquality().equals(other.message, message))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(code) ^ + const DeepCollectionEquality().hash(type) ^ + const DeepCollectionEquality().hash(paymentMethod) ^ + const DeepCollectionEquality().hash(message); + + @JsonKey(ignore: true) + @override + _$StripeErrorLastPaymentCopyWith> + get copyWith => + __$StripeErrorLastPaymentCopyWithImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String message, T code) generic, + required TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message) + lastPayment, + }) { + return lastPayment(code, type, paymentMethod, message); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String message, T code)? generic, + TResult Function(String code, LastPaymentErrorType type, + PaymentMethod paymentMethod, String message)? + lastPayment, + required TResult orElse(), + }) { + if (lastPayment != null) { + return lastPayment(code, type, paymentMethod, message); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_StripeErrorGeneric value) generic, + required TResult Function(_StripeErrorLastPayment value) lastPayment, + }) { + return lastPayment(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_StripeErrorGeneric value)? generic, + TResult Function(_StripeErrorLastPayment value)? lastPayment, + required TResult orElse(), + }) { + if (lastPayment != null) { + return lastPayment(this); + } + return orElse(); + } +} + +abstract class _StripeErrorLastPayment implements StripeError { + const factory _StripeErrorLastPayment( + {required String code, + required LastPaymentErrorType type, + required PaymentMethod paymentMethod, + required String message}) = _$_StripeErrorLastPayment; + + String get code => throw _privateConstructorUsedError; + LastPaymentErrorType get type => throw _privateConstructorUsedError; + PaymentMethod get paymentMethod => throw _privateConstructorUsedError; + @override + String get message => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$StripeErrorLastPaymentCopyWith> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/payment_intents.dart b/stripe_platform_interface/lib/src/models/payment_intents.dart index 2d7635ee0..211621ce4 100644 --- a/stripe_platform_interface/lib/src/models/payment_intents.dart +++ b/stripe_platform_interface/lib/src/models/payment_intents.dart @@ -1,101 +1,54 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:stripe_platform_interface/src/models/payment_methods.dart'; -import 'errors.dart'; -import 'package:json_annotation/json_annotation.dart'; +import 'address.dart'; +part 'payment_intents.freezed.dart'; part 'payment_intents.g.dart'; -@JsonSerializable(explicitToJson: true) -class PaymentIntent { - PaymentIntent({ - required this.id, - required this.amount, - required this.created, - required this.currency, - required this.status, - this.description, - this.receiptEmail, - this.canceledAt, - required this.clientSecret, - required this.livemode, - required this.paymentMethodId, - required this.captureMethod, - required this.confirmationMethod, - this.lastPaymentError, - this.shipping, - }); - final String id; - final num amount; - final int created; - final String currency; - final PaymentIntentsStatus status; - final String? description; - final String? receiptEmail; - final String? canceledAt; - final String clientSecret; - final bool livemode; - final String paymentMethodId; - final CaptureMethod captureMethod; - final ConfirmationMethod confirmationMethod; - final LastPaymentError? lastPaymentError; - final ShippingDetails? shipping; +@freezed +class PaymentIntent with _$PaymentIntent { + @JsonSerializable(explicitToJson: true) + const factory PaymentIntent({ + required String id, + required num amount, + required int created, + required String currency, + required PaymentIntentsStatus status, + required String clientSecret, + required bool livemode, + required String paymentMethodId, + required CaptureMethod captureMethod, + required ConfirmationMethod confirmationMethod, + String? description, + String? receiptEmail, + String? canceledAt, + // LastPaymentError? lastPaymentError, + ShippingDetails? shipping, + }) = _PaymentIntent; - factory PaymentIntent.fromJson(Map json) => + factory PaymentIntent.fromJson(Map json) => _$PaymentIntentFromJson(json); - Map toJson() => _$PaymentIntentToJson(this); } enum CaptureMethod { Manual, Automatic } enum ConfirmationMethod { Manual, Automatic } -@JsonSerializable(explicitToJson: true) -class LastPaymentError extends StripeError { - LastPaymentError({ - required String code, - required this.type, - required this.paymentMethod, - required String message, - }) :super(code, message); - final LastPaymentErrorType type; - - final PaymentMethod paymentMethod; - factory LastPaymentError.fromJson(Map json) => - _$LastPaymentErrorFromJson(json); - Map toJson() => _$LastPaymentErrorToJson(this); -} - -enum LastPaymentErrorType { - ApiConnection, - Api, - Authentication, - Card, - Idempotency, - InvalidRequest, - RateLimit, - Unknown -} - -@JsonSerializable(explicitToJson: true) -class ShippingDetails { - ShippingDetails({ - required this.address, - required this.name, - required this.carrier, - required this.phone, - required this.trackingNumber, - }); - Address address; - String name; - String carrier; - String phone; - String trackingNumber; - - +@freezed +class ShippingDetails with _$ShippingDetails { + @JsonSerializable(explicitToJson: true) + const factory ShippingDetails({ + required Address address, + required String name, + required String carrier, + required String phone, + required String trackingNumber, + }) = _ShippingDetails; factory ShippingDetails.fromJson(Map json) => _$ShippingDetailsFromJson(json); - Map toJson() => _$ShippingDetailsToJson(this); } enum PaymentIntentsFutureUsage { diff --git a/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart b/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart new file mode 100644 index 000000000..f1aa17e2d --- /dev/null +++ b/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart @@ -0,0 +1,778 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'payment_intents.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +PaymentIntent _$PaymentIntentFromJson(Map json) { + return _PaymentIntent.fromJson(json); +} + +/// @nodoc +class _$PaymentIntentTearOff { + const _$PaymentIntentTearOff(); + + _PaymentIntent call( + {required String id, + required num amount, + required int created, + required String currency, + required PaymentIntentsStatus status, + required String clientSecret, + required bool livemode, + required String paymentMethodId, + required CaptureMethod captureMethod, + required ConfirmationMethod confirmationMethod, + String? description, + String? receiptEmail, + String? canceledAt, + ShippingDetails? shipping}) { + return _PaymentIntent( + id: id, + amount: amount, + created: created, + currency: currency, + status: status, + clientSecret: clientSecret, + livemode: livemode, + paymentMethodId: paymentMethodId, + captureMethod: captureMethod, + confirmationMethod: confirmationMethod, + description: description, + receiptEmail: receiptEmail, + canceledAt: canceledAt, + shipping: shipping, + ); + } + + PaymentIntent fromJson(Map json) { + return PaymentIntent.fromJson(json); + } +} + +/// @nodoc +const $PaymentIntent = _$PaymentIntentTearOff(); + +/// @nodoc +mixin _$PaymentIntent { + String get id => throw _privateConstructorUsedError; + num get amount => throw _privateConstructorUsedError; + int get created => throw _privateConstructorUsedError; + String get currency => throw _privateConstructorUsedError; + PaymentIntentsStatus get status => throw _privateConstructorUsedError; + String get clientSecret => throw _privateConstructorUsedError; + bool get livemode => throw _privateConstructorUsedError; + String get paymentMethodId => throw _privateConstructorUsedError; + CaptureMethod get captureMethod => throw _privateConstructorUsedError; + ConfirmationMethod get confirmationMethod => + throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String? get receiptEmail => throw _privateConstructorUsedError; + String? get canceledAt => + throw _privateConstructorUsedError; // LastPaymentError? lastPaymentError, + ShippingDetails? get shipping => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentIntentCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentIntentCopyWith<$Res> { + factory $PaymentIntentCopyWith( + PaymentIntent value, $Res Function(PaymentIntent) then) = + _$PaymentIntentCopyWithImpl<$Res>; + $Res call( + {String id, + num amount, + int created, + String currency, + PaymentIntentsStatus status, + String clientSecret, + bool livemode, + String paymentMethodId, + CaptureMethod captureMethod, + ConfirmationMethod confirmationMethod, + String? description, + String? receiptEmail, + String? canceledAt, + ShippingDetails? shipping}); + + $ShippingDetailsCopyWith<$Res>? get shipping; +} + +/// @nodoc +class _$PaymentIntentCopyWithImpl<$Res> + implements $PaymentIntentCopyWith<$Res> { + _$PaymentIntentCopyWithImpl(this._value, this._then); + + final PaymentIntent _value; + // ignore: unused_field + final $Res Function(PaymentIntent) _then; + + @override + $Res call({ + Object? id = freezed, + Object? amount = freezed, + Object? created = freezed, + Object? currency = freezed, + Object? status = freezed, + Object? clientSecret = freezed, + Object? livemode = freezed, + Object? paymentMethodId = freezed, + Object? captureMethod = freezed, + Object? confirmationMethod = freezed, + Object? description = freezed, + Object? receiptEmail = freezed, + Object? canceledAt = freezed, + Object? shipping = freezed, + }) { + return _then(_value.copyWith( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as num, + created: created == freezed + ? _value.created + : created // ignore: cast_nullable_to_non_nullable + as int, + currency: currency == freezed + ? _value.currency + : currency // ignore: cast_nullable_to_non_nullable + as String, + status: status == freezed + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as PaymentIntentsStatus, + clientSecret: clientSecret == freezed + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + livemode: livemode == freezed + ? _value.livemode + : livemode // ignore: cast_nullable_to_non_nullable + as bool, + paymentMethodId: paymentMethodId == freezed + ? _value.paymentMethodId + : paymentMethodId // ignore: cast_nullable_to_non_nullable + as String, + captureMethod: captureMethod == freezed + ? _value.captureMethod + : captureMethod // ignore: cast_nullable_to_non_nullable + as CaptureMethod, + confirmationMethod: confirmationMethod == freezed + ? _value.confirmationMethod + : confirmationMethod // ignore: cast_nullable_to_non_nullable + as ConfirmationMethod, + description: description == freezed + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + receiptEmail: receiptEmail == freezed + ? _value.receiptEmail + : receiptEmail // ignore: cast_nullable_to_non_nullable + as String?, + canceledAt: canceledAt == freezed + ? _value.canceledAt + : canceledAt // ignore: cast_nullable_to_non_nullable + as String?, + shipping: shipping == freezed + ? _value.shipping + : shipping // ignore: cast_nullable_to_non_nullable + as ShippingDetails?, + )); + } + + @override + $ShippingDetailsCopyWith<$Res>? get shipping { + if (_value.shipping == null) { + return null; + } + + return $ShippingDetailsCopyWith<$Res>(_value.shipping!, (value) { + return _then(_value.copyWith(shipping: value)); + }); + } +} + +/// @nodoc +abstract class _$PaymentIntentCopyWith<$Res> + implements $PaymentIntentCopyWith<$Res> { + factory _$PaymentIntentCopyWith( + _PaymentIntent value, $Res Function(_PaymentIntent) then) = + __$PaymentIntentCopyWithImpl<$Res>; + @override + $Res call( + {String id, + num amount, + int created, + String currency, + PaymentIntentsStatus status, + String clientSecret, + bool livemode, + String paymentMethodId, + CaptureMethod captureMethod, + ConfirmationMethod confirmationMethod, + String? description, + String? receiptEmail, + String? canceledAt, + ShippingDetails? shipping}); + + @override + $ShippingDetailsCopyWith<$Res>? get shipping; +} + +/// @nodoc +class __$PaymentIntentCopyWithImpl<$Res> + extends _$PaymentIntentCopyWithImpl<$Res> + implements _$PaymentIntentCopyWith<$Res> { + __$PaymentIntentCopyWithImpl( + _PaymentIntent _value, $Res Function(_PaymentIntent) _then) + : super(_value, (v) => _then(v as _PaymentIntent)); + + @override + _PaymentIntent get _value => super._value as _PaymentIntent; + + @override + $Res call({ + Object? id = freezed, + Object? amount = freezed, + Object? created = freezed, + Object? currency = freezed, + Object? status = freezed, + Object? clientSecret = freezed, + Object? livemode = freezed, + Object? paymentMethodId = freezed, + Object? captureMethod = freezed, + Object? confirmationMethod = freezed, + Object? description = freezed, + Object? receiptEmail = freezed, + Object? canceledAt = freezed, + Object? shipping = freezed, + }) { + return _then(_PaymentIntent( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + amount: amount == freezed + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as num, + created: created == freezed + ? _value.created + : created // ignore: cast_nullable_to_non_nullable + as int, + currency: currency == freezed + ? _value.currency + : currency // ignore: cast_nullable_to_non_nullable + as String, + status: status == freezed + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as PaymentIntentsStatus, + clientSecret: clientSecret == freezed + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + livemode: livemode == freezed + ? _value.livemode + : livemode // ignore: cast_nullable_to_non_nullable + as bool, + paymentMethodId: paymentMethodId == freezed + ? _value.paymentMethodId + : paymentMethodId // ignore: cast_nullable_to_non_nullable + as String, + captureMethod: captureMethod == freezed + ? _value.captureMethod + : captureMethod // ignore: cast_nullable_to_non_nullable + as CaptureMethod, + confirmationMethod: confirmationMethod == freezed + ? _value.confirmationMethod + : confirmationMethod // ignore: cast_nullable_to_non_nullable + as ConfirmationMethod, + description: description == freezed + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + receiptEmail: receiptEmail == freezed + ? _value.receiptEmail + : receiptEmail // ignore: cast_nullable_to_non_nullable + as String?, + canceledAt: canceledAt == freezed + ? _value.canceledAt + : canceledAt // ignore: cast_nullable_to_non_nullable + as String?, + shipping: shipping == freezed + ? _value.shipping + : shipping // ignore: cast_nullable_to_non_nullable + as ShippingDetails?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_PaymentIntent implements _PaymentIntent { + const _$_PaymentIntent( + {required this.id, + required this.amount, + required this.created, + required this.currency, + required this.status, + required this.clientSecret, + required this.livemode, + required this.paymentMethodId, + required this.captureMethod, + required this.confirmationMethod, + this.description, + this.receiptEmail, + this.canceledAt, + this.shipping}); + + factory _$_PaymentIntent.fromJson(Map json) => + _$_$_PaymentIntentFromJson(json); + + @override + final String id; + @override + final num amount; + @override + final int created; + @override + final String currency; + @override + final PaymentIntentsStatus status; + @override + final String clientSecret; + @override + final bool livemode; + @override + final String paymentMethodId; + @override + final CaptureMethod captureMethod; + @override + final ConfirmationMethod confirmationMethod; + @override + final String? description; + @override + final String? receiptEmail; + @override + final String? canceledAt; + @override // LastPaymentError? lastPaymentError, + final ShippingDetails? shipping; + + @override + String toString() { + return 'PaymentIntent(id: $id, amount: $amount, created: $created, currency: $currency, status: $status, clientSecret: $clientSecret, livemode: $livemode, paymentMethodId: $paymentMethodId, captureMethod: $captureMethod, confirmationMethod: $confirmationMethod, description: $description, receiptEmail: $receiptEmail, canceledAt: $canceledAt, shipping: $shipping)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _PaymentIntent && + (identical(other.id, id) || + const DeepCollectionEquality().equals(other.id, id)) && + (identical(other.amount, amount) || + const DeepCollectionEquality().equals(other.amount, amount)) && + (identical(other.created, created) || + const DeepCollectionEquality() + .equals(other.created, created)) && + (identical(other.currency, currency) || + const DeepCollectionEquality() + .equals(other.currency, currency)) && + (identical(other.status, status) || + const DeepCollectionEquality().equals(other.status, status)) && + (identical(other.clientSecret, clientSecret) || + const DeepCollectionEquality() + .equals(other.clientSecret, clientSecret)) && + (identical(other.livemode, livemode) || + const DeepCollectionEquality() + .equals(other.livemode, livemode)) && + (identical(other.paymentMethodId, paymentMethodId) || + const DeepCollectionEquality() + .equals(other.paymentMethodId, paymentMethodId)) && + (identical(other.captureMethod, captureMethod) || + const DeepCollectionEquality() + .equals(other.captureMethod, captureMethod)) && + (identical(other.confirmationMethod, confirmationMethod) || + const DeepCollectionEquality() + .equals(other.confirmationMethod, confirmationMethod)) && + (identical(other.description, description) || + const DeepCollectionEquality() + .equals(other.description, description)) && + (identical(other.receiptEmail, receiptEmail) || + const DeepCollectionEquality() + .equals(other.receiptEmail, receiptEmail)) && + (identical(other.canceledAt, canceledAt) || + const DeepCollectionEquality() + .equals(other.canceledAt, canceledAt)) && + (identical(other.shipping, shipping) || + const DeepCollectionEquality() + .equals(other.shipping, shipping))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(id) ^ + const DeepCollectionEquality().hash(amount) ^ + const DeepCollectionEquality().hash(created) ^ + const DeepCollectionEquality().hash(currency) ^ + const DeepCollectionEquality().hash(status) ^ + const DeepCollectionEquality().hash(clientSecret) ^ + const DeepCollectionEquality().hash(livemode) ^ + const DeepCollectionEquality().hash(paymentMethodId) ^ + const DeepCollectionEquality().hash(captureMethod) ^ + const DeepCollectionEquality().hash(confirmationMethod) ^ + const DeepCollectionEquality().hash(description) ^ + const DeepCollectionEquality().hash(receiptEmail) ^ + const DeepCollectionEquality().hash(canceledAt) ^ + const DeepCollectionEquality().hash(shipping); + + @JsonKey(ignore: true) + @override + _$PaymentIntentCopyWith<_PaymentIntent> get copyWith => + __$PaymentIntentCopyWithImpl<_PaymentIntent>(this, _$identity); + + @override + Map toJson() { + return _$_$_PaymentIntentToJson(this); + } +} + +abstract class _PaymentIntent implements PaymentIntent { + const factory _PaymentIntent( + {required String id, + required num amount, + required int created, + required String currency, + required PaymentIntentsStatus status, + required String clientSecret, + required bool livemode, + required String paymentMethodId, + required CaptureMethod captureMethod, + required ConfirmationMethod confirmationMethod, + String? description, + String? receiptEmail, + String? canceledAt, + ShippingDetails? shipping}) = _$_PaymentIntent; + + factory _PaymentIntent.fromJson(Map json) = + _$_PaymentIntent.fromJson; + + @override + String get id => throw _privateConstructorUsedError; + @override + num get amount => throw _privateConstructorUsedError; + @override + int get created => throw _privateConstructorUsedError; + @override + String get currency => throw _privateConstructorUsedError; + @override + PaymentIntentsStatus get status => throw _privateConstructorUsedError; + @override + String get clientSecret => throw _privateConstructorUsedError; + @override + bool get livemode => throw _privateConstructorUsedError; + @override + String get paymentMethodId => throw _privateConstructorUsedError; + @override + CaptureMethod get captureMethod => throw _privateConstructorUsedError; + @override + ConfirmationMethod get confirmationMethod => + throw _privateConstructorUsedError; + @override + String? get description => throw _privateConstructorUsedError; + @override + String? get receiptEmail => throw _privateConstructorUsedError; + @override + String? get canceledAt => throw _privateConstructorUsedError; + @override // LastPaymentError? lastPaymentError, + ShippingDetails? get shipping => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$PaymentIntentCopyWith<_PaymentIntent> get copyWith => + throw _privateConstructorUsedError; +} + +ShippingDetails _$ShippingDetailsFromJson(Map json) { + return _ShippingDetails.fromJson(json); +} + +/// @nodoc +class _$ShippingDetailsTearOff { + const _$ShippingDetailsTearOff(); + + _ShippingDetails call( + {required Address address, + required String name, + required String carrier, + required String phone, + required String trackingNumber}) { + return _ShippingDetails( + address: address, + name: name, + carrier: carrier, + phone: phone, + trackingNumber: trackingNumber, + ); + } + + ShippingDetails fromJson(Map json) { + return ShippingDetails.fromJson(json); + } +} + +/// @nodoc +const $ShippingDetails = _$ShippingDetailsTearOff(); + +/// @nodoc +mixin _$ShippingDetails { + Address get address => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String get carrier => throw _privateConstructorUsedError; + String get phone => throw _privateConstructorUsedError; + String get trackingNumber => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ShippingDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ShippingDetailsCopyWith<$Res> { + factory $ShippingDetailsCopyWith( + ShippingDetails value, $Res Function(ShippingDetails) then) = + _$ShippingDetailsCopyWithImpl<$Res>; + $Res call( + {Address address, + String name, + String carrier, + String phone, + String trackingNumber}); + + $AddressCopyWith<$Res> get address; +} + +/// @nodoc +class _$ShippingDetailsCopyWithImpl<$Res> + implements $ShippingDetailsCopyWith<$Res> { + _$ShippingDetailsCopyWithImpl(this._value, this._then); + + final ShippingDetails _value; + // ignore: unused_field + final $Res Function(ShippingDetails) _then; + + @override + $Res call({ + Object? address = freezed, + Object? name = freezed, + Object? carrier = freezed, + Object? phone = freezed, + Object? trackingNumber = freezed, + }) { + return _then(_value.copyWith( + address: address == freezed + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as Address, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + carrier: carrier == freezed + ? _value.carrier + : carrier // ignore: cast_nullable_to_non_nullable + as String, + phone: phone == freezed + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String, + trackingNumber: trackingNumber == freezed + ? _value.trackingNumber + : trackingNumber // ignore: cast_nullable_to_non_nullable + as String, + )); + } + + @override + $AddressCopyWith<$Res> get address { + return $AddressCopyWith<$Res>(_value.address, (value) { + return _then(_value.copyWith(address: value)); + }); + } +} + +/// @nodoc +abstract class _$ShippingDetailsCopyWith<$Res> + implements $ShippingDetailsCopyWith<$Res> { + factory _$ShippingDetailsCopyWith( + _ShippingDetails value, $Res Function(_ShippingDetails) then) = + __$ShippingDetailsCopyWithImpl<$Res>; + @override + $Res call( + {Address address, + String name, + String carrier, + String phone, + String trackingNumber}); + + @override + $AddressCopyWith<$Res> get address; +} + +/// @nodoc +class __$ShippingDetailsCopyWithImpl<$Res> + extends _$ShippingDetailsCopyWithImpl<$Res> + implements _$ShippingDetailsCopyWith<$Res> { + __$ShippingDetailsCopyWithImpl( + _ShippingDetails _value, $Res Function(_ShippingDetails) _then) + : super(_value, (v) => _then(v as _ShippingDetails)); + + @override + _ShippingDetails get _value => super._value as _ShippingDetails; + + @override + $Res call({ + Object? address = freezed, + Object? name = freezed, + Object? carrier = freezed, + Object? phone = freezed, + Object? trackingNumber = freezed, + }) { + return _then(_ShippingDetails( + address: address == freezed + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as Address, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + carrier: carrier == freezed + ? _value.carrier + : carrier // ignore: cast_nullable_to_non_nullable + as String, + phone: phone == freezed + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String, + trackingNumber: trackingNumber == freezed + ? _value.trackingNumber + : trackingNumber // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_ShippingDetails implements _ShippingDetails { + const _$_ShippingDetails( + {required this.address, + required this.name, + required this.carrier, + required this.phone, + required this.trackingNumber}); + + factory _$_ShippingDetails.fromJson(Map json) => + _$_$_ShippingDetailsFromJson(json); + + @override + final Address address; + @override + final String name; + @override + final String carrier; + @override + final String phone; + @override + final String trackingNumber; + + @override + String toString() { + return 'ShippingDetails(address: $address, name: $name, carrier: $carrier, phone: $phone, trackingNumber: $trackingNumber)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _ShippingDetails && + (identical(other.address, address) || + const DeepCollectionEquality() + .equals(other.address, address)) && + (identical(other.name, name) || + const DeepCollectionEquality().equals(other.name, name)) && + (identical(other.carrier, carrier) || + const DeepCollectionEquality() + .equals(other.carrier, carrier)) && + (identical(other.phone, phone) || + const DeepCollectionEquality().equals(other.phone, phone)) && + (identical(other.trackingNumber, trackingNumber) || + const DeepCollectionEquality() + .equals(other.trackingNumber, trackingNumber))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(address) ^ + const DeepCollectionEquality().hash(name) ^ + const DeepCollectionEquality().hash(carrier) ^ + const DeepCollectionEquality().hash(phone) ^ + const DeepCollectionEquality().hash(trackingNumber); + + @JsonKey(ignore: true) + @override + _$ShippingDetailsCopyWith<_ShippingDetails> get copyWith => + __$ShippingDetailsCopyWithImpl<_ShippingDetails>(this, _$identity); + + @override + Map toJson() { + return _$_$_ShippingDetailsToJson(this); + } +} + +abstract class _ShippingDetails implements ShippingDetails { + const factory _ShippingDetails( + {required Address address, + required String name, + required String carrier, + required String phone, + required String trackingNumber}) = _$_ShippingDetails; + + factory _ShippingDetails.fromJson(Map json) = + _$_ShippingDetails.fromJson; + + @override + Address get address => throw _privateConstructorUsedError; + @override + String get name => throw _privateConstructorUsedError; + @override + String get carrier => throw _privateConstructorUsedError; + @override + String get phone => throw _privateConstructorUsedError; + @override + String get trackingNumber => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$ShippingDetailsCopyWith<_ShippingDetails> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/payment_intents.g.dart b/stripe_platform_interface/lib/src/models/payment_intents.g.dart index e22fc865a..9092e2672 100644 --- a/stripe_platform_interface/lib/src/models/payment_intents.g.dart +++ b/stripe_platform_interface/lib/src/models/payment_intents.g.dart @@ -6,49 +6,44 @@ part of 'payment_intents.dart'; // JsonSerializableGenerator // ************************************************************************** -PaymentIntent _$PaymentIntentFromJson(Map json) { - return PaymentIntent( +_$_PaymentIntent _$_$_PaymentIntentFromJson(Map json) { + return _$_PaymentIntent( id: json['id'] as String, amount: json['amount'] as num, created: json['created'] as int, currency: json['currency'] as String, status: _$enumDecode(_$PaymentIntentsStatusEnumMap, json['status']), - description: json['description'] as String?, - receiptEmail: json['receiptEmail'] as String?, - canceledAt: json['canceledAt'] as String?, clientSecret: json['clientSecret'] as String, livemode: json['livemode'] as bool, paymentMethodId: json['paymentMethodId'] as String, captureMethod: _$enumDecode(_$CaptureMethodEnumMap, json['captureMethod']), confirmationMethod: _$enumDecode(_$ConfirmationMethodEnumMap, json['confirmationMethod']), - lastPaymentError: json['lastPaymentError'] == null - ? null - : LastPaymentError.fromJson( - json['lastPaymentError'] as Map), + description: json['description'] as String?, + receiptEmail: json['receiptEmail'] as String?, + canceledAt: json['canceledAt'] as String?, shipping: json['shipping'] == null ? null : ShippingDetails.fromJson(json['shipping'] as Map), ); } -Map _$PaymentIntentToJson(PaymentIntent instance) => +Map _$_$_PaymentIntentToJson(_$_PaymentIntent instance) => { 'id': instance.id, 'amount': instance.amount, 'created': instance.created, 'currency': instance.currency, 'status': _$PaymentIntentsStatusEnumMap[instance.status], - 'description': instance.description, - 'receiptEmail': instance.receiptEmail, - 'canceledAt': instance.canceledAt, 'clientSecret': instance.clientSecret, 'livemode': instance.livemode, 'paymentMethodId': instance.paymentMethodId, 'captureMethod': _$CaptureMethodEnumMap[instance.captureMethod], 'confirmationMethod': _$ConfirmationMethodEnumMap[instance.confirmationMethod], - 'lastPaymentError': instance.lastPaymentError?.toJson(), + 'description': instance.description, + 'receiptEmail': instance.receiptEmail, + 'canceledAt': instance.canceledAt, 'shipping': instance.shipping?.toJson(), }; @@ -99,37 +94,8 @@ const _$ConfirmationMethodEnumMap = { ConfirmationMethod.Automatic: 'Automatic', }; -LastPaymentError _$LastPaymentErrorFromJson(Map json) { - return LastPaymentError( - code: json['code'] as String, - type: _$enumDecode(_$LastPaymentErrorTypeEnumMap, json['type']), - paymentMethod: - PaymentMethod.fromJson(json['paymentMethod'] as Map), - message: json['message'] as String, - ); -} - -Map _$LastPaymentErrorToJson(LastPaymentError instance) => - { - 'message': instance.message, - 'code': instance.code, - 'type': _$LastPaymentErrorTypeEnumMap[instance.type], - 'paymentMethod': instance.paymentMethod.toJson(), - }; - -const _$LastPaymentErrorTypeEnumMap = { - LastPaymentErrorType.ApiConnection: 'ApiConnection', - LastPaymentErrorType.Api: 'Api', - LastPaymentErrorType.Authentication: 'Authentication', - LastPaymentErrorType.Card: 'Card', - LastPaymentErrorType.Idempotency: 'Idempotency', - LastPaymentErrorType.InvalidRequest: 'InvalidRequest', - LastPaymentErrorType.RateLimit: 'RateLimit', - LastPaymentErrorType.Unknown: 'Unknown', -}; - -ShippingDetails _$ShippingDetailsFromJson(Map json) { - return ShippingDetails( +_$_ShippingDetails _$_$_ShippingDetailsFromJson(Map json) { + return _$_ShippingDetails( address: Address.fromJson(json['address'] as Map), name: json['name'] as String, carrier: json['carrier'] as String, @@ -138,7 +104,7 @@ ShippingDetails _$ShippingDetailsFromJson(Map json) { ); } -Map _$ShippingDetailsToJson(ShippingDetails instance) => +Map _$_$_ShippingDetailsToJson(_$_ShippingDetails instance) => { 'address': instance.address.toJson(), 'name': instance.name, diff --git a/stripe_platform_interface/lib/src/models/payment_methods.dart b/stripe_platform_interface/lib/src/models/payment_methods.dart index d7345ba9f..9a1d3f1b2 100644 --- a/stripe_platform_interface/lib/src/models/payment_methods.dart +++ b/stripe_platform_interface/lib/src/models/payment_methods.dart @@ -1,223 +1,143 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:stripe_platform_interface/src/models/card_field_input.dart'; import 'package:stripe_platform_interface/src/models/payment_intents.dart'; -import 'package:json_annotation/json_annotation.dart'; - +part 'payment_methods.freezed.dart'; part 'payment_methods.g.dart'; -@JsonSerializable(explicitToJson: true) -class PaymentMethod { - final String id; - final bool liveMode; - final String customerId; - final BillingDetails billingDetails; - final PaymentMethodType type; - final AuBecsDebit auBecsDebit; - final BacsDebit bacsDebit; - final Card card; - final Fpx fpx; - final Ideal ideal; - final SepaDebit sepaDebit; - final Sofort sofort; - final Upi upi; - - PaymentMethod({ - required this.id, - required this.liveMode, - required this.customerId, - required this.billingDetails, - required this.type, - required this.auBecsDebit, - required this.bacsDebit, - required this.card, - required this.fpx, - required this.ideal, - required this.sepaDebit, - required this.sofort, - required this.upi, - }); +@freezed +class PaymentMethod with _$PaymentMethod { + @JsonSerializable(explicitToJson: true) + const factory PaymentMethod({ + required String id, + required bool liveMode, + required String customerId, + required BillingDetails billingDetails, + required PaymentMethodType type, + required AuBecsDebit auBecsDebit, + required BacsDebit bacsDebit, + required Card card, + required Fpx fpx, + required Ideal ideal, + required SepaDebit sepaDebit, + required Sofort sofort, + required Upi upi, + }) = _PaymentMethod; factory PaymentMethod.fromJson(Map json) => _$PaymentMethodFromJson(json); - Map toJson() => _$PaymentMethodToJson(this); -} - -abstract class PaymentMethodParams { - String get type; - BillingDetails? billingDetails; - PaymentMethodParams(); -} - -@JsonSerializable(explicitToJson: true) -class AliPayParams extends PaymentMethodParams { - final String type = 'Alipay'; - AliPayParams(); - factory AliPayParams.fromJson(Map json) => - _$AliPayParamsFromJson(json); - Map toJson() => _$AliPayParamsToJson(this); -} - -class CardParams extends PaymentMethodParams { - final String type = 'Card'; - - factory CardParams({ - required CardFieldInputDetails details, - PaymentIntentsFutureUsage? setupFutureUsage, - }) => - _DetailedCardParams( - details, - setupFutureUsage, - ); - - factory CardParams.fromMethodId({ - required String paymentMethodId, - String? cvc, - }) => - _PaymentMethodCardParams(paymentMethodId, cvc); - CardParams._(); -} - -@JsonSerializable(explicitToJson: true) -class _DetailedCardParams extends CardParams { - final CardFieldInputDetails details; - final PaymentIntentsFutureUsage? setupFutureUsage; - - _DetailedCardParams(this.details, this.setupFutureUsage) : super._(); - - factory _DetailedCardParams.fromJson(Map json) => - _$_DetailedCardParamsFromJson(json); - Map toJson() => _$_DetailedCardParamsToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class _PaymentMethodCardParams extends CardParams { - final String paymentMethodId; - final String? cvc; - - _PaymentMethodCardParams(this.paymentMethodId, this.cvc) : super._(); - - factory _PaymentMethodCardParams.fromJson(Map json) => - _$_PaymentMethodCardParamsFromJson(json); - Map toJson() => _$_PaymentMethodCardParamsToJson(this); } -@JsonSerializable(explicitToJson: true) -class BillingDetails { - final String? email; - final String? phone; - final String? name; - final Address? address; - BillingDetails({this.email, this.phone, this.name, this.address}); +@freezed +class BillingDetails with _$BillingDetails { + @JsonSerializable(explicitToJson: true) + const factory BillingDetails({ + String? email, + String? phone, + String? name, + String? adressPostalCode, + String? addressCity, + String? addressCountry, + String? addressLine1, + String? addressLine2, + String? addressLine3, + }) = _BillingDetails; factory BillingDetails.fromJson(Map json) => _$BillingDetailsFromJson(json); - Map toJson() => _$BillingDetailsToJson(this); } -@JsonSerializable(explicitToJson: true) -class Address { - Address({ - required this.city, - required this.county, - required this.line1, - required this.line2, - required this.postalCode, - required this.state, - }); - String city; - String county; - String line1; - String line2; - String postalCode; - String state; - - factory Address.fromJson(Map json) => - _$AddressFromJson(json); - Map toJson() => _$AddressToJson(this); -} +@freezed +class AuBecsDebit with _$AuBecsDebit { + @JsonSerializable(explicitToJson: true) + const factory AuBecsDebit({ + String? fingerprint, + String? last4, + String? bsbNumber, + }) = _AuBecsDebit; -@JsonSerializable(explicitToJson: true) -class AuBecsDebit { - String? fingerprint; - String? last4; - String? bsbNumber; - AuBecsDebit(); factory AuBecsDebit.fromJson(Map json) => _$AuBecsDebitFromJson(json); - Map toJson() => _$AuBecsDebitToJson(this); } -@JsonSerializable(explicitToJson: true) -class BacsDebit { - String? sortCode; - String? fingerprint; - String? last4; - BacsDebit(); +@freezed +class BacsDebit with _$BacsDebit { + @JsonSerializable(explicitToJson: true) + const factory BacsDebit({ + String? sortCode, + String? fingerprint, + String? last4, + }) = _BacsDebit; factory BacsDebit.fromJson(Map json) => _$BacsDebitFromJson(json); - Map toJson() => _$BacsDebitToJson(this); } -@JsonSerializable(explicitToJson: true) -class Card { - CardBrand? brand; - String? country; - String? expYear; - String? expMonth; - String? fingerprint; - String? funding; - String? last4; - Card(); +@freezed +class Card with _$Card { + @JsonSerializable(explicitToJson: true) + const factory Card({ + CardBrand? brand, + String? country, + String? expYear, + String? expMonth, + String? fingerprint, + String? funding, + String? last4, + }) = _Card; + factory Card.fromJson(Map json) => _$CardFromJson(json); - Map toJson() => _$CardToJson(this); } -@JsonSerializable(explicitToJson: true) -class Fpx { - String? bank; - - Fpx(); +@freezed +class Fpx with _$Fpx { + @JsonSerializable(explicitToJson: true) + const factory Fpx({ + String? bank, + }) = _Fpx; factory Fpx.fromJson(Map json) => _$FpxFromJson(json); - Map toJson() => _$FpxToJson(this); } -@JsonSerializable(explicitToJson: true) -class Ideal { - String? bankIdentifierCode; - String? bank; - Ideal(); +@freezed +class Ideal with _$Ideal { + @JsonSerializable(explicitToJson: true) + const factory Ideal({ + String? bankIdentifierCode, + String? bank, + }) = _Ideal; factory Ideal.fromJson(Map json) => _$IdealFromJson(json); - Map toJson() => _$IdealToJson(this); } -@JsonSerializable(explicitToJson: true) -class SepaDebit { - String? country; - String? bankCode; +@freezed +class SepaDebit with _$SepaDebit { + @JsonSerializable(explicitToJson: true) + const factory SepaDebit({ + String? country, + String? bankCode, + String? fingerprint, + String? last4, + }) = _SepaDebit; - String? fingerprint; - String? last4; - SepaDebit(); factory SepaDebit.fromJson(Map json) => _$SepaDebitFromJson(json); - Map toJson() => _$SepaDebitToJson(this); } -@JsonSerializable(explicitToJson: true) -class Sofort { - String? country; - Sofort(); +@freezed +class Sofort with _$Sofort { + @JsonSerializable(explicitToJson: true) + const factory Sofort({String? country}) = _Sofort; + factory Sofort.fromJson(Map json) => _$SofortFromJson(json); - Map toJson() => _$SofortToJson(this); } -@JsonSerializable(explicitToJson: true) -class Upi { - String? vpa; - Upi(); +@freezed +class Upi with _$Upi { + @JsonSerializable(explicitToJson: true) + const factory Upi({ + String? vpa, + }) = _Upi; factory Upi.fromJson(Map json) => _$UpiFromJson(json); - Map toJson() => _$UpiToJson(this); } enum PaymentMethodType { @@ -240,3 +160,25 @@ enum PaymentMethodType { Upi, Unknown } + +@freezed +class PaymentMethodParams with _$PaymentMethodParams { + const factory PaymentMethodParams.card({ + @Default('card') String type, + required CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage, + }) = _PaymentMethodParamsCard; + + const factory PaymentMethodParams.cardFromMethodId({ + @Default('card') String type, + required String paymentMethodId, + String? cvc, + }) = _PaymentMethodParamsCardWithMethodId; + + const factory PaymentMethodParams.aliPay({ + @Default('Alipay') String type, + }) = _PaymentMethodParamsAli; + + factory PaymentMethodParams.fromJson(Map json) => + _$PaymentMethodParamsFromJson(json); +} diff --git a/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart b/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart new file mode 100644 index 000000000..1242c05b7 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart @@ -0,0 +1,3030 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'payment_methods.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +PaymentMethod _$PaymentMethodFromJson(Map json) { + return _PaymentMethod.fromJson(json); +} + +/// @nodoc +class _$PaymentMethodTearOff { + const _$PaymentMethodTearOff(); + + _PaymentMethod call( + {required String id, + required bool liveMode, + required String customerId, + required BillingDetails billingDetails, + required PaymentMethodType type, + required AuBecsDebit auBecsDebit, + required BacsDebit bacsDebit, + required Card card, + required Fpx fpx, + required Ideal ideal, + required SepaDebit sepaDebit, + required Sofort sofort, + required Upi upi}) { + return _PaymentMethod( + id: id, + liveMode: liveMode, + customerId: customerId, + billingDetails: billingDetails, + type: type, + auBecsDebit: auBecsDebit, + bacsDebit: bacsDebit, + card: card, + fpx: fpx, + ideal: ideal, + sepaDebit: sepaDebit, + sofort: sofort, + upi: upi, + ); + } + + PaymentMethod fromJson(Map json) { + return PaymentMethod.fromJson(json); + } +} + +/// @nodoc +const $PaymentMethod = _$PaymentMethodTearOff(); + +/// @nodoc +mixin _$PaymentMethod { + String get id => throw _privateConstructorUsedError; + bool get liveMode => throw _privateConstructorUsedError; + String get customerId => throw _privateConstructorUsedError; + BillingDetails get billingDetails => throw _privateConstructorUsedError; + PaymentMethodType get type => throw _privateConstructorUsedError; + AuBecsDebit get auBecsDebit => throw _privateConstructorUsedError; + BacsDebit get bacsDebit => throw _privateConstructorUsedError; + Card get card => throw _privateConstructorUsedError; + Fpx get fpx => throw _privateConstructorUsedError; + Ideal get ideal => throw _privateConstructorUsedError; + SepaDebit get sepaDebit => throw _privateConstructorUsedError; + Sofort get sofort => throw _privateConstructorUsedError; + Upi get upi => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentMethodCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentMethodCopyWith<$Res> { + factory $PaymentMethodCopyWith( + PaymentMethod value, $Res Function(PaymentMethod) then) = + _$PaymentMethodCopyWithImpl<$Res>; + $Res call( + {String id, + bool liveMode, + String customerId, + BillingDetails billingDetails, + PaymentMethodType type, + AuBecsDebit auBecsDebit, + BacsDebit bacsDebit, + Card card, + Fpx fpx, + Ideal ideal, + SepaDebit sepaDebit, + Sofort sofort, + Upi upi}); + + $BillingDetailsCopyWith<$Res> get billingDetails; + $AuBecsDebitCopyWith<$Res> get auBecsDebit; + $BacsDebitCopyWith<$Res> get bacsDebit; + $CardCopyWith<$Res> get card; + $FpxCopyWith<$Res> get fpx; + $IdealCopyWith<$Res> get ideal; + $SepaDebitCopyWith<$Res> get sepaDebit; + $SofortCopyWith<$Res> get sofort; + $UpiCopyWith<$Res> get upi; +} + +/// @nodoc +class _$PaymentMethodCopyWithImpl<$Res> + implements $PaymentMethodCopyWith<$Res> { + _$PaymentMethodCopyWithImpl(this._value, this._then); + + final PaymentMethod _value; + // ignore: unused_field + final $Res Function(PaymentMethod) _then; + + @override + $Res call({ + Object? id = freezed, + Object? liveMode = freezed, + Object? customerId = freezed, + Object? billingDetails = freezed, + Object? type = freezed, + Object? auBecsDebit = freezed, + Object? bacsDebit = freezed, + Object? card = freezed, + Object? fpx = freezed, + Object? ideal = freezed, + Object? sepaDebit = freezed, + Object? sofort = freezed, + Object? upi = freezed, + }) { + return _then(_value.copyWith( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + liveMode: liveMode == freezed + ? _value.liveMode + : liveMode // ignore: cast_nullable_to_non_nullable + as bool, + customerId: customerId == freezed + ? _value.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String, + billingDetails: billingDetails == freezed + ? _value.billingDetails + : billingDetails // ignore: cast_nullable_to_non_nullable + as BillingDetails, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as PaymentMethodType, + auBecsDebit: auBecsDebit == freezed + ? _value.auBecsDebit + : auBecsDebit // ignore: cast_nullable_to_non_nullable + as AuBecsDebit, + bacsDebit: bacsDebit == freezed + ? _value.bacsDebit + : bacsDebit // ignore: cast_nullable_to_non_nullable + as BacsDebit, + card: card == freezed + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as Card, + fpx: fpx == freezed + ? _value.fpx + : fpx // ignore: cast_nullable_to_non_nullable + as Fpx, + ideal: ideal == freezed + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as Ideal, + sepaDebit: sepaDebit == freezed + ? _value.sepaDebit + : sepaDebit // ignore: cast_nullable_to_non_nullable + as SepaDebit, + sofort: sofort == freezed + ? _value.sofort + : sofort // ignore: cast_nullable_to_non_nullable + as Sofort, + upi: upi == freezed + ? _value.upi + : upi // ignore: cast_nullable_to_non_nullable + as Upi, + )); + } + + @override + $BillingDetailsCopyWith<$Res> get billingDetails { + return $BillingDetailsCopyWith<$Res>(_value.billingDetails, (value) { + return _then(_value.copyWith(billingDetails: value)); + }); + } + + @override + $AuBecsDebitCopyWith<$Res> get auBecsDebit { + return $AuBecsDebitCopyWith<$Res>(_value.auBecsDebit, (value) { + return _then(_value.copyWith(auBecsDebit: value)); + }); + } + + @override + $BacsDebitCopyWith<$Res> get bacsDebit { + return $BacsDebitCopyWith<$Res>(_value.bacsDebit, (value) { + return _then(_value.copyWith(bacsDebit: value)); + }); + } + + @override + $CardCopyWith<$Res> get card { + return $CardCopyWith<$Res>(_value.card, (value) { + return _then(_value.copyWith(card: value)); + }); + } + + @override + $FpxCopyWith<$Res> get fpx { + return $FpxCopyWith<$Res>(_value.fpx, (value) { + return _then(_value.copyWith(fpx: value)); + }); + } + + @override + $IdealCopyWith<$Res> get ideal { + return $IdealCopyWith<$Res>(_value.ideal, (value) { + return _then(_value.copyWith(ideal: value)); + }); + } + + @override + $SepaDebitCopyWith<$Res> get sepaDebit { + return $SepaDebitCopyWith<$Res>(_value.sepaDebit, (value) { + return _then(_value.copyWith(sepaDebit: value)); + }); + } + + @override + $SofortCopyWith<$Res> get sofort { + return $SofortCopyWith<$Res>(_value.sofort, (value) { + return _then(_value.copyWith(sofort: value)); + }); + } + + @override + $UpiCopyWith<$Res> get upi { + return $UpiCopyWith<$Res>(_value.upi, (value) { + return _then(_value.copyWith(upi: value)); + }); + } +} + +/// @nodoc +abstract class _$PaymentMethodCopyWith<$Res> + implements $PaymentMethodCopyWith<$Res> { + factory _$PaymentMethodCopyWith( + _PaymentMethod value, $Res Function(_PaymentMethod) then) = + __$PaymentMethodCopyWithImpl<$Res>; + @override + $Res call( + {String id, + bool liveMode, + String customerId, + BillingDetails billingDetails, + PaymentMethodType type, + AuBecsDebit auBecsDebit, + BacsDebit bacsDebit, + Card card, + Fpx fpx, + Ideal ideal, + SepaDebit sepaDebit, + Sofort sofort, + Upi upi}); + + @override + $BillingDetailsCopyWith<$Res> get billingDetails; + @override + $AuBecsDebitCopyWith<$Res> get auBecsDebit; + @override + $BacsDebitCopyWith<$Res> get bacsDebit; + @override + $CardCopyWith<$Res> get card; + @override + $FpxCopyWith<$Res> get fpx; + @override + $IdealCopyWith<$Res> get ideal; + @override + $SepaDebitCopyWith<$Res> get sepaDebit; + @override + $SofortCopyWith<$Res> get sofort; + @override + $UpiCopyWith<$Res> get upi; +} + +/// @nodoc +class __$PaymentMethodCopyWithImpl<$Res> + extends _$PaymentMethodCopyWithImpl<$Res> + implements _$PaymentMethodCopyWith<$Res> { + __$PaymentMethodCopyWithImpl( + _PaymentMethod _value, $Res Function(_PaymentMethod) _then) + : super(_value, (v) => _then(v as _PaymentMethod)); + + @override + _PaymentMethod get _value => super._value as _PaymentMethod; + + @override + $Res call({ + Object? id = freezed, + Object? liveMode = freezed, + Object? customerId = freezed, + Object? billingDetails = freezed, + Object? type = freezed, + Object? auBecsDebit = freezed, + Object? bacsDebit = freezed, + Object? card = freezed, + Object? fpx = freezed, + Object? ideal = freezed, + Object? sepaDebit = freezed, + Object? sofort = freezed, + Object? upi = freezed, + }) { + return _then(_PaymentMethod( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + liveMode: liveMode == freezed + ? _value.liveMode + : liveMode // ignore: cast_nullable_to_non_nullable + as bool, + customerId: customerId == freezed + ? _value.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String, + billingDetails: billingDetails == freezed + ? _value.billingDetails + : billingDetails // ignore: cast_nullable_to_non_nullable + as BillingDetails, + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as PaymentMethodType, + auBecsDebit: auBecsDebit == freezed + ? _value.auBecsDebit + : auBecsDebit // ignore: cast_nullable_to_non_nullable + as AuBecsDebit, + bacsDebit: bacsDebit == freezed + ? _value.bacsDebit + : bacsDebit // ignore: cast_nullable_to_non_nullable + as BacsDebit, + card: card == freezed + ? _value.card + : card // ignore: cast_nullable_to_non_nullable + as Card, + fpx: fpx == freezed + ? _value.fpx + : fpx // ignore: cast_nullable_to_non_nullable + as Fpx, + ideal: ideal == freezed + ? _value.ideal + : ideal // ignore: cast_nullable_to_non_nullable + as Ideal, + sepaDebit: sepaDebit == freezed + ? _value.sepaDebit + : sepaDebit // ignore: cast_nullable_to_non_nullable + as SepaDebit, + sofort: sofort == freezed + ? _value.sofort + : sofort // ignore: cast_nullable_to_non_nullable + as Sofort, + upi: upi == freezed + ? _value.upi + : upi // ignore: cast_nullable_to_non_nullable + as Upi, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_PaymentMethod implements _PaymentMethod { + const _$_PaymentMethod( + {required this.id, + required this.liveMode, + required this.customerId, + required this.billingDetails, + required this.type, + required this.auBecsDebit, + required this.bacsDebit, + required this.card, + required this.fpx, + required this.ideal, + required this.sepaDebit, + required this.sofort, + required this.upi}); + + factory _$_PaymentMethod.fromJson(Map json) => + _$_$_PaymentMethodFromJson(json); + + @override + final String id; + @override + final bool liveMode; + @override + final String customerId; + @override + final BillingDetails billingDetails; + @override + final PaymentMethodType type; + @override + final AuBecsDebit auBecsDebit; + @override + final BacsDebit bacsDebit; + @override + final Card card; + @override + final Fpx fpx; + @override + final Ideal ideal; + @override + final SepaDebit sepaDebit; + @override + final Sofort sofort; + @override + final Upi upi; + + @override + String toString() { + return 'PaymentMethod(id: $id, liveMode: $liveMode, customerId: $customerId, billingDetails: $billingDetails, type: $type, auBecsDebit: $auBecsDebit, bacsDebit: $bacsDebit, card: $card, fpx: $fpx, ideal: $ideal, sepaDebit: $sepaDebit, sofort: $sofort, upi: $upi)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _PaymentMethod && + (identical(other.id, id) || + const DeepCollectionEquality().equals(other.id, id)) && + (identical(other.liveMode, liveMode) || + const DeepCollectionEquality() + .equals(other.liveMode, liveMode)) && + (identical(other.customerId, customerId) || + const DeepCollectionEquality() + .equals(other.customerId, customerId)) && + (identical(other.billingDetails, billingDetails) || + const DeepCollectionEquality() + .equals(other.billingDetails, billingDetails)) && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type)) && + (identical(other.auBecsDebit, auBecsDebit) || + const DeepCollectionEquality() + .equals(other.auBecsDebit, auBecsDebit)) && + (identical(other.bacsDebit, bacsDebit) || + const DeepCollectionEquality() + .equals(other.bacsDebit, bacsDebit)) && + (identical(other.card, card) || + const DeepCollectionEquality().equals(other.card, card)) && + (identical(other.fpx, fpx) || + const DeepCollectionEquality().equals(other.fpx, fpx)) && + (identical(other.ideal, ideal) || + const DeepCollectionEquality().equals(other.ideal, ideal)) && + (identical(other.sepaDebit, sepaDebit) || + const DeepCollectionEquality() + .equals(other.sepaDebit, sepaDebit)) && + (identical(other.sofort, sofort) || + const DeepCollectionEquality().equals(other.sofort, sofort)) && + (identical(other.upi, upi) || + const DeepCollectionEquality().equals(other.upi, upi))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(id) ^ + const DeepCollectionEquality().hash(liveMode) ^ + const DeepCollectionEquality().hash(customerId) ^ + const DeepCollectionEquality().hash(billingDetails) ^ + const DeepCollectionEquality().hash(type) ^ + const DeepCollectionEquality().hash(auBecsDebit) ^ + const DeepCollectionEquality().hash(bacsDebit) ^ + const DeepCollectionEquality().hash(card) ^ + const DeepCollectionEquality().hash(fpx) ^ + const DeepCollectionEquality().hash(ideal) ^ + const DeepCollectionEquality().hash(sepaDebit) ^ + const DeepCollectionEquality().hash(sofort) ^ + const DeepCollectionEquality().hash(upi); + + @JsonKey(ignore: true) + @override + _$PaymentMethodCopyWith<_PaymentMethod> get copyWith => + __$PaymentMethodCopyWithImpl<_PaymentMethod>(this, _$identity); + + @override + Map toJson() { + return _$_$_PaymentMethodToJson(this); + } +} + +abstract class _PaymentMethod implements PaymentMethod { + const factory _PaymentMethod( + {required String id, + required bool liveMode, + required String customerId, + required BillingDetails billingDetails, + required PaymentMethodType type, + required AuBecsDebit auBecsDebit, + required BacsDebit bacsDebit, + required Card card, + required Fpx fpx, + required Ideal ideal, + required SepaDebit sepaDebit, + required Sofort sofort, + required Upi upi}) = _$_PaymentMethod; + + factory _PaymentMethod.fromJson(Map json) = + _$_PaymentMethod.fromJson; + + @override + String get id => throw _privateConstructorUsedError; + @override + bool get liveMode => throw _privateConstructorUsedError; + @override + String get customerId => throw _privateConstructorUsedError; + @override + BillingDetails get billingDetails => throw _privateConstructorUsedError; + @override + PaymentMethodType get type => throw _privateConstructorUsedError; + @override + AuBecsDebit get auBecsDebit => throw _privateConstructorUsedError; + @override + BacsDebit get bacsDebit => throw _privateConstructorUsedError; + @override + Card get card => throw _privateConstructorUsedError; + @override + Fpx get fpx => throw _privateConstructorUsedError; + @override + Ideal get ideal => throw _privateConstructorUsedError; + @override + SepaDebit get sepaDebit => throw _privateConstructorUsedError; + @override + Sofort get sofort => throw _privateConstructorUsedError; + @override + Upi get upi => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$PaymentMethodCopyWith<_PaymentMethod> get copyWith => + throw _privateConstructorUsedError; +} + +BillingDetails _$BillingDetailsFromJson(Map json) { + return _BillingDetails.fromJson(json); +} + +/// @nodoc +class _$BillingDetailsTearOff { + const _$BillingDetailsTearOff(); + + _BillingDetails call( + {String? email, + String? phone, + String? name, + String? adressPostalCode, + String? addressCity, + String? addressCountry, + String? addressLine1, + String? addressLine2, + String? addressLine3}) { + return _BillingDetails( + email: email, + phone: phone, + name: name, + adressPostalCode: adressPostalCode, + addressCity: addressCity, + addressCountry: addressCountry, + addressLine1: addressLine1, + addressLine2: addressLine2, + addressLine3: addressLine3, + ); + } + + BillingDetails fromJson(Map json) { + return BillingDetails.fromJson(json); + } +} + +/// @nodoc +const $BillingDetails = _$BillingDetailsTearOff(); + +/// @nodoc +mixin _$BillingDetails { + String? get email => throw _privateConstructorUsedError; + String? get phone => throw _privateConstructorUsedError; + String? get name => throw _privateConstructorUsedError; + String? get adressPostalCode => throw _privateConstructorUsedError; + String? get addressCity => throw _privateConstructorUsedError; + String? get addressCountry => throw _privateConstructorUsedError; + String? get addressLine1 => throw _privateConstructorUsedError; + String? get addressLine2 => throw _privateConstructorUsedError; + String? get addressLine3 => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $BillingDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BillingDetailsCopyWith<$Res> { + factory $BillingDetailsCopyWith( + BillingDetails value, $Res Function(BillingDetails) then) = + _$BillingDetailsCopyWithImpl<$Res>; + $Res call( + {String? email, + String? phone, + String? name, + String? adressPostalCode, + String? addressCity, + String? addressCountry, + String? addressLine1, + String? addressLine2, + String? addressLine3}); +} + +/// @nodoc +class _$BillingDetailsCopyWithImpl<$Res> + implements $BillingDetailsCopyWith<$Res> { + _$BillingDetailsCopyWithImpl(this._value, this._then); + + final BillingDetails _value; + // ignore: unused_field + final $Res Function(BillingDetails) _then; + + @override + $Res call({ + Object? email = freezed, + Object? phone = freezed, + Object? name = freezed, + Object? adressPostalCode = freezed, + Object? addressCity = freezed, + Object? addressCountry = freezed, + Object? addressLine1 = freezed, + Object? addressLine2 = freezed, + Object? addressLine3 = freezed, + }) { + return _then(_value.copyWith( + email: email == freezed + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String?, + phone: phone == freezed + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String?, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + adressPostalCode: adressPostalCode == freezed + ? _value.adressPostalCode + : adressPostalCode // ignore: cast_nullable_to_non_nullable + as String?, + addressCity: addressCity == freezed + ? _value.addressCity + : addressCity // ignore: cast_nullable_to_non_nullable + as String?, + addressCountry: addressCountry == freezed + ? _value.addressCountry + : addressCountry // ignore: cast_nullable_to_non_nullable + as String?, + addressLine1: addressLine1 == freezed + ? _value.addressLine1 + : addressLine1 // ignore: cast_nullable_to_non_nullable + as String?, + addressLine2: addressLine2 == freezed + ? _value.addressLine2 + : addressLine2 // ignore: cast_nullable_to_non_nullable + as String?, + addressLine3: addressLine3 == freezed + ? _value.addressLine3 + : addressLine3 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$BillingDetailsCopyWith<$Res> + implements $BillingDetailsCopyWith<$Res> { + factory _$BillingDetailsCopyWith( + _BillingDetails value, $Res Function(_BillingDetails) then) = + __$BillingDetailsCopyWithImpl<$Res>; + @override + $Res call( + {String? email, + String? phone, + String? name, + String? adressPostalCode, + String? addressCity, + String? addressCountry, + String? addressLine1, + String? addressLine2, + String? addressLine3}); +} + +/// @nodoc +class __$BillingDetailsCopyWithImpl<$Res> + extends _$BillingDetailsCopyWithImpl<$Res> + implements _$BillingDetailsCopyWith<$Res> { + __$BillingDetailsCopyWithImpl( + _BillingDetails _value, $Res Function(_BillingDetails) _then) + : super(_value, (v) => _then(v as _BillingDetails)); + + @override + _BillingDetails get _value => super._value as _BillingDetails; + + @override + $Res call({ + Object? email = freezed, + Object? phone = freezed, + Object? name = freezed, + Object? adressPostalCode = freezed, + Object? addressCity = freezed, + Object? addressCountry = freezed, + Object? addressLine1 = freezed, + Object? addressLine2 = freezed, + Object? addressLine3 = freezed, + }) { + return _then(_BillingDetails( + email: email == freezed + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String?, + phone: phone == freezed + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String?, + name: name == freezed + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + adressPostalCode: adressPostalCode == freezed + ? _value.adressPostalCode + : adressPostalCode // ignore: cast_nullable_to_non_nullable + as String?, + addressCity: addressCity == freezed + ? _value.addressCity + : addressCity // ignore: cast_nullable_to_non_nullable + as String?, + addressCountry: addressCountry == freezed + ? _value.addressCountry + : addressCountry // ignore: cast_nullable_to_non_nullable + as String?, + addressLine1: addressLine1 == freezed + ? _value.addressLine1 + : addressLine1 // ignore: cast_nullable_to_non_nullable + as String?, + addressLine2: addressLine2 == freezed + ? _value.addressLine2 + : addressLine2 // ignore: cast_nullable_to_non_nullable + as String?, + addressLine3: addressLine3 == freezed + ? _value.addressLine3 + : addressLine3 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_BillingDetails implements _BillingDetails { + const _$_BillingDetails( + {this.email, + this.phone, + this.name, + this.adressPostalCode, + this.addressCity, + this.addressCountry, + this.addressLine1, + this.addressLine2, + this.addressLine3}); + + factory _$_BillingDetails.fromJson(Map json) => + _$_$_BillingDetailsFromJson(json); + + @override + final String? email; + @override + final String? phone; + @override + final String? name; + @override + final String? adressPostalCode; + @override + final String? addressCity; + @override + final String? addressCountry; + @override + final String? addressLine1; + @override + final String? addressLine2; + @override + final String? addressLine3; + + @override + String toString() { + return 'BillingDetails(email: $email, phone: $phone, name: $name, adressPostalCode: $adressPostalCode, addressCity: $addressCity, addressCountry: $addressCountry, addressLine1: $addressLine1, addressLine2: $addressLine2, addressLine3: $addressLine3)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _BillingDetails && + (identical(other.email, email) || + const DeepCollectionEquality().equals(other.email, email)) && + (identical(other.phone, phone) || + const DeepCollectionEquality().equals(other.phone, phone)) && + (identical(other.name, name) || + const DeepCollectionEquality().equals(other.name, name)) && + (identical(other.adressPostalCode, adressPostalCode) || + const DeepCollectionEquality() + .equals(other.adressPostalCode, adressPostalCode)) && + (identical(other.addressCity, addressCity) || + const DeepCollectionEquality() + .equals(other.addressCity, addressCity)) && + (identical(other.addressCountry, addressCountry) || + const DeepCollectionEquality() + .equals(other.addressCountry, addressCountry)) && + (identical(other.addressLine1, addressLine1) || + const DeepCollectionEquality() + .equals(other.addressLine1, addressLine1)) && + (identical(other.addressLine2, addressLine2) || + const DeepCollectionEquality() + .equals(other.addressLine2, addressLine2)) && + (identical(other.addressLine3, addressLine3) || + const DeepCollectionEquality() + .equals(other.addressLine3, addressLine3))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(email) ^ + const DeepCollectionEquality().hash(phone) ^ + const DeepCollectionEquality().hash(name) ^ + const DeepCollectionEquality().hash(adressPostalCode) ^ + const DeepCollectionEquality().hash(addressCity) ^ + const DeepCollectionEquality().hash(addressCountry) ^ + const DeepCollectionEquality().hash(addressLine1) ^ + const DeepCollectionEquality().hash(addressLine2) ^ + const DeepCollectionEquality().hash(addressLine3); + + @JsonKey(ignore: true) + @override + _$BillingDetailsCopyWith<_BillingDetails> get copyWith => + __$BillingDetailsCopyWithImpl<_BillingDetails>(this, _$identity); + + @override + Map toJson() { + return _$_$_BillingDetailsToJson(this); + } +} + +abstract class _BillingDetails implements BillingDetails { + const factory _BillingDetails( + {String? email, + String? phone, + String? name, + String? adressPostalCode, + String? addressCity, + String? addressCountry, + String? addressLine1, + String? addressLine2, + String? addressLine3}) = _$_BillingDetails; + + factory _BillingDetails.fromJson(Map json) = + _$_BillingDetails.fromJson; + + @override + String? get email => throw _privateConstructorUsedError; + @override + String? get phone => throw _privateConstructorUsedError; + @override + String? get name => throw _privateConstructorUsedError; + @override + String? get adressPostalCode => throw _privateConstructorUsedError; + @override + String? get addressCity => throw _privateConstructorUsedError; + @override + String? get addressCountry => throw _privateConstructorUsedError; + @override + String? get addressLine1 => throw _privateConstructorUsedError; + @override + String? get addressLine2 => throw _privateConstructorUsedError; + @override + String? get addressLine3 => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$BillingDetailsCopyWith<_BillingDetails> get copyWith => + throw _privateConstructorUsedError; +} + +AuBecsDebit _$AuBecsDebitFromJson(Map json) { + return _AuBecsDebit.fromJson(json); +} + +/// @nodoc +class _$AuBecsDebitTearOff { + const _$AuBecsDebitTearOff(); + + _AuBecsDebit call({String? fingerprint, String? last4, String? bsbNumber}) { + return _AuBecsDebit( + fingerprint: fingerprint, + last4: last4, + bsbNumber: bsbNumber, + ); + } + + AuBecsDebit fromJson(Map json) { + return AuBecsDebit.fromJson(json); + } +} + +/// @nodoc +const $AuBecsDebit = _$AuBecsDebitTearOff(); + +/// @nodoc +mixin _$AuBecsDebit { + String? get fingerprint => throw _privateConstructorUsedError; + String? get last4 => throw _privateConstructorUsedError; + String? get bsbNumber => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AuBecsDebitCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuBecsDebitCopyWith<$Res> { + factory $AuBecsDebitCopyWith( + AuBecsDebit value, $Res Function(AuBecsDebit) then) = + _$AuBecsDebitCopyWithImpl<$Res>; + $Res call({String? fingerprint, String? last4, String? bsbNumber}); +} + +/// @nodoc +class _$AuBecsDebitCopyWithImpl<$Res> implements $AuBecsDebitCopyWith<$Res> { + _$AuBecsDebitCopyWithImpl(this._value, this._then); + + final AuBecsDebit _value; + // ignore: unused_field + final $Res Function(AuBecsDebit) _then; + + @override + $Res call({ + Object? fingerprint = freezed, + Object? last4 = freezed, + Object? bsbNumber = freezed, + }) { + return _then(_value.copyWith( + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + bsbNumber: bsbNumber == freezed + ? _value.bsbNumber + : bsbNumber // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$AuBecsDebitCopyWith<$Res> + implements $AuBecsDebitCopyWith<$Res> { + factory _$AuBecsDebitCopyWith( + _AuBecsDebit value, $Res Function(_AuBecsDebit) then) = + __$AuBecsDebitCopyWithImpl<$Res>; + @override + $Res call({String? fingerprint, String? last4, String? bsbNumber}); +} + +/// @nodoc +class __$AuBecsDebitCopyWithImpl<$Res> extends _$AuBecsDebitCopyWithImpl<$Res> + implements _$AuBecsDebitCopyWith<$Res> { + __$AuBecsDebitCopyWithImpl( + _AuBecsDebit _value, $Res Function(_AuBecsDebit) _then) + : super(_value, (v) => _then(v as _AuBecsDebit)); + + @override + _AuBecsDebit get _value => super._value as _AuBecsDebit; + + @override + $Res call({ + Object? fingerprint = freezed, + Object? last4 = freezed, + Object? bsbNumber = freezed, + }) { + return _then(_AuBecsDebit( + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + bsbNumber: bsbNumber == freezed + ? _value.bsbNumber + : bsbNumber // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_AuBecsDebit implements _AuBecsDebit { + const _$_AuBecsDebit({this.fingerprint, this.last4, this.bsbNumber}); + + factory _$_AuBecsDebit.fromJson(Map json) => + _$_$_AuBecsDebitFromJson(json); + + @override + final String? fingerprint; + @override + final String? last4; + @override + final String? bsbNumber; + + @override + String toString() { + return 'AuBecsDebit(fingerprint: $fingerprint, last4: $last4, bsbNumber: $bsbNumber)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _AuBecsDebit && + (identical(other.fingerprint, fingerprint) || + const DeepCollectionEquality() + .equals(other.fingerprint, fingerprint)) && + (identical(other.last4, last4) || + const DeepCollectionEquality().equals(other.last4, last4)) && + (identical(other.bsbNumber, bsbNumber) || + const DeepCollectionEquality() + .equals(other.bsbNumber, bsbNumber))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(fingerprint) ^ + const DeepCollectionEquality().hash(last4) ^ + const DeepCollectionEquality().hash(bsbNumber); + + @JsonKey(ignore: true) + @override + _$AuBecsDebitCopyWith<_AuBecsDebit> get copyWith => + __$AuBecsDebitCopyWithImpl<_AuBecsDebit>(this, _$identity); + + @override + Map toJson() { + return _$_$_AuBecsDebitToJson(this); + } +} + +abstract class _AuBecsDebit implements AuBecsDebit { + const factory _AuBecsDebit( + {String? fingerprint, String? last4, String? bsbNumber}) = _$_AuBecsDebit; + + factory _AuBecsDebit.fromJson(Map json) = + _$_AuBecsDebit.fromJson; + + @override + String? get fingerprint => throw _privateConstructorUsedError; + @override + String? get last4 => throw _privateConstructorUsedError; + @override + String? get bsbNumber => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$AuBecsDebitCopyWith<_AuBecsDebit> get copyWith => + throw _privateConstructorUsedError; +} + +BacsDebit _$BacsDebitFromJson(Map json) { + return _BacsDebit.fromJson(json); +} + +/// @nodoc +class _$BacsDebitTearOff { + const _$BacsDebitTearOff(); + + _BacsDebit call({String? sortCode, String? fingerprint, String? last4}) { + return _BacsDebit( + sortCode: sortCode, + fingerprint: fingerprint, + last4: last4, + ); + } + + BacsDebit fromJson(Map json) { + return BacsDebit.fromJson(json); + } +} + +/// @nodoc +const $BacsDebit = _$BacsDebitTearOff(); + +/// @nodoc +mixin _$BacsDebit { + String? get sortCode => throw _privateConstructorUsedError; + String? get fingerprint => throw _privateConstructorUsedError; + String? get last4 => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $BacsDebitCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BacsDebitCopyWith<$Res> { + factory $BacsDebitCopyWith(BacsDebit value, $Res Function(BacsDebit) then) = + _$BacsDebitCopyWithImpl<$Res>; + $Res call({String? sortCode, String? fingerprint, String? last4}); +} + +/// @nodoc +class _$BacsDebitCopyWithImpl<$Res> implements $BacsDebitCopyWith<$Res> { + _$BacsDebitCopyWithImpl(this._value, this._then); + + final BacsDebit _value; + // ignore: unused_field + final $Res Function(BacsDebit) _then; + + @override + $Res call({ + Object? sortCode = freezed, + Object? fingerprint = freezed, + Object? last4 = freezed, + }) { + return _then(_value.copyWith( + sortCode: sortCode == freezed + ? _value.sortCode + : sortCode // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$BacsDebitCopyWith<$Res> implements $BacsDebitCopyWith<$Res> { + factory _$BacsDebitCopyWith( + _BacsDebit value, $Res Function(_BacsDebit) then) = + __$BacsDebitCopyWithImpl<$Res>; + @override + $Res call({String? sortCode, String? fingerprint, String? last4}); +} + +/// @nodoc +class __$BacsDebitCopyWithImpl<$Res> extends _$BacsDebitCopyWithImpl<$Res> + implements _$BacsDebitCopyWith<$Res> { + __$BacsDebitCopyWithImpl(_BacsDebit _value, $Res Function(_BacsDebit) _then) + : super(_value, (v) => _then(v as _BacsDebit)); + + @override + _BacsDebit get _value => super._value as _BacsDebit; + + @override + $Res call({ + Object? sortCode = freezed, + Object? fingerprint = freezed, + Object? last4 = freezed, + }) { + return _then(_BacsDebit( + sortCode: sortCode == freezed + ? _value.sortCode + : sortCode // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_BacsDebit implements _BacsDebit { + const _$_BacsDebit({this.sortCode, this.fingerprint, this.last4}); + + factory _$_BacsDebit.fromJson(Map json) => + _$_$_BacsDebitFromJson(json); + + @override + final String? sortCode; + @override + final String? fingerprint; + @override + final String? last4; + + @override + String toString() { + return 'BacsDebit(sortCode: $sortCode, fingerprint: $fingerprint, last4: $last4)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _BacsDebit && + (identical(other.sortCode, sortCode) || + const DeepCollectionEquality() + .equals(other.sortCode, sortCode)) && + (identical(other.fingerprint, fingerprint) || + const DeepCollectionEquality() + .equals(other.fingerprint, fingerprint)) && + (identical(other.last4, last4) || + const DeepCollectionEquality().equals(other.last4, last4))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(sortCode) ^ + const DeepCollectionEquality().hash(fingerprint) ^ + const DeepCollectionEquality().hash(last4); + + @JsonKey(ignore: true) + @override + _$BacsDebitCopyWith<_BacsDebit> get copyWith => + __$BacsDebitCopyWithImpl<_BacsDebit>(this, _$identity); + + @override + Map toJson() { + return _$_$_BacsDebitToJson(this); + } +} + +abstract class _BacsDebit implements BacsDebit { + const factory _BacsDebit( + {String? sortCode, String? fingerprint, String? last4}) = _$_BacsDebit; + + factory _BacsDebit.fromJson(Map json) = + _$_BacsDebit.fromJson; + + @override + String? get sortCode => throw _privateConstructorUsedError; + @override + String? get fingerprint => throw _privateConstructorUsedError; + @override + String? get last4 => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$BacsDebitCopyWith<_BacsDebit> get copyWith => + throw _privateConstructorUsedError; +} + +Card _$CardFromJson(Map json) { + return _Card.fromJson(json); +} + +/// @nodoc +class _$CardTearOff { + const _$CardTearOff(); + + _Card call( + {CardBrand? brand, + String? country, + String? expYear, + String? expMonth, + String? fingerprint, + String? funding, + String? last4}) { + return _Card( + brand: brand, + country: country, + expYear: expYear, + expMonth: expMonth, + fingerprint: fingerprint, + funding: funding, + last4: last4, + ); + } + + Card fromJson(Map json) { + return Card.fromJson(json); + } +} + +/// @nodoc +const $Card = _$CardTearOff(); + +/// @nodoc +mixin _$Card { + CardBrand? get brand => throw _privateConstructorUsedError; + String? get country => throw _privateConstructorUsedError; + String? get expYear => throw _privateConstructorUsedError; + String? get expMonth => throw _privateConstructorUsedError; + String? get fingerprint => throw _privateConstructorUsedError; + String? get funding => throw _privateConstructorUsedError; + String? get last4 => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CardCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CardCopyWith<$Res> { + factory $CardCopyWith(Card value, $Res Function(Card) then) = + _$CardCopyWithImpl<$Res>; + $Res call( + {CardBrand? brand, + String? country, + String? expYear, + String? expMonth, + String? fingerprint, + String? funding, + String? last4}); +} + +/// @nodoc +class _$CardCopyWithImpl<$Res> implements $CardCopyWith<$Res> { + _$CardCopyWithImpl(this._value, this._then); + + final Card _value; + // ignore: unused_field + final $Res Function(Card) _then; + + @override + $Res call({ + Object? brand = freezed, + Object? country = freezed, + Object? expYear = freezed, + Object? expMonth = freezed, + Object? fingerprint = freezed, + Object? funding = freezed, + Object? last4 = freezed, + }) { + return _then(_value.copyWith( + brand: brand == freezed + ? _value.brand + : brand // ignore: cast_nullable_to_non_nullable + as CardBrand?, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + expYear: expYear == freezed + ? _value.expYear + : expYear // ignore: cast_nullable_to_non_nullable + as String?, + expMonth: expMonth == freezed + ? _value.expMonth + : expMonth // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + funding: funding == freezed + ? _value.funding + : funding // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$CardCopyWith<$Res> implements $CardCopyWith<$Res> { + factory _$CardCopyWith(_Card value, $Res Function(_Card) then) = + __$CardCopyWithImpl<$Res>; + @override + $Res call( + {CardBrand? brand, + String? country, + String? expYear, + String? expMonth, + String? fingerprint, + String? funding, + String? last4}); +} + +/// @nodoc +class __$CardCopyWithImpl<$Res> extends _$CardCopyWithImpl<$Res> + implements _$CardCopyWith<$Res> { + __$CardCopyWithImpl(_Card _value, $Res Function(_Card) _then) + : super(_value, (v) => _then(v as _Card)); + + @override + _Card get _value => super._value as _Card; + + @override + $Res call({ + Object? brand = freezed, + Object? country = freezed, + Object? expYear = freezed, + Object? expMonth = freezed, + Object? fingerprint = freezed, + Object? funding = freezed, + Object? last4 = freezed, + }) { + return _then(_Card( + brand: brand == freezed + ? _value.brand + : brand // ignore: cast_nullable_to_non_nullable + as CardBrand?, + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + expYear: expYear == freezed + ? _value.expYear + : expYear // ignore: cast_nullable_to_non_nullable + as String?, + expMonth: expMonth == freezed + ? _value.expMonth + : expMonth // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + funding: funding == freezed + ? _value.funding + : funding // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Card implements _Card { + const _$_Card( + {this.brand, + this.country, + this.expYear, + this.expMonth, + this.fingerprint, + this.funding, + this.last4}); + + factory _$_Card.fromJson(Map json) => + _$_$_CardFromJson(json); + + @override + final CardBrand? brand; + @override + final String? country; + @override + final String? expYear; + @override + final String? expMonth; + @override + final String? fingerprint; + @override + final String? funding; + @override + final String? last4; + + @override + String toString() { + return 'Card(brand: $brand, country: $country, expYear: $expYear, expMonth: $expMonth, fingerprint: $fingerprint, funding: $funding, last4: $last4)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Card && + (identical(other.brand, brand) || + const DeepCollectionEquality().equals(other.brand, brand)) && + (identical(other.country, country) || + const DeepCollectionEquality() + .equals(other.country, country)) && + (identical(other.expYear, expYear) || + const DeepCollectionEquality() + .equals(other.expYear, expYear)) && + (identical(other.expMonth, expMonth) || + const DeepCollectionEquality() + .equals(other.expMonth, expMonth)) && + (identical(other.fingerprint, fingerprint) || + const DeepCollectionEquality() + .equals(other.fingerprint, fingerprint)) && + (identical(other.funding, funding) || + const DeepCollectionEquality() + .equals(other.funding, funding)) && + (identical(other.last4, last4) || + const DeepCollectionEquality().equals(other.last4, last4))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(brand) ^ + const DeepCollectionEquality().hash(country) ^ + const DeepCollectionEquality().hash(expYear) ^ + const DeepCollectionEquality().hash(expMonth) ^ + const DeepCollectionEquality().hash(fingerprint) ^ + const DeepCollectionEquality().hash(funding) ^ + const DeepCollectionEquality().hash(last4); + + @JsonKey(ignore: true) + @override + _$CardCopyWith<_Card> get copyWith => + __$CardCopyWithImpl<_Card>(this, _$identity); + + @override + Map toJson() { + return _$_$_CardToJson(this); + } +} + +abstract class _Card implements Card { + const factory _Card( + {CardBrand? brand, + String? country, + String? expYear, + String? expMonth, + String? fingerprint, + String? funding, + String? last4}) = _$_Card; + + factory _Card.fromJson(Map json) = _$_Card.fromJson; + + @override + CardBrand? get brand => throw _privateConstructorUsedError; + @override + String? get country => throw _privateConstructorUsedError; + @override + String? get expYear => throw _privateConstructorUsedError; + @override + String? get expMonth => throw _privateConstructorUsedError; + @override + String? get fingerprint => throw _privateConstructorUsedError; + @override + String? get funding => throw _privateConstructorUsedError; + @override + String? get last4 => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$CardCopyWith<_Card> get copyWith => throw _privateConstructorUsedError; +} + +Fpx _$FpxFromJson(Map json) { + return _Fpx.fromJson(json); +} + +/// @nodoc +class _$FpxTearOff { + const _$FpxTearOff(); + + _Fpx call({String? bank}) { + return _Fpx( + bank: bank, + ); + } + + Fpx fromJson(Map json) { + return Fpx.fromJson(json); + } +} + +/// @nodoc +const $Fpx = _$FpxTearOff(); + +/// @nodoc +mixin _$Fpx { + String? get bank => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $FpxCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FpxCopyWith<$Res> { + factory $FpxCopyWith(Fpx value, $Res Function(Fpx) then) = + _$FpxCopyWithImpl<$Res>; + $Res call({String? bank}); +} + +/// @nodoc +class _$FpxCopyWithImpl<$Res> implements $FpxCopyWith<$Res> { + _$FpxCopyWithImpl(this._value, this._then); + + final Fpx _value; + // ignore: unused_field + final $Res Function(Fpx) _then; + + @override + $Res call({ + Object? bank = freezed, + }) { + return _then(_value.copyWith( + bank: bank == freezed + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$FpxCopyWith<$Res> implements $FpxCopyWith<$Res> { + factory _$FpxCopyWith(_Fpx value, $Res Function(_Fpx) then) = + __$FpxCopyWithImpl<$Res>; + @override + $Res call({String? bank}); +} + +/// @nodoc +class __$FpxCopyWithImpl<$Res> extends _$FpxCopyWithImpl<$Res> + implements _$FpxCopyWith<$Res> { + __$FpxCopyWithImpl(_Fpx _value, $Res Function(_Fpx) _then) + : super(_value, (v) => _then(v as _Fpx)); + + @override + _Fpx get _value => super._value as _Fpx; + + @override + $Res call({ + Object? bank = freezed, + }) { + return _then(_Fpx( + bank: bank == freezed + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Fpx implements _Fpx { + const _$_Fpx({this.bank}); + + factory _$_Fpx.fromJson(Map json) => _$_$_FpxFromJson(json); + + @override + final String? bank; + + @override + String toString() { + return 'Fpx(bank: $bank)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Fpx && + (identical(other.bank, bank) || + const DeepCollectionEquality().equals(other.bank, bank))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ const DeepCollectionEquality().hash(bank); + + @JsonKey(ignore: true) + @override + _$FpxCopyWith<_Fpx> get copyWith => + __$FpxCopyWithImpl<_Fpx>(this, _$identity); + + @override + Map toJson() { + return _$_$_FpxToJson(this); + } +} + +abstract class _Fpx implements Fpx { + const factory _Fpx({String? bank}) = _$_Fpx; + + factory _Fpx.fromJson(Map json) = _$_Fpx.fromJson; + + @override + String? get bank => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$FpxCopyWith<_Fpx> get copyWith => throw _privateConstructorUsedError; +} + +Ideal _$IdealFromJson(Map json) { + return _Ideal.fromJson(json); +} + +/// @nodoc +class _$IdealTearOff { + const _$IdealTearOff(); + + _Ideal call({String? bankIdentifierCode, String? bank}) { + return _Ideal( + bankIdentifierCode: bankIdentifierCode, + bank: bank, + ); + } + + Ideal fromJson(Map json) { + return Ideal.fromJson(json); + } +} + +/// @nodoc +const $Ideal = _$IdealTearOff(); + +/// @nodoc +mixin _$Ideal { + String? get bankIdentifierCode => throw _privateConstructorUsedError; + String? get bank => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $IdealCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IdealCopyWith<$Res> { + factory $IdealCopyWith(Ideal value, $Res Function(Ideal) then) = + _$IdealCopyWithImpl<$Res>; + $Res call({String? bankIdentifierCode, String? bank}); +} + +/// @nodoc +class _$IdealCopyWithImpl<$Res> implements $IdealCopyWith<$Res> { + _$IdealCopyWithImpl(this._value, this._then); + + final Ideal _value; + // ignore: unused_field + final $Res Function(Ideal) _then; + + @override + $Res call({ + Object? bankIdentifierCode = freezed, + Object? bank = freezed, + }) { + return _then(_value.copyWith( + bankIdentifierCode: bankIdentifierCode == freezed + ? _value.bankIdentifierCode + : bankIdentifierCode // ignore: cast_nullable_to_non_nullable + as String?, + bank: bank == freezed + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$IdealCopyWith<$Res> implements $IdealCopyWith<$Res> { + factory _$IdealCopyWith(_Ideal value, $Res Function(_Ideal) then) = + __$IdealCopyWithImpl<$Res>; + @override + $Res call({String? bankIdentifierCode, String? bank}); +} + +/// @nodoc +class __$IdealCopyWithImpl<$Res> extends _$IdealCopyWithImpl<$Res> + implements _$IdealCopyWith<$Res> { + __$IdealCopyWithImpl(_Ideal _value, $Res Function(_Ideal) _then) + : super(_value, (v) => _then(v as _Ideal)); + + @override + _Ideal get _value => super._value as _Ideal; + + @override + $Res call({ + Object? bankIdentifierCode = freezed, + Object? bank = freezed, + }) { + return _then(_Ideal( + bankIdentifierCode: bankIdentifierCode == freezed + ? _value.bankIdentifierCode + : bankIdentifierCode // ignore: cast_nullable_to_non_nullable + as String?, + bank: bank == freezed + ? _value.bank + : bank // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Ideal implements _Ideal { + const _$_Ideal({this.bankIdentifierCode, this.bank}); + + factory _$_Ideal.fromJson(Map json) => + _$_$_IdealFromJson(json); + + @override + final String? bankIdentifierCode; + @override + final String? bank; + + @override + String toString() { + return 'Ideal(bankIdentifierCode: $bankIdentifierCode, bank: $bank)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Ideal && + (identical(other.bankIdentifierCode, bankIdentifierCode) || + const DeepCollectionEquality() + .equals(other.bankIdentifierCode, bankIdentifierCode)) && + (identical(other.bank, bank) || + const DeepCollectionEquality().equals(other.bank, bank))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(bankIdentifierCode) ^ + const DeepCollectionEquality().hash(bank); + + @JsonKey(ignore: true) + @override + _$IdealCopyWith<_Ideal> get copyWith => + __$IdealCopyWithImpl<_Ideal>(this, _$identity); + + @override + Map toJson() { + return _$_$_IdealToJson(this); + } +} + +abstract class _Ideal implements Ideal { + const factory _Ideal({String? bankIdentifierCode, String? bank}) = _$_Ideal; + + factory _Ideal.fromJson(Map json) = _$_Ideal.fromJson; + + @override + String? get bankIdentifierCode => throw _privateConstructorUsedError; + @override + String? get bank => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$IdealCopyWith<_Ideal> get copyWith => throw _privateConstructorUsedError; +} + +SepaDebit _$SepaDebitFromJson(Map json) { + return _SepaDebit.fromJson(json); +} + +/// @nodoc +class _$SepaDebitTearOff { + const _$SepaDebitTearOff(); + + _SepaDebit call( + {String? country, String? bankCode, String? fingerprint, String? last4}) { + return _SepaDebit( + country: country, + bankCode: bankCode, + fingerprint: fingerprint, + last4: last4, + ); + } + + SepaDebit fromJson(Map json) { + return SepaDebit.fromJson(json); + } +} + +/// @nodoc +const $SepaDebit = _$SepaDebitTearOff(); + +/// @nodoc +mixin _$SepaDebit { + String? get country => throw _privateConstructorUsedError; + String? get bankCode => throw _privateConstructorUsedError; + String? get fingerprint => throw _privateConstructorUsedError; + String? get last4 => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SepaDebitCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SepaDebitCopyWith<$Res> { + factory $SepaDebitCopyWith(SepaDebit value, $Res Function(SepaDebit) then) = + _$SepaDebitCopyWithImpl<$Res>; + $Res call( + {String? country, String? bankCode, String? fingerprint, String? last4}); +} + +/// @nodoc +class _$SepaDebitCopyWithImpl<$Res> implements $SepaDebitCopyWith<$Res> { + _$SepaDebitCopyWithImpl(this._value, this._then); + + final SepaDebit _value; + // ignore: unused_field + final $Res Function(SepaDebit) _then; + + @override + $Res call({ + Object? country = freezed, + Object? bankCode = freezed, + Object? fingerprint = freezed, + Object? last4 = freezed, + }) { + return _then(_value.copyWith( + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + bankCode: bankCode == freezed + ? _value.bankCode + : bankCode // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$SepaDebitCopyWith<$Res> implements $SepaDebitCopyWith<$Res> { + factory _$SepaDebitCopyWith( + _SepaDebit value, $Res Function(_SepaDebit) then) = + __$SepaDebitCopyWithImpl<$Res>; + @override + $Res call( + {String? country, String? bankCode, String? fingerprint, String? last4}); +} + +/// @nodoc +class __$SepaDebitCopyWithImpl<$Res> extends _$SepaDebitCopyWithImpl<$Res> + implements _$SepaDebitCopyWith<$Res> { + __$SepaDebitCopyWithImpl(_SepaDebit _value, $Res Function(_SepaDebit) _then) + : super(_value, (v) => _then(v as _SepaDebit)); + + @override + _SepaDebit get _value => super._value as _SepaDebit; + + @override + $Res call({ + Object? country = freezed, + Object? bankCode = freezed, + Object? fingerprint = freezed, + Object? last4 = freezed, + }) { + return _then(_SepaDebit( + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + bankCode: bankCode == freezed + ? _value.bankCode + : bankCode // ignore: cast_nullable_to_non_nullable + as String?, + fingerprint: fingerprint == freezed + ? _value.fingerprint + : fingerprint // ignore: cast_nullable_to_non_nullable + as String?, + last4: last4 == freezed + ? _value.last4 + : last4 // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_SepaDebit implements _SepaDebit { + const _$_SepaDebit( + {this.country, this.bankCode, this.fingerprint, this.last4}); + + factory _$_SepaDebit.fromJson(Map json) => + _$_$_SepaDebitFromJson(json); + + @override + final String? country; + @override + final String? bankCode; + @override + final String? fingerprint; + @override + final String? last4; + + @override + String toString() { + return 'SepaDebit(country: $country, bankCode: $bankCode, fingerprint: $fingerprint, last4: $last4)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _SepaDebit && + (identical(other.country, country) || + const DeepCollectionEquality() + .equals(other.country, country)) && + (identical(other.bankCode, bankCode) || + const DeepCollectionEquality() + .equals(other.bankCode, bankCode)) && + (identical(other.fingerprint, fingerprint) || + const DeepCollectionEquality() + .equals(other.fingerprint, fingerprint)) && + (identical(other.last4, last4) || + const DeepCollectionEquality().equals(other.last4, last4))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(country) ^ + const DeepCollectionEquality().hash(bankCode) ^ + const DeepCollectionEquality().hash(fingerprint) ^ + const DeepCollectionEquality().hash(last4); + + @JsonKey(ignore: true) + @override + _$SepaDebitCopyWith<_SepaDebit> get copyWith => + __$SepaDebitCopyWithImpl<_SepaDebit>(this, _$identity); + + @override + Map toJson() { + return _$_$_SepaDebitToJson(this); + } +} + +abstract class _SepaDebit implements SepaDebit { + const factory _SepaDebit( + {String? country, + String? bankCode, + String? fingerprint, + String? last4}) = _$_SepaDebit; + + factory _SepaDebit.fromJson(Map json) = + _$_SepaDebit.fromJson; + + @override + String? get country => throw _privateConstructorUsedError; + @override + String? get bankCode => throw _privateConstructorUsedError; + @override + String? get fingerprint => throw _privateConstructorUsedError; + @override + String? get last4 => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$SepaDebitCopyWith<_SepaDebit> get copyWith => + throw _privateConstructorUsedError; +} + +Sofort _$SofortFromJson(Map json) { + return _Sofort.fromJson(json); +} + +/// @nodoc +class _$SofortTearOff { + const _$SofortTearOff(); + + _Sofort call({String? country}) { + return _Sofort( + country: country, + ); + } + + Sofort fromJson(Map json) { + return Sofort.fromJson(json); + } +} + +/// @nodoc +const $Sofort = _$SofortTearOff(); + +/// @nodoc +mixin _$Sofort { + String? get country => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SofortCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SofortCopyWith<$Res> { + factory $SofortCopyWith(Sofort value, $Res Function(Sofort) then) = + _$SofortCopyWithImpl<$Res>; + $Res call({String? country}); +} + +/// @nodoc +class _$SofortCopyWithImpl<$Res> implements $SofortCopyWith<$Res> { + _$SofortCopyWithImpl(this._value, this._then); + + final Sofort _value; + // ignore: unused_field + final $Res Function(Sofort) _then; + + @override + $Res call({ + Object? country = freezed, + }) { + return _then(_value.copyWith( + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$SofortCopyWith<$Res> implements $SofortCopyWith<$Res> { + factory _$SofortCopyWith(_Sofort value, $Res Function(_Sofort) then) = + __$SofortCopyWithImpl<$Res>; + @override + $Res call({String? country}); +} + +/// @nodoc +class __$SofortCopyWithImpl<$Res> extends _$SofortCopyWithImpl<$Res> + implements _$SofortCopyWith<$Res> { + __$SofortCopyWithImpl(_Sofort _value, $Res Function(_Sofort) _then) + : super(_value, (v) => _then(v as _Sofort)); + + @override + _Sofort get _value => super._value as _Sofort; + + @override + $Res call({ + Object? country = freezed, + }) { + return _then(_Sofort( + country: country == freezed + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Sofort implements _Sofort { + const _$_Sofort({this.country}); + + factory _$_Sofort.fromJson(Map json) => + _$_$_SofortFromJson(json); + + @override + final String? country; + + @override + String toString() { + return 'Sofort(country: $country)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Sofort && + (identical(other.country, country) || + const DeepCollectionEquality().equals(other.country, country))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ const DeepCollectionEquality().hash(country); + + @JsonKey(ignore: true) + @override + _$SofortCopyWith<_Sofort> get copyWith => + __$SofortCopyWithImpl<_Sofort>(this, _$identity); + + @override + Map toJson() { + return _$_$_SofortToJson(this); + } +} + +abstract class _Sofort implements Sofort { + const factory _Sofort({String? country}) = _$_Sofort; + + factory _Sofort.fromJson(Map json) = _$_Sofort.fromJson; + + @override + String? get country => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$SofortCopyWith<_Sofort> get copyWith => throw _privateConstructorUsedError; +} + +Upi _$UpiFromJson(Map json) { + return _Upi.fromJson(json); +} + +/// @nodoc +class _$UpiTearOff { + const _$UpiTearOff(); + + _Upi call({String? vpa}) { + return _Upi( + vpa: vpa, + ); + } + + Upi fromJson(Map json) { + return Upi.fromJson(json); + } +} + +/// @nodoc +const $Upi = _$UpiTearOff(); + +/// @nodoc +mixin _$Upi { + String? get vpa => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $UpiCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $UpiCopyWith<$Res> { + factory $UpiCopyWith(Upi value, $Res Function(Upi) then) = + _$UpiCopyWithImpl<$Res>; + $Res call({String? vpa}); +} + +/// @nodoc +class _$UpiCopyWithImpl<$Res> implements $UpiCopyWith<$Res> { + _$UpiCopyWithImpl(this._value, this._then); + + final Upi _value; + // ignore: unused_field + final $Res Function(Upi) _then; + + @override + $Res call({ + Object? vpa = freezed, + }) { + return _then(_value.copyWith( + vpa: vpa == freezed + ? _value.vpa + : vpa // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$UpiCopyWith<$Res> implements $UpiCopyWith<$Res> { + factory _$UpiCopyWith(_Upi value, $Res Function(_Upi) then) = + __$UpiCopyWithImpl<$Res>; + @override + $Res call({String? vpa}); +} + +/// @nodoc +class __$UpiCopyWithImpl<$Res> extends _$UpiCopyWithImpl<$Res> + implements _$UpiCopyWith<$Res> { + __$UpiCopyWithImpl(_Upi _value, $Res Function(_Upi) _then) + : super(_value, (v) => _then(v as _Upi)); + + @override + _Upi get _value => super._value as _Upi; + + @override + $Res call({ + Object? vpa = freezed, + }) { + return _then(_Upi( + vpa: vpa == freezed + ? _value.vpa + : vpa // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_Upi implements _Upi { + const _$_Upi({this.vpa}); + + factory _$_Upi.fromJson(Map json) => _$_$_UpiFromJson(json); + + @override + final String? vpa; + + @override + String toString() { + return 'Upi(vpa: $vpa)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _Upi && + (identical(other.vpa, vpa) || + const DeepCollectionEquality().equals(other.vpa, vpa))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ const DeepCollectionEquality().hash(vpa); + + @JsonKey(ignore: true) + @override + _$UpiCopyWith<_Upi> get copyWith => + __$UpiCopyWithImpl<_Upi>(this, _$identity); + + @override + Map toJson() { + return _$_$_UpiToJson(this); + } +} + +abstract class _Upi implements Upi { + const factory _Upi({String? vpa}) = _$_Upi; + + factory _Upi.fromJson(Map json) = _$_Upi.fromJson; + + @override + String? get vpa => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$UpiCopyWith<_Upi> get copyWith => throw _privateConstructorUsedError; +} + +PaymentMethodParams _$PaymentMethodParamsFromJson(Map json) { + switch (json['runtimeType'] as String) { + case 'card': + return _PaymentMethodParamsCard.fromJson(json); + case 'cardFromMethodId': + return _PaymentMethodParamsCardWithMethodId.fromJson(json); + case 'aliPay': + return _PaymentMethodParamsAli.fromJson(json); + + default: + throw FallThroughError(); + } +} + +/// @nodoc +class _$PaymentMethodParamsTearOff { + const _$PaymentMethodParamsTearOff(); + + _PaymentMethodParamsCard card( + {String type = 'card', + required CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage}) { + return _PaymentMethodParamsCard( + type: type, + details: details, + setupFutureUsage: setupFutureUsage, + ); + } + + _PaymentMethodParamsCardWithMethodId cardFromMethodId( + {String type = 'card', required String paymentMethodId, String? cvc}) { + return _PaymentMethodParamsCardWithMethodId( + type: type, + paymentMethodId: paymentMethodId, + cvc: cvc, + ); + } + + _PaymentMethodParamsAli aliPay({String type = 'Alipay'}) { + return _PaymentMethodParamsAli( + type: type, + ); + } + + PaymentMethodParams fromJson(Map json) { + return PaymentMethodParams.fromJson(json); + } +} + +/// @nodoc +const $PaymentMethodParams = _$PaymentMethodParamsTearOff(); + +/// @nodoc +mixin _$PaymentMethodParams { + String get type => throw _privateConstructorUsedError; + + @optionalTypeArgs + TResult when({ + required TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage) + card, + required TResult Function(String type, String paymentMethodId, String? cvc) + cardFromMethodId, + required TResult Function(String type) aliPay, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage)? + card, + TResult Function(String type, String paymentMethodId, String? cvc)? + cardFromMethodId, + TResult Function(String type)? aliPay, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(_PaymentMethodParamsCard value) card, + required TResult Function(_PaymentMethodParamsCardWithMethodId value) + cardFromMethodId, + required TResult Function(_PaymentMethodParamsAli value) aliPay, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_PaymentMethodParamsCard value)? card, + TResult Function(_PaymentMethodParamsCardWithMethodId value)? + cardFromMethodId, + TResult Function(_PaymentMethodParamsAli value)? aliPay, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PaymentMethodParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentMethodParamsCopyWith<$Res> { + factory $PaymentMethodParamsCopyWith( + PaymentMethodParams value, $Res Function(PaymentMethodParams) then) = + _$PaymentMethodParamsCopyWithImpl<$Res>; + $Res call({String type}); +} + +/// @nodoc +class _$PaymentMethodParamsCopyWithImpl<$Res> + implements $PaymentMethodParamsCopyWith<$Res> { + _$PaymentMethodParamsCopyWithImpl(this._value, this._then); + + final PaymentMethodParams _value; + // ignore: unused_field + final $Res Function(PaymentMethodParams) _then; + + @override + $Res call({ + Object? type = freezed, + }) { + return _then(_value.copyWith( + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +abstract class _$PaymentMethodParamsCardCopyWith<$Res> + implements $PaymentMethodParamsCopyWith<$Res> { + factory _$PaymentMethodParamsCardCopyWith(_PaymentMethodParamsCard value, + $Res Function(_PaymentMethodParamsCard) then) = + __$PaymentMethodParamsCardCopyWithImpl<$Res>; + @override + $Res call( + {String type, + CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage}); + + $CardFieldInputDetailsCopyWith<$Res> get details; +} + +/// @nodoc +class __$PaymentMethodParamsCardCopyWithImpl<$Res> + extends _$PaymentMethodParamsCopyWithImpl<$Res> + implements _$PaymentMethodParamsCardCopyWith<$Res> { + __$PaymentMethodParamsCardCopyWithImpl(_PaymentMethodParamsCard _value, + $Res Function(_PaymentMethodParamsCard) _then) + : super(_value, (v) => _then(v as _PaymentMethodParamsCard)); + + @override + _PaymentMethodParamsCard get _value => + super._value as _PaymentMethodParamsCard; + + @override + $Res call({ + Object? type = freezed, + Object? details = freezed, + Object? setupFutureUsage = freezed, + }) { + return _then(_PaymentMethodParamsCard( + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + details: details == freezed + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as CardFieldInputDetails, + setupFutureUsage: setupFutureUsage == freezed + ? _value.setupFutureUsage + : setupFutureUsage // ignore: cast_nullable_to_non_nullable + as PaymentIntentsFutureUsage?, + )); + } + + @override + $CardFieldInputDetailsCopyWith<$Res> get details { + return $CardFieldInputDetailsCopyWith<$Res>(_value.details, (value) { + return _then(_value.copyWith(details: value)); + }); + } +} + +@JsonSerializable() + +/// @nodoc +class _$_PaymentMethodParamsCard implements _PaymentMethodParamsCard { + const _$_PaymentMethodParamsCard( + {this.type = 'card', required this.details, this.setupFutureUsage}); + + factory _$_PaymentMethodParamsCard.fromJson(Map json) => + _$_$_PaymentMethodParamsCardFromJson(json); + + @JsonKey(defaultValue: 'card') + @override + final String type; + @override + final CardFieldInputDetails details; + @override + final PaymentIntentsFutureUsage? setupFutureUsage; + + @override + String toString() { + return 'PaymentMethodParams.card(type: $type, details: $details, setupFutureUsage: $setupFutureUsage)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _PaymentMethodParamsCard && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type)) && + (identical(other.details, details) || + const DeepCollectionEquality() + .equals(other.details, details)) && + (identical(other.setupFutureUsage, setupFutureUsage) || + const DeepCollectionEquality() + .equals(other.setupFutureUsage, setupFutureUsage))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(type) ^ + const DeepCollectionEquality().hash(details) ^ + const DeepCollectionEquality().hash(setupFutureUsage); + + @JsonKey(ignore: true) + @override + _$PaymentMethodParamsCardCopyWith<_PaymentMethodParamsCard> get copyWith => + __$PaymentMethodParamsCardCopyWithImpl<_PaymentMethodParamsCard>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage) + card, + required TResult Function(String type, String paymentMethodId, String? cvc) + cardFromMethodId, + required TResult Function(String type) aliPay, + }) { + return card(type, details, setupFutureUsage); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage)? + card, + TResult Function(String type, String paymentMethodId, String? cvc)? + cardFromMethodId, + TResult Function(String type)? aliPay, + required TResult orElse(), + }) { + if (card != null) { + return card(type, details, setupFutureUsage); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_PaymentMethodParamsCard value) card, + required TResult Function(_PaymentMethodParamsCardWithMethodId value) + cardFromMethodId, + required TResult Function(_PaymentMethodParamsAli value) aliPay, + }) { + return card(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_PaymentMethodParamsCard value)? card, + TResult Function(_PaymentMethodParamsCardWithMethodId value)? + cardFromMethodId, + TResult Function(_PaymentMethodParamsAli value)? aliPay, + required TResult orElse(), + }) { + if (card != null) { + return card(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$_$_PaymentMethodParamsCardToJson(this)..['runtimeType'] = 'card'; + } +} + +abstract class _PaymentMethodParamsCard implements PaymentMethodParams { + const factory _PaymentMethodParamsCard( + {String type, + required CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage}) = + _$_PaymentMethodParamsCard; + + factory _PaymentMethodParamsCard.fromJson(Map json) = + _$_PaymentMethodParamsCard.fromJson; + + @override + String get type => throw _privateConstructorUsedError; + CardFieldInputDetails get details => throw _privateConstructorUsedError; + PaymentIntentsFutureUsage? get setupFutureUsage => + throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$PaymentMethodParamsCardCopyWith<_PaymentMethodParamsCard> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$PaymentMethodParamsCardWithMethodIdCopyWith<$Res> + implements $PaymentMethodParamsCopyWith<$Res> { + factory _$PaymentMethodParamsCardWithMethodIdCopyWith( + _PaymentMethodParamsCardWithMethodId value, + $Res Function(_PaymentMethodParamsCardWithMethodId) then) = + __$PaymentMethodParamsCardWithMethodIdCopyWithImpl<$Res>; + @override + $Res call({String type, String paymentMethodId, String? cvc}); +} + +/// @nodoc +class __$PaymentMethodParamsCardWithMethodIdCopyWithImpl<$Res> + extends _$PaymentMethodParamsCopyWithImpl<$Res> + implements _$PaymentMethodParamsCardWithMethodIdCopyWith<$Res> { + __$PaymentMethodParamsCardWithMethodIdCopyWithImpl( + _PaymentMethodParamsCardWithMethodId _value, + $Res Function(_PaymentMethodParamsCardWithMethodId) _then) + : super(_value, (v) => _then(v as _PaymentMethodParamsCardWithMethodId)); + + @override + _PaymentMethodParamsCardWithMethodId get _value => + super._value as _PaymentMethodParamsCardWithMethodId; + + @override + $Res call({ + Object? type = freezed, + Object? paymentMethodId = freezed, + Object? cvc = freezed, + }) { + return _then(_PaymentMethodParamsCardWithMethodId( + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + paymentMethodId: paymentMethodId == freezed + ? _value.paymentMethodId + : paymentMethodId // ignore: cast_nullable_to_non_nullable + as String, + cvc: cvc == freezed + ? _value.cvc + : cvc // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable() + +/// @nodoc +class _$_PaymentMethodParamsCardWithMethodId + implements _PaymentMethodParamsCardWithMethodId { + const _$_PaymentMethodParamsCardWithMethodId( + {this.type = 'card', required this.paymentMethodId, this.cvc}); + + factory _$_PaymentMethodParamsCardWithMethodId.fromJson( + Map json) => + _$_$_PaymentMethodParamsCardWithMethodIdFromJson(json); + + @JsonKey(defaultValue: 'card') + @override + final String type; + @override + final String paymentMethodId; + @override + final String? cvc; + + @override + String toString() { + return 'PaymentMethodParams.cardFromMethodId(type: $type, paymentMethodId: $paymentMethodId, cvc: $cvc)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _PaymentMethodParamsCardWithMethodId && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type)) && + (identical(other.paymentMethodId, paymentMethodId) || + const DeepCollectionEquality() + .equals(other.paymentMethodId, paymentMethodId)) && + (identical(other.cvc, cvc) || + const DeepCollectionEquality().equals(other.cvc, cvc))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(type) ^ + const DeepCollectionEquality().hash(paymentMethodId) ^ + const DeepCollectionEquality().hash(cvc); + + @JsonKey(ignore: true) + @override + _$PaymentMethodParamsCardWithMethodIdCopyWith< + _PaymentMethodParamsCardWithMethodId> + get copyWith => __$PaymentMethodParamsCardWithMethodIdCopyWithImpl< + _PaymentMethodParamsCardWithMethodId>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage) + card, + required TResult Function(String type, String paymentMethodId, String? cvc) + cardFromMethodId, + required TResult Function(String type) aliPay, + }) { + return cardFromMethodId(type, paymentMethodId, cvc); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage)? + card, + TResult Function(String type, String paymentMethodId, String? cvc)? + cardFromMethodId, + TResult Function(String type)? aliPay, + required TResult orElse(), + }) { + if (cardFromMethodId != null) { + return cardFromMethodId(type, paymentMethodId, cvc); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_PaymentMethodParamsCard value) card, + required TResult Function(_PaymentMethodParamsCardWithMethodId value) + cardFromMethodId, + required TResult Function(_PaymentMethodParamsAli value) aliPay, + }) { + return cardFromMethodId(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_PaymentMethodParamsCard value)? card, + TResult Function(_PaymentMethodParamsCardWithMethodId value)? + cardFromMethodId, + TResult Function(_PaymentMethodParamsAli value)? aliPay, + required TResult orElse(), + }) { + if (cardFromMethodId != null) { + return cardFromMethodId(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$_$_PaymentMethodParamsCardWithMethodIdToJson(this) + ..['runtimeType'] = 'cardFromMethodId'; + } +} + +abstract class _PaymentMethodParamsCardWithMethodId + implements PaymentMethodParams { + const factory _PaymentMethodParamsCardWithMethodId( + {String type, + required String paymentMethodId, + String? cvc}) = _$_PaymentMethodParamsCardWithMethodId; + + factory _PaymentMethodParamsCardWithMethodId.fromJson( + Map json) = + _$_PaymentMethodParamsCardWithMethodId.fromJson; + + @override + String get type => throw _privateConstructorUsedError; + String get paymentMethodId => throw _privateConstructorUsedError; + String? get cvc => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$PaymentMethodParamsCardWithMethodIdCopyWith< + _PaymentMethodParamsCardWithMethodId> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$PaymentMethodParamsAliCopyWith<$Res> + implements $PaymentMethodParamsCopyWith<$Res> { + factory _$PaymentMethodParamsAliCopyWith(_PaymentMethodParamsAli value, + $Res Function(_PaymentMethodParamsAli) then) = + __$PaymentMethodParamsAliCopyWithImpl<$Res>; + @override + $Res call({String type}); +} + +/// @nodoc +class __$PaymentMethodParamsAliCopyWithImpl<$Res> + extends _$PaymentMethodParamsCopyWithImpl<$Res> + implements _$PaymentMethodParamsAliCopyWith<$Res> { + __$PaymentMethodParamsAliCopyWithImpl(_PaymentMethodParamsAli _value, + $Res Function(_PaymentMethodParamsAli) _then) + : super(_value, (v) => _then(v as _PaymentMethodParamsAli)); + + @override + _PaymentMethodParamsAli get _value => super._value as _PaymentMethodParamsAli; + + @override + $Res call({ + Object? type = freezed, + }) { + return _then(_PaymentMethodParamsAli( + type: type == freezed + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +@JsonSerializable() + +/// @nodoc +class _$_PaymentMethodParamsAli implements _PaymentMethodParamsAli { + const _$_PaymentMethodParamsAli({this.type = 'Alipay'}); + + factory _$_PaymentMethodParamsAli.fromJson(Map json) => + _$_$_PaymentMethodParamsAliFromJson(json); + + @JsonKey(defaultValue: 'Alipay') + @override + final String type; + + @override + String toString() { + return 'PaymentMethodParams.aliPay(type: $type)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _PaymentMethodParamsAli && + (identical(other.type, type) || + const DeepCollectionEquality().equals(other.type, type))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ const DeepCollectionEquality().hash(type); + + @JsonKey(ignore: true) + @override + _$PaymentMethodParamsAliCopyWith<_PaymentMethodParamsAli> get copyWith => + __$PaymentMethodParamsAliCopyWithImpl<_PaymentMethodParamsAli>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage) + card, + required TResult Function(String type, String paymentMethodId, String? cvc) + cardFromMethodId, + required TResult Function(String type) aliPay, + }) { + return aliPay(type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String type, CardFieldInputDetails details, + PaymentIntentsFutureUsage? setupFutureUsage)? + card, + TResult Function(String type, String paymentMethodId, String? cvc)? + cardFromMethodId, + TResult Function(String type)? aliPay, + required TResult orElse(), + }) { + if (aliPay != null) { + return aliPay(type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(_PaymentMethodParamsCard value) card, + required TResult Function(_PaymentMethodParamsCardWithMethodId value) + cardFromMethodId, + required TResult Function(_PaymentMethodParamsAli value) aliPay, + }) { + return aliPay(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_PaymentMethodParamsCard value)? card, + TResult Function(_PaymentMethodParamsCardWithMethodId value)? + cardFromMethodId, + TResult Function(_PaymentMethodParamsAli value)? aliPay, + required TResult orElse(), + }) { + if (aliPay != null) { + return aliPay(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$_$_PaymentMethodParamsAliToJson(this)..['runtimeType'] = 'aliPay'; + } +} + +abstract class _PaymentMethodParamsAli implements PaymentMethodParams { + const factory _PaymentMethodParamsAli({String type}) = + _$_PaymentMethodParamsAli; + + factory _PaymentMethodParamsAli.fromJson(Map json) = + _$_PaymentMethodParamsAli.fromJson; + + @override + String get type => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$PaymentMethodParamsAliCopyWith<_PaymentMethodParamsAli> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/payment_methods.g.dart b/stripe_platform_interface/lib/src/models/payment_methods.g.dart index ba6d0f628..c4e0fd21c 100644 --- a/stripe_platform_interface/lib/src/models/payment_methods.g.dart +++ b/stripe_platform_interface/lib/src/models/payment_methods.g.dart @@ -6,8 +6,8 @@ part of 'payment_methods.dart'; // JsonSerializableGenerator // ************************************************************************** -PaymentMethod _$PaymentMethodFromJson(Map json) { - return PaymentMethod( +_$_PaymentMethod _$_$_PaymentMethodFromJson(Map json) { + return _$_PaymentMethod( id: json['id'] as String, liveMode: json['liveMode'] as bool, customerId: json['customerId'] as String, @@ -26,7 +26,7 @@ PaymentMethod _$PaymentMethodFromJson(Map json) { ); } -Map _$PaymentMethodToJson(PaymentMethod instance) => +Map _$_$_PaymentMethodToJson(_$_PaymentMethod instance) => { 'id': instance.id, 'liveMode': instance.liveMode, @@ -90,150 +90,76 @@ const _$PaymentMethodTypeEnumMap = { PaymentMethodType.Unknown: 'Unknown', }; -AliPayParams _$AliPayParamsFromJson(Map json) { - return AliPayParams() - ..billingDetails = json['billingDetails'] == null - ? null - : BillingDetails.fromJson( - json['billingDetails'] as Map); -} - -Map _$AliPayParamsToJson(AliPayParams instance) => - { - 'billingDetails': instance.billingDetails?.toJson(), - }; - -_DetailedCardParams _$_DetailedCardParamsFromJson(Map json) { - return _DetailedCardParams( - CardFieldInputDetails.fromJson(json['details'] as Map), - _$enumDecodeNullable( - _$PaymentIntentsFutureUsageEnumMap, json['setupFutureUsage']), - )..billingDetails = json['billingDetails'] == null - ? null - : BillingDetails.fromJson(json['billingDetails'] as Map); -} - -Map _$_DetailedCardParamsToJson( - _DetailedCardParams instance) => - { - 'billingDetails': instance.billingDetails?.toJson(), - 'details': instance.details.toJson(), - 'setupFutureUsage': - _$PaymentIntentsFutureUsageEnumMap[instance.setupFutureUsage], - }; - -K? _$enumDecodeNullable( - Map enumValues, - dynamic source, { - K? unknownValue, -}) { - if (source == null) { - return null; - } - return _$enumDecode(enumValues, source, unknownValue: unknownValue); -} - -const _$PaymentIntentsFutureUsageEnumMap = { - PaymentIntentsFutureUsage.OffSession: 'OffSession', - PaymentIntentsFutureUsage.OnSession: 'OnSession', -}; - -_PaymentMethodCardParams _$_PaymentMethodCardParamsFromJson( - Map json) { - return _PaymentMethodCardParams( - json['paymentMethodId'] as String, - json['cvc'] as String?, - )..billingDetails = json['billingDetails'] == null - ? null - : BillingDetails.fromJson(json['billingDetails'] as Map); -} - -Map _$_PaymentMethodCardParamsToJson( - _PaymentMethodCardParams instance) => - { - 'billingDetails': instance.billingDetails?.toJson(), - 'paymentMethodId': instance.paymentMethodId, - 'cvc': instance.cvc, - }; - -BillingDetails _$BillingDetailsFromJson(Map json) { - return BillingDetails( +_$_BillingDetails _$_$_BillingDetailsFromJson(Map json) { + return _$_BillingDetails( email: json['email'] as String?, phone: json['phone'] as String?, name: json['name'] as String?, - address: json['address'] == null - ? null - : Address.fromJson(json['address'] as Map), + adressPostalCode: json['adressPostalCode'] as String?, + addressCity: json['addressCity'] as String?, + addressCountry: json['addressCountry'] as String?, + addressLine1: json['addressLine1'] as String?, + addressLine2: json['addressLine2'] as String?, + addressLine3: json['addressLine3'] as String?, ); } -Map _$BillingDetailsToJson(BillingDetails instance) => +Map _$_$_BillingDetailsToJson(_$_BillingDetails instance) => { 'email': instance.email, 'phone': instance.phone, 'name': instance.name, - 'address': instance.address?.toJson(), + 'adressPostalCode': instance.adressPostalCode, + 'addressCity': instance.addressCity, + 'addressCountry': instance.addressCountry, + 'addressLine1': instance.addressLine1, + 'addressLine2': instance.addressLine2, + 'addressLine3': instance.addressLine3, }; -Address _$AddressFromJson(Map json) { - return Address( - city: json['city'] as String, - county: json['county'] as String, - line1: json['line1'] as String, - line2: json['line2'] as String, - postalCode: json['postalCode'] as String, - state: json['state'] as String, +_$_AuBecsDebit _$_$_AuBecsDebitFromJson(Map json) { + return _$_AuBecsDebit( + fingerprint: json['fingerprint'] as String?, + last4: json['last4'] as String?, + bsbNumber: json['bsbNumber'] as String?, ); } -Map _$AddressToJson(Address instance) => { - 'city': instance.city, - 'county': instance.county, - 'line1': instance.line1, - 'line2': instance.line2, - 'postalCode': instance.postalCode, - 'state': instance.state, - }; - -AuBecsDebit _$AuBecsDebitFromJson(Map json) { - return AuBecsDebit() - ..fingerprint = json['fingerprint'] as String? - ..last4 = json['last4'] as String? - ..bsbNumber = json['bsbNumber'] as String?; -} - -Map _$AuBecsDebitToJson(AuBecsDebit instance) => +Map _$_$_AuBecsDebitToJson(_$_AuBecsDebit instance) => { 'fingerprint': instance.fingerprint, 'last4': instance.last4, 'bsbNumber': instance.bsbNumber, }; -BacsDebit _$BacsDebitFromJson(Map json) { - return BacsDebit() - ..sortCode = json['sortCode'] as String? - ..fingerprint = json['fingerprint'] as String? - ..last4 = json['last4'] as String?; +_$_BacsDebit _$_$_BacsDebitFromJson(Map json) { + return _$_BacsDebit( + sortCode: json['sortCode'] as String?, + fingerprint: json['fingerprint'] as String?, + last4: json['last4'] as String?, + ); } -Map _$BacsDebitToJson(BacsDebit instance) => { +Map _$_$_BacsDebitToJson(_$_BacsDebit instance) => + { 'sortCode': instance.sortCode, 'fingerprint': instance.fingerprint, 'last4': instance.last4, }; -Card _$CardFromJson(Map json) { - return Card() - ..brand = _$enumDecodeNullable(_$CardBrandEnumMap, json['brand']) - ..country = json['country'] as String? - ..expYear = json['expYear'] as String? - ..expMonth = json['expMonth'] as String? - ..fingerprint = json['fingerprint'] as String? - ..funding = json['funding'] as String? - ..last4 = json['last4'] as String?; +_$_Card _$_$_CardFromJson(Map json) { + return _$_Card( + brand: _$enumDecodeNullable(_$CardBrandEnumMap, json['brand']), + country: json['country'] as String?, + expYear: json['expYear'] as String?, + expMonth: json['expMonth'] as String?, + fingerprint: json['fingerprint'] as String?, + funding: json['funding'] as String?, + last4: json['last4'] as String?, + ); } -Map _$CardToJson(Card instance) => { +Map _$_$_CardToJson(_$_Card instance) => { 'brand': _$CardBrandEnumMap[instance.brand], 'country': instance.country, 'expYear': instance.expYear, @@ -243,6 +169,17 @@ Map _$CardToJson(Card instance) => { 'last4': instance.last4, }; +K? _$enumDecodeNullable( + Map enumValues, + dynamic source, { + K? unknownValue, +}) { + if (source == null) { + return null; + } + return _$enumDecode(enumValues, source, unknownValue: unknownValue); +} + const _$CardBrandEnumMap = { CardBrand.american: 'american', CardBrand.dinersClub: 'dinersClub', @@ -254,52 +191,117 @@ const _$CardBrandEnumMap = { CardBrand.unknown: 'unknown', }; -Fpx _$FpxFromJson(Map json) { - return Fpx()..bank = json['bank'] as String?; +_$_Fpx _$_$_FpxFromJson(Map json) { + return _$_Fpx( + bank: json['bank'] as String?, + ); } -Map _$FpxToJson(Fpx instance) => { +Map _$_$_FpxToJson(_$_Fpx instance) => { 'bank': instance.bank, }; -Ideal _$IdealFromJson(Map json) { - return Ideal() - ..bankIdentifierCode = json['bankIdentifierCode'] as String? - ..bank = json['bank'] as String?; +_$_Ideal _$_$_IdealFromJson(Map json) { + return _$_Ideal( + bankIdentifierCode: json['bankIdentifierCode'] as String?, + bank: json['bank'] as String?, + ); } -Map _$IdealToJson(Ideal instance) => { +Map _$_$_IdealToJson(_$_Ideal instance) => { 'bankIdentifierCode': instance.bankIdentifierCode, 'bank': instance.bank, }; -SepaDebit _$SepaDebitFromJson(Map json) { - return SepaDebit() - ..country = json['country'] as String? - ..bankCode = json['bankCode'] as String? - ..fingerprint = json['fingerprint'] as String? - ..last4 = json['last4'] as String?; +_$_SepaDebit _$_$_SepaDebitFromJson(Map json) { + return _$_SepaDebit( + country: json['country'] as String?, + bankCode: json['bankCode'] as String?, + fingerprint: json['fingerprint'] as String?, + last4: json['last4'] as String?, + ); } -Map _$SepaDebitToJson(SepaDebit instance) => { +Map _$_$_SepaDebitToJson(_$_SepaDebit instance) => + { 'country': instance.country, 'bankCode': instance.bankCode, 'fingerprint': instance.fingerprint, 'last4': instance.last4, }; -Sofort _$SofortFromJson(Map json) { - return Sofort()..country = json['country'] as String?; +_$_Sofort _$_$_SofortFromJson(Map json) { + return _$_Sofort( + country: json['country'] as String?, + ); } -Map _$SofortToJson(Sofort instance) => { +Map _$_$_SofortToJson(_$_Sofort instance) => { 'country': instance.country, }; -Upi _$UpiFromJson(Map json) { - return Upi()..vpa = json['vpa'] as String?; +_$_Upi _$_$_UpiFromJson(Map json) { + return _$_Upi( + vpa: json['vpa'] as String?, + ); } -Map _$UpiToJson(Upi instance) => { +Map _$_$_UpiToJson(_$_Upi instance) => { 'vpa': instance.vpa, }; + +_$_PaymentMethodParamsCard _$_$_PaymentMethodParamsCardFromJson( + Map json) { + return _$_PaymentMethodParamsCard( + type: json['type'] as String? ?? 'card', + details: + CardFieldInputDetails.fromJson(json['details'] as Map), + setupFutureUsage: _$enumDecodeNullable( + _$PaymentIntentsFutureUsageEnumMap, json['setupFutureUsage']), + ); +} + +Map _$_$_PaymentMethodParamsCardToJson( + _$_PaymentMethodParamsCard instance) => + { + 'type': instance.type, + 'details': instance.details, + 'setupFutureUsage': + _$PaymentIntentsFutureUsageEnumMap[instance.setupFutureUsage], + }; + +const _$PaymentIntentsFutureUsageEnumMap = { + PaymentIntentsFutureUsage.OffSession: 'OffSession', + PaymentIntentsFutureUsage.OnSession: 'OnSession', +}; + +_$_PaymentMethodParamsCardWithMethodId + _$_$_PaymentMethodParamsCardWithMethodIdFromJson( + Map json) { + return _$_PaymentMethodParamsCardWithMethodId( + type: json['type'] as String? ?? 'card', + paymentMethodId: json['paymentMethodId'] as String, + cvc: json['cvc'] as String?, + ); +} + +Map _$_$_PaymentMethodParamsCardWithMethodIdToJson( + _$_PaymentMethodParamsCardWithMethodId instance) => + { + 'type': instance.type, + 'paymentMethodId': instance.paymentMethodId, + 'cvc': instance.cvc, + }; + +_$_PaymentMethodParamsAli _$_$_PaymentMethodParamsAliFromJson( + Map json) { + return _$_PaymentMethodParamsAli( + type: json['type'] as String? ?? 'Alipay', + ); +} + +Map _$_$_PaymentMethodParamsAliToJson( + _$_PaymentMethodParamsAli instance) => + { + 'type': instance.type, + }; diff --git a/stripe_platform_interface/lib/src/models/payment_sheet.dart b/stripe_platform_interface/lib/src/models/payment_sheet.dart index 7772631fe..1703d2e8a 100644 --- a/stripe_platform_interface/lib/src/models/payment_sheet.dart +++ b/stripe_platform_interface/lib/src/models/payment_sheet.dart @@ -15,10 +15,23 @@ class PaymentSheetApplePayParams { 'merchantCountryCode is required when using apple pay', ); - factory PaymentSheetApplePayParams.fromJson(Map json) => + factory PaymentSheetApplePayParams.fromJson(Map json) => _$PaymentSheetApplePayParamsFromJson(json); Map toJson() => _$PaymentSheetApplePayParamsToJson(this); + + @override + bool operator ==(Object other) => + other is PaymentSheetApplePayParams && + applePay == other.applePay && + merchantCountryCode == other.merchantCountryCode; + + @override + int get hashCode => + runtimeType.hashCode * 37 + + applePay.hashCode + + merchantCountryCode.hashCode; } + @JsonSerializable(explicitToJson: true) class SetupPaymentSheetParams extends PaymentSheetApplePayParams { final String customerId; @@ -27,9 +40,9 @@ class SetupPaymentSheetParams extends PaymentSheetApplePayParams { final bool? customFlow; final String? merchantDisplayName; - final PaymentSheetBrightness? style; + final PaymentSheetBrightness? style; - SetupPaymentSheetParams( { + SetupPaymentSheetParams({ required this.customerId, required this.customerEphemeralKeySecret, required this.paymentIntentClientSecret, @@ -40,12 +53,38 @@ class SetupPaymentSheetParams extends PaymentSheetApplePayParams { this.style, }); - factory SetupPaymentSheetParams.fromJson(Map json) => + factory SetupPaymentSheetParams.fromJson(Map json) => _$SetupPaymentSheetParamsFromJson(json); Map toJson() => _$SetupPaymentSheetParamsToJson(this); + + @override + bool operator ==(Object other) => + other is SetupPaymentSheetParams && + customerId == other.customerId && + customerEphemeralKeySecret == other.customerEphemeralKeySecret && + customFlow == other.customFlow && + merchantDisplayName == other.merchantDisplayName && + style == other.style && + applePay == other.applePay && + merchantCountryCode == other.merchantCountryCode; + + @override + int get hashCode => + runtimeType.hashCode * 37 + + customerId.hashCode + + customerEphemeralKeySecret.hashCode + + customFlow.hashCode + + merchantDisplayName.hashCode + + style.hashCode + + applePay.hashCode + + merchantCountryCode.hashCode; } -enum PaymentSheetBrightness { alwaysLight, alwaysDark, automatic } // This should be sync with the theme +enum PaymentSheetBrightness { + alwaysLight, + alwaysDark, + automatic +} // This should be sync with the theme enum PaymentSheetError { Failed, Canceled } diff --git a/stripe_platform_interface/lib/src/models/setup_intent.dart b/stripe_platform_interface/lib/src/models/setup_intent.dart index 4f900a933..69d131c33 100644 --- a/stripe_platform_interface/lib/src/models/setup_intent.dart +++ b/stripe_platform_interface/lib/src/models/setup_intent.dart @@ -1,30 +1,27 @@ -import 'package:stripe_platform_interface/src/models/errors.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stripe_platform_interface/src/models/payment_methods.dart'; -class SetupIntent { - String id; - String clientSecret; - StripeError? lastSetupError; - String? created; - bool livemode; - String? paymentMethodId; - SetupStatus status; - List paymentMethodTypes; - FutureUsage usage; - String? description; +part 'setup_intent.freezed.dart'; +part 'setup_intent.g.dart'; - SetupIntent({ - required this.id, - required this.clientSecret, - this.lastSetupError, - this.created, - required this.livemode, - this.paymentMethodId, - required this.status, - required this.paymentMethodTypes, - required this.usage, - this.description, - }); +@freezed +class SetupIntent with _$SetupIntent { + @JsonSerializable(explicitToJson: true) + const factory SetupIntent({ + required String id, + required String clientSecret, + required bool livemode, + required SetupStatus status, + required List paymentMethodTypes, + required FutureUsage usage, + // StripeError? lastSetupError, + String? created, + String? paymentMethodId, + String? description, + }) = _SetupIntent; + + factory SetupIntent.fromJson(Map json) => + _$SetupIntentFromJson(json); } enum FutureUsage { unknown, none, onSession, offSession, oneTime } diff --git a/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart b/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart new file mode 100644 index 000000000..5dce12093 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/setup_intent.freezed.dart @@ -0,0 +1,368 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// 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 + +part of 'setup_intent.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 informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +SetupIntent _$SetupIntentFromJson(Map json) { + return _SetupIntent.fromJson(json); +} + +/// @nodoc +class _$SetupIntentTearOff { + const _$SetupIntentTearOff(); + + _SetupIntent call( + {required String id, + required String clientSecret, + required bool livemode, + required SetupStatus status, + required List paymentMethodTypes, + required FutureUsage usage, + String? created, + String? paymentMethodId, + String? description}) { + return _SetupIntent( + id: id, + clientSecret: clientSecret, + livemode: livemode, + status: status, + paymentMethodTypes: paymentMethodTypes, + usage: usage, + created: created, + paymentMethodId: paymentMethodId, + description: description, + ); + } + + SetupIntent fromJson(Map json) { + return SetupIntent.fromJson(json); + } +} + +/// @nodoc +const $SetupIntent = _$SetupIntentTearOff(); + +/// @nodoc +mixin _$SetupIntent { + String get id => throw _privateConstructorUsedError; + String get clientSecret => throw _privateConstructorUsedError; + bool get livemode => throw _privateConstructorUsedError; + SetupStatus get status => throw _privateConstructorUsedError; + List get paymentMethodTypes => + throw _privateConstructorUsedError; + FutureUsage get usage => + throw _privateConstructorUsedError; // StripeError? lastSetupError, + String? get created => throw _privateConstructorUsedError; + String? get paymentMethodId => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SetupIntentCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SetupIntentCopyWith<$Res> { + factory $SetupIntentCopyWith( + SetupIntent value, $Res Function(SetupIntent) then) = + _$SetupIntentCopyWithImpl<$Res>; + $Res call( + {String id, + String clientSecret, + bool livemode, + SetupStatus status, + List paymentMethodTypes, + FutureUsage usage, + String? created, + String? paymentMethodId, + String? description}); +} + +/// @nodoc +class _$SetupIntentCopyWithImpl<$Res> implements $SetupIntentCopyWith<$Res> { + _$SetupIntentCopyWithImpl(this._value, this._then); + + final SetupIntent _value; + // ignore: unused_field + final $Res Function(SetupIntent) _then; + + @override + $Res call({ + Object? id = freezed, + Object? clientSecret = freezed, + Object? livemode = freezed, + Object? status = freezed, + Object? paymentMethodTypes = freezed, + Object? usage = freezed, + Object? created = freezed, + Object? paymentMethodId = freezed, + Object? description = freezed, + }) { + return _then(_value.copyWith( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + clientSecret: clientSecret == freezed + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + livemode: livemode == freezed + ? _value.livemode + : livemode // ignore: cast_nullable_to_non_nullable + as bool, + status: status == freezed + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as SetupStatus, + paymentMethodTypes: paymentMethodTypes == freezed + ? _value.paymentMethodTypes + : paymentMethodTypes // ignore: cast_nullable_to_non_nullable + as List, + usage: usage == freezed + ? _value.usage + : usage // ignore: cast_nullable_to_non_nullable + as FutureUsage, + created: created == freezed + ? _value.created + : created // ignore: cast_nullable_to_non_nullable + as String?, + paymentMethodId: paymentMethodId == freezed + ? _value.paymentMethodId + : paymentMethodId // ignore: cast_nullable_to_non_nullable + as String?, + description: description == freezed + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +abstract class _$SetupIntentCopyWith<$Res> + implements $SetupIntentCopyWith<$Res> { + factory _$SetupIntentCopyWith( + _SetupIntent value, $Res Function(_SetupIntent) then) = + __$SetupIntentCopyWithImpl<$Res>; + @override + $Res call( + {String id, + String clientSecret, + bool livemode, + SetupStatus status, + List paymentMethodTypes, + FutureUsage usage, + String? created, + String? paymentMethodId, + String? description}); +} + +/// @nodoc +class __$SetupIntentCopyWithImpl<$Res> extends _$SetupIntentCopyWithImpl<$Res> + implements _$SetupIntentCopyWith<$Res> { + __$SetupIntentCopyWithImpl( + _SetupIntent _value, $Res Function(_SetupIntent) _then) + : super(_value, (v) => _then(v as _SetupIntent)); + + @override + _SetupIntent get _value => super._value as _SetupIntent; + + @override + $Res call({ + Object? id = freezed, + Object? clientSecret = freezed, + Object? livemode = freezed, + Object? status = freezed, + Object? paymentMethodTypes = freezed, + Object? usage = freezed, + Object? created = freezed, + Object? paymentMethodId = freezed, + Object? description = freezed, + }) { + return _then(_SetupIntent( + id: id == freezed + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + clientSecret: clientSecret == freezed + ? _value.clientSecret + : clientSecret // ignore: cast_nullable_to_non_nullable + as String, + livemode: livemode == freezed + ? _value.livemode + : livemode // ignore: cast_nullable_to_non_nullable + as bool, + status: status == freezed + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as SetupStatus, + paymentMethodTypes: paymentMethodTypes == freezed + ? _value.paymentMethodTypes + : paymentMethodTypes // ignore: cast_nullable_to_non_nullable + as List, + usage: usage == freezed + ? _value.usage + : usage // ignore: cast_nullable_to_non_nullable + as FutureUsage, + created: created == freezed + ? _value.created + : created // ignore: cast_nullable_to_non_nullable + as String?, + paymentMethodId: paymentMethodId == freezed + ? _value.paymentMethodId + : paymentMethodId // ignore: cast_nullable_to_non_nullable + as String?, + description: description == freezed + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +@JsonSerializable(explicitToJson: true) + +/// @nodoc +class _$_SetupIntent implements _SetupIntent { + const _$_SetupIntent( + {required this.id, + required this.clientSecret, + required this.livemode, + required this.status, + required this.paymentMethodTypes, + required this.usage, + this.created, + this.paymentMethodId, + this.description}); + + factory _$_SetupIntent.fromJson(Map json) => + _$_$_SetupIntentFromJson(json); + + @override + final String id; + @override + final String clientSecret; + @override + final bool livemode; + @override + final SetupStatus status; + @override + final List paymentMethodTypes; + @override + final FutureUsage usage; + @override // StripeError? lastSetupError, + final String? created; + @override + final String? paymentMethodId; + @override + final String? description; + + @override + String toString() { + return 'SetupIntent(id: $id, clientSecret: $clientSecret, livemode: $livemode, status: $status, paymentMethodTypes: $paymentMethodTypes, usage: $usage, created: $created, paymentMethodId: $paymentMethodId, description: $description)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _SetupIntent && + (identical(other.id, id) || + const DeepCollectionEquality().equals(other.id, id)) && + (identical(other.clientSecret, clientSecret) || + const DeepCollectionEquality() + .equals(other.clientSecret, clientSecret)) && + (identical(other.livemode, livemode) || + const DeepCollectionEquality() + .equals(other.livemode, livemode)) && + (identical(other.status, status) || + const DeepCollectionEquality().equals(other.status, status)) && + (identical(other.paymentMethodTypes, paymentMethodTypes) || + const DeepCollectionEquality() + .equals(other.paymentMethodTypes, paymentMethodTypes)) && + (identical(other.usage, usage) || + const DeepCollectionEquality().equals(other.usage, usage)) && + (identical(other.created, created) || + const DeepCollectionEquality() + .equals(other.created, created)) && + (identical(other.paymentMethodId, paymentMethodId) || + const DeepCollectionEquality() + .equals(other.paymentMethodId, paymentMethodId)) && + (identical(other.description, description) || + const DeepCollectionEquality() + .equals(other.description, description))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(id) ^ + const DeepCollectionEquality().hash(clientSecret) ^ + const DeepCollectionEquality().hash(livemode) ^ + const DeepCollectionEquality().hash(status) ^ + const DeepCollectionEquality().hash(paymentMethodTypes) ^ + const DeepCollectionEquality().hash(usage) ^ + const DeepCollectionEquality().hash(created) ^ + const DeepCollectionEquality().hash(paymentMethodId) ^ + const DeepCollectionEquality().hash(description); + + @JsonKey(ignore: true) + @override + _$SetupIntentCopyWith<_SetupIntent> get copyWith => + __$SetupIntentCopyWithImpl<_SetupIntent>(this, _$identity); + + @override + Map toJson() { + return _$_$_SetupIntentToJson(this); + } +} + +abstract class _SetupIntent implements SetupIntent { + const factory _SetupIntent( + {required String id, + required String clientSecret, + required bool livemode, + required SetupStatus status, + required List paymentMethodTypes, + required FutureUsage usage, + String? created, + String? paymentMethodId, + String? description}) = _$_SetupIntent; + + factory _SetupIntent.fromJson(Map json) = + _$_SetupIntent.fromJson; + + @override + String get id => throw _privateConstructorUsedError; + @override + String get clientSecret => throw _privateConstructorUsedError; + @override + bool get livemode => throw _privateConstructorUsedError; + @override + SetupStatus get status => throw _privateConstructorUsedError; + @override + List get paymentMethodTypes => + throw _privateConstructorUsedError; + @override + FutureUsage get usage => throw _privateConstructorUsedError; + @override // StripeError? lastSetupError, + String? get created => throw _privateConstructorUsedError; + @override + String? get paymentMethodId => throw _privateConstructorUsedError; + @override + String? get description => throw _privateConstructorUsedError; + @override + @JsonKey(ignore: true) + _$SetupIntentCopyWith<_SetupIntent> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/stripe_platform_interface/lib/src/models/setup_intent.g.dart b/stripe_platform_interface/lib/src/models/setup_intent.g.dart new file mode 100644 index 000000000..bc8d301e9 --- /dev/null +++ b/stripe_platform_interface/lib/src/models/setup_intent.g.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'setup_intent.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_SetupIntent _$_$_SetupIntentFromJson(Map json) { + return _$_SetupIntent( + id: json['id'] as String, + clientSecret: json['clientSecret'] as String, + livemode: json['livemode'] as bool, + status: _$enumDecode(_$SetupStatusEnumMap, json['status']), + paymentMethodTypes: (json['paymentMethodTypes'] as List) + .map((e) => _$enumDecode(_$PaymentMethodTypeEnumMap, e)) + .toList(), + usage: _$enumDecode(_$FutureUsageEnumMap, json['usage']), + created: json['created'] as String?, + paymentMethodId: json['paymentMethodId'] as String?, + description: json['description'] as String?, + ); +} + +Map _$_$_SetupIntentToJson(_$_SetupIntent instance) => + { + 'id': instance.id, + 'clientSecret': instance.clientSecret, + 'livemode': instance.livemode, + 'status': _$SetupStatusEnumMap[instance.status], + 'paymentMethodTypes': instance.paymentMethodTypes + .map((e) => _$PaymentMethodTypeEnumMap[e]) + .toList(), + 'usage': _$FutureUsageEnumMap[instance.usage], + 'created': instance.created, + 'paymentMethodId': instance.paymentMethodId, + 'description': instance.description, + }; + +K _$enumDecode( + Map enumValues, + Object? source, { + K? unknownValue, +}) { + if (source == null) { + throw ArgumentError( + 'A value must be provided. Supported values: ' + '${enumValues.values.join(', ')}', + ); + } + + return enumValues.entries.singleWhere( + (e) => e.value == source, + orElse: () { + if (unknownValue == null) { + throw ArgumentError( + '`$source` is not one of the supported values: ' + '${enumValues.values.join(', ')}', + ); + } + return MapEntry(unknownValue, enumValues.values.first); + }, + ).key; +} + +const _$SetupStatusEnumMap = { + SetupStatus.Succeeded: 'Succeeded', + SetupStatus.RequiresPaymentMethod: 'RequiresPaymentMethod', + SetupStatus.RequiresConfirmation: 'RequiresConfirmation', + SetupStatus.Canceled: 'Canceled', + SetupStatus.Processing: 'Processing', + SetupStatus.RequiresAction: 'RequiresAction', + SetupStatus.RequiresCapture: 'RequiresCapture', + SetupStatus.Unknown: 'Unknown', +}; + +const _$PaymentMethodTypeEnumMap = { + PaymentMethodType.AfterpayClearpay: 'AfterpayClearpay', + PaymentMethodType.Card: 'Card', + PaymentMethodType.Alipay: 'Alipay', + PaymentMethodType.Grabpay: 'Grabpay', + PaymentMethodType.Ideal: 'Ideal', + PaymentMethodType.Fpx: 'Fpx', + PaymentMethodType.CardPresent: 'CardPresent', + PaymentMethodType.SepaDebit: 'SepaDebit', + PaymentMethodType.AuBecsDebit: 'AuBecsDebit', + PaymentMethodType.BacsDebit: 'BacsDebit', + PaymentMethodType.Giropay: 'Giropay', + PaymentMethodType.P24: 'P24', + PaymentMethodType.Eps: 'Eps', + PaymentMethodType.Bancontact: 'Bancontact', + PaymentMethodType.Oxxo: 'Oxxo', + PaymentMethodType.Sofort: 'Sofort', + PaymentMethodType.Upi: 'Upi', + PaymentMethodType.Unknown: 'Unknown', +}; + +const _$FutureUsageEnumMap = { + FutureUsage.unknown: 'unknown', + FutureUsage.none: 'none', + FutureUsage.onSession: 'onSession', + FutureUsage.offSession: 'offSession', + FutureUsage.oneTime: 'oneTime', +}; diff --git a/stripe_platform_interface/lib/stripe_platform_interface.dart b/stripe_platform_interface/lib/stripe_platform_interface.dart index 44d777d21..2920069d4 100644 --- a/stripe_platform_interface/lib/stripe_platform_interface.dart +++ b/stripe_platform_interface/lib/stripe_platform_interface.dart @@ -12,7 +12,7 @@ abstract class StripePlatform extends PlatformInterface { static final Object _token = Object(); - static StripePlatform _instance = MethodChannelStripe(); + static StripePlatform _instance = MethodChannelStripeFactory().create(); /// The default instance of [StripePlatform] to use. /// @@ -28,10 +28,10 @@ abstract class StripePlatform extends PlatformInterface { Future initialise({ required String publishableKey, - // AppInfo? appInfo, String? stripeAccountId, ThreeDSecureConfigurationParams? threeDSecureParams, String? merchantIdentifier, + String? urlScheme, }); Future createPaymentMethod( diff --git a/stripe_platform_interface/pubspec.yaml b/stripe_platform_interface/pubspec.yaml index 335be0c81..d4dbfefff 100644 --- a/stripe_platform_interface/pubspec.yaml +++ b/stripe_platform_interface/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: json_annotation: ^4.0.0 meta: ^1.3.0-nullsafety plugin_platform_interface: ^1.1.0-nullsafety - equatable: ^2.0.0 + freezed_annotation: ^0.14.1 dev_dependencies: flutter_test: @@ -20,8 +20,6 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety build_runner: ^1.11.5 json_serializable: ^4.0.1 - - - + freezed: ^0.14.1+1 flutter: \ No newline at end of file