67 lines
2.0 KiB
Dart
67 lines
2.0 KiB
Dart
/// Status and credit-request payload for the play-money test wallet.
|
|
library;
|
|
|
|
class TestWalletStatusModel {
|
|
const TestWalletStatusModel({
|
|
required this.enabled,
|
|
required this.balanceRaw,
|
|
required this.walletTypeId,
|
|
this.walletCode,
|
|
required this.decimals,
|
|
required this.creditAmountRaw,
|
|
required this.maxRequests,
|
|
required this.requestsUsed,
|
|
required this.canRequest,
|
|
this.reason,
|
|
this.cooldownEndsAt,
|
|
});
|
|
|
|
final bool enabled;
|
|
final String balanceRaw;
|
|
final int walletTypeId;
|
|
final String? walletCode;
|
|
final int decimals;
|
|
final String creditAmountRaw;
|
|
final int maxRequests;
|
|
final int requestsUsed;
|
|
final bool canRequest;
|
|
final String? reason;
|
|
final String? cooldownEndsAt;
|
|
|
|
factory TestWalletStatusModel.fromJson(Map<String, dynamic> json) {
|
|
return TestWalletStatusModel(
|
|
enabled: json['enabled'] == true,
|
|
balanceRaw: (json['balanceRaw'] ?? '0').toString(),
|
|
walletTypeId: (json['walletTypeId'] as num?)?.toInt() ?? 0,
|
|
walletCode: json['walletCode'] as String?,
|
|
decimals: (json['decimals'] as num?)?.toInt() ?? 6,
|
|
creditAmountRaw: (json['creditAmountRaw'] ?? '0').toString(),
|
|
maxRequests: (json['maxRequests'] as num?)?.toInt() ?? 0,
|
|
requestsUsed: (json['requestsUsed'] as num?)?.toInt() ?? 0,
|
|
canRequest: json['canRequest'] == true,
|
|
reason: json['reason'] as String?,
|
|
cooldownEndsAt: json['cooldownEndsAt'] as String?,
|
|
);
|
|
}
|
|
}
|
|
|
|
class TestWalletCreditResult {
|
|
const TestWalletCreditResult({
|
|
required this.message,
|
|
required this.amountRaw,
|
|
required this.balanceRaw,
|
|
});
|
|
|
|
final String message;
|
|
final String amountRaw;
|
|
final String balanceRaw;
|
|
|
|
factory TestWalletCreditResult.fromJson(Map<String, dynamic> json) {
|
|
return TestWalletCreditResult(
|
|
message: (json['message'] ?? '').toString(),
|
|
amountRaw: (json['amountRaw'] ?? '0').toString(),
|
|
balanceRaw: (json['balanceRaw'] ?? '0').toString(),
|
|
);
|
|
}
|
|
}
|