Skip to content

Commit

Permalink
Fix PayPal payments (#1341)
Browse files Browse the repository at this point in the history
* Run build_runner

* Add PayPal to PaymentMethodType

* Fix MandateDataCustomerAcceptance serialization

* Run dart format

---------

Co-authored-by: Rémon <[email protected]>
  • Loading branch information
JonasWanke and remonh87 authored Oct 31, 2023
1 parent 129669b commit c0ec7d7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ enum PaymentMethodType {
Eps,
Bancontact,
Oxxo,
PayPal,
Sofort,
Upi,
USBankAccount,
Expand Down Expand Up @@ -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<String, dynamic> json) =>
_$MandateDataCustomerAcceptanceFromJson(json);
const MandateDataCustomerAcceptance._();

factory MandateDataCustomerAcceptance.fromJson(Map<String, dynamic> 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<String, dynamic>,
),
);
}

Map<String, dynamic> toJson() {
return {
'type': 'online',
'online': ipAddress?.toJson(),
};
}
}

@freezed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12735,17 +12735,11 @@ abstract class _MandateData implements MandateData {
throw _privateConstructorUsedError;
}

MandateDataCustomerAcceptance _$MandateDataCustomerAcceptanceFromJson(
Map<String, dynamic> json) {
return _MandateDataCustomerAcceptance.fromJson(json);
}

/// @nodoc
mixin _$MandateDataCustomerAcceptance {
/// Online data regarding the mandate.
MandateDataOnlineData? get ipAddress => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$MandateDataCustomerAcceptanceCopyWith<MandateDataCustomerAcceptance>
get copyWith => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -12842,14 +12836,8 @@ class __$$_MandateDataCustomerAcceptanceCopyWithImpl<$Res>

/// @nodoc
@JsonSerializable(explicitToJson: true)
class _$_MandateDataCustomerAcceptance
implements _MandateDataCustomerAcceptance {
const _$_MandateDataCustomerAcceptance({this.ipAddress});

factory _$_MandateDataCustomerAcceptance.fromJson(
Map<String, dynamic> json) =>
_$$_MandateDataCustomerAcceptanceFromJson(json);
class _$_MandateDataCustomerAcceptance extends _MandateDataCustomerAcceptance {
const _$_MandateDataCustomerAcceptance({this.ipAddress}) : super._();

/// Online data regarding the mandate.
@override
Expand All @@ -12869,7 +12857,6 @@ class _$_MandateDataCustomerAcceptance
other.ipAddress == ipAddress));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, ipAddress);

Expand All @@ -12879,23 +12866,14 @@ class _$_MandateDataCustomerAcceptance
_$$_MandateDataCustomerAcceptanceCopyWith<_$_MandateDataCustomerAcceptance>
get copyWith => __$$_MandateDataCustomerAcceptanceCopyWithImpl<
_$_MandateDataCustomerAcceptance>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_MandateDataCustomerAcceptanceToJson(
this,
);
}
}

abstract class _MandateDataCustomerAcceptance
implements MandateDataCustomerAcceptance {
extends MandateDataCustomerAcceptance {
const factory _MandateDataCustomerAcceptance(
{final MandateDataOnlineData? ipAddress}) =
_$_MandateDataCustomerAcceptance;

factory _MandateDataCustomerAcceptance.fromJson(Map<String, dynamic> json) =
_$_MandateDataCustomerAcceptance.fromJson;
const _MandateDataCustomerAcceptance._() : super._();

@override

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c0ec7d7

Please sign in to comment.