few fixes and made sure ledger widget displays the name of ledger wallet
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'operation.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class PaymentOperationDTO {
|
||||
final String? stepRef;
|
||||
final String? operationRef;
|
||||
@@ -24,37 +29,6 @@ class PaymentOperationDTO {
|
||||
});
|
||||
|
||||
factory PaymentOperationDTO.fromJson(Map<String, dynamic> json) =>
|
||||
PaymentOperationDTO(
|
||||
stepRef: _asString(json['stepRef'] ?? json['step_ref']),
|
||||
operationRef: _asString(json['operationRef'] ?? json['operation_ref']),
|
||||
gateway: _asString(json['gateway']),
|
||||
code: _asString(json['code']),
|
||||
state: _asString(json['state']),
|
||||
label: _asString(json['label']),
|
||||
failureCode: _asString(json['failureCode'] ?? json['failure_code']),
|
||||
failureReason: _asString(
|
||||
json['failureReason'] ?? json['failure_reason'],
|
||||
),
|
||||
startedAt: _asString(json['startedAt'] ?? json['started_at']),
|
||||
completedAt: _asString(json['completedAt'] ?? json['completed_at']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'stepRef': stepRef,
|
||||
'operationRef': operationRef,
|
||||
'gateway': gateway,
|
||||
'code': code,
|
||||
'state': state,
|
||||
'label': label,
|
||||
'failureCode': failureCode,
|
||||
'failureReason': failureReason,
|
||||
'startedAt': startedAt,
|
||||
'completedAt': completedAt,
|
||||
};
|
||||
}
|
||||
|
||||
String? _asString(Object? value) {
|
||||
final text = value?.toString().trim();
|
||||
if (text == null || text.isEmpty) return null;
|
||||
return text;
|
||||
_$PaymentOperationDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PaymentOperationDTOToJson(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user