Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 1c85bf8

Browse files
authoredApr 9, 2024··
fix: payin/payout deserialization (#11)
* properly handle when `requiredPaymentDetails` is null * make constructor private
1 parent ac2d475 commit 1c85bf8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎lib/src/http_client/tbdex_http_client.dart

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import 'package:typeid/typeid.dart';
1414
import 'package:web5/web5.dart';
1515

1616
class TbdexHttpClient {
17+
TbdexHttpClient._();
18+
1719
static const _jsonHeader = 'application/json';
1820
static const _expirationDuration = Duration(minutes: 5);
1921

‎lib/src/protocol/models/resource_data.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ class PayinMethod {
145145
name: json['name'],
146146
description: json['description'],
147147
group: json['group'],
148-
requiredPaymentDetails: JsonSchema.create(json['requiredPaymentDetails']),
148+
requiredPaymentDetails: json['requiredPaymentDetails'] != null
149+
? JsonSchema.create(json['requiredPaymentDetails'])
150+
: null,
149151
fee: json['fee'],
150152
min: json['min'],
151153
max: json['max'],
@@ -199,7 +201,9 @@ class PayoutMethod {
199201
name: json['name'],
200202
description: json['description'],
201203
group: json['group'],
202-
requiredPaymentDetails: JsonSchema.create(json['requiredPaymentDetails']),
204+
requiredPaymentDetails: json['requiredPaymentDetails'] != null
205+
? JsonSchema.create(json['requiredPaymentDetails'])
206+
: null,
203207
fee: json['fee'],
204208
min: json['min'],
205209
max: json['max'],

0 commit comments

Comments
 (0)
This repository has been archived.