diff --git a/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart b/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart index 2f0ecfdee..f576efabf 100644 --- a/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/ach_params.g.dart @@ -41,6 +41,7 @@ const _$PaymentMethodTypeEnumMap = { PaymentMethodType.Eps: 'Eps', PaymentMethodType.Bancontact: 'Bancontact', PaymentMethodType.Oxxo: 'Oxxo', + PaymentMethodType.PayPal: 'PayPal', PaymentMethodType.Sofort: 'Sofort', PaymentMethodType.Upi: 'Upi', PaymentMethodType.USBankAccount: 'USBankAccount', diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart index 72cd426e4..53d3fcfe5 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart @@ -310,6 +310,7 @@ enum PaymentMethodType { Eps, Bancontact, Oxxo, + PayPal, Sofort, Upi, USBankAccount, @@ -783,14 +784,37 @@ class MandateData with _$MandateData { ///Information about the online mandate class MandateDataCustomerAcceptance with _$MandateDataCustomerAcceptance { - @JsonSerializable(explicitToJson: true) const factory MandateDataCustomerAcceptance({ /// Online data regarding the mandate. MandateDataOnlineData? ipAddress, }) = _MandateDataCustomerAcceptance; - - factory MandateDataCustomerAcceptance.fromJson(Map json) => - _$MandateDataCustomerAcceptanceFromJson(json); + const MandateDataCustomerAcceptance._(); + + factory MandateDataCustomerAcceptance.fromJson(Map json) { + final type = json['type'] as String?; + if (type != 'online') { + throw ArgumentError.value( + type, + 'type', + 'Only customer acceptance of type online is supported.', + ); + } + + return _MandateDataCustomerAcceptance( + ipAddress: json['online'] == null + ? null + : MandateDataOnlineData.fromJson( + json['online'] as Map, + ), + ); + } + + Map toJson() { + return { + 'type': 'online', + 'online': ipAddress?.toJson(), + }; + } } @freezed diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart index 7d1a77c29..3a6b9663e 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.freezed.dart @@ -12735,17 +12735,11 @@ abstract class _MandateData implements MandateData { throw _privateConstructorUsedError; } -MandateDataCustomerAcceptance _$MandateDataCustomerAcceptanceFromJson( - Map json) { - return _MandateDataCustomerAcceptance.fromJson(json); -} - /// @nodoc mixin _$MandateDataCustomerAcceptance { /// Online data regarding the mandate. MandateDataOnlineData? get ipAddress => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $MandateDataCustomerAcceptanceCopyWith get copyWith => throw _privateConstructorUsedError; @@ -12842,14 +12836,8 @@ class __$$_MandateDataCustomerAcceptanceCopyWithImpl<$Res> /// @nodoc -@JsonSerializable(explicitToJson: true) -class _$_MandateDataCustomerAcceptance - implements _MandateDataCustomerAcceptance { - const _$_MandateDataCustomerAcceptance({this.ipAddress}); - - factory _$_MandateDataCustomerAcceptance.fromJson( - Map json) => - _$$_MandateDataCustomerAcceptanceFromJson(json); +class _$_MandateDataCustomerAcceptance extends _MandateDataCustomerAcceptance { + const _$_MandateDataCustomerAcceptance({this.ipAddress}) : super._(); /// Online data regarding the mandate. @override @@ -12869,7 +12857,6 @@ class _$_MandateDataCustomerAcceptance other.ipAddress == ipAddress)); } - @JsonKey(ignore: true) @override int get hashCode => Object.hash(runtimeType, ipAddress); @@ -12879,23 +12866,14 @@ class _$_MandateDataCustomerAcceptance _$$_MandateDataCustomerAcceptanceCopyWith<_$_MandateDataCustomerAcceptance> get copyWith => __$$_MandateDataCustomerAcceptanceCopyWithImpl< _$_MandateDataCustomerAcceptance>(this, _$identity); - - @override - Map toJson() { - return _$$_MandateDataCustomerAcceptanceToJson( - this, - ); - } } abstract class _MandateDataCustomerAcceptance - implements MandateDataCustomerAcceptance { + extends MandateDataCustomerAcceptance { const factory _MandateDataCustomerAcceptance( {final MandateDataOnlineData? ipAddress}) = _$_MandateDataCustomerAcceptance; - - factory _MandateDataCustomerAcceptance.fromJson(Map json) = - _$_MandateDataCustomerAcceptance.fromJson; + const _MandateDataCustomerAcceptance._() : super._(); @override diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart index 223a41621..e27a4726f 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.g.dart @@ -828,21 +828,6 @@ Map _$$_MandateDataToJson(_$_MandateData instance) => 'customerAcceptance': instance.customerAcceptance?.toJson(), }; -_$_MandateDataCustomerAcceptance _$$_MandateDataCustomerAcceptanceFromJson( - Map json) => - _$_MandateDataCustomerAcceptance( - ipAddress: json['ipAddress'] == null - ? null - : MandateDataOnlineData.fromJson( - json['ipAddress'] as Map), - ); - -Map _$$_MandateDataCustomerAcceptanceToJson( - _$_MandateDataCustomerAcceptance instance) => - { - 'ipAddress': instance.ipAddress?.toJson(), - }; - _$_MandateDataOnlineData _$$_MandateDataOnlineDataFromJson( Map json) => _$_MandateDataOnlineData( diff --git a/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart b/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart index d05d96b16..64b16f6f6 100644 --- a/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/setup_intent.g.dart @@ -66,6 +66,7 @@ const _$PaymentMethodTypeEnumMap = { PaymentMethodType.Eps: 'Eps', PaymentMethodType.Bancontact: 'Bancontact', PaymentMethodType.Oxxo: 'Oxxo', + PaymentMethodType.PayPal: 'PayPal', PaymentMethodType.Sofort: 'Sofort', PaymentMethodType.Upi: 'Upi', PaymentMethodType.USBankAccount: 'USBankAccount',