Display used and reserved limits capacity

This commit is contained in:
Stephan D committed 2026-09-12 10:05:20 +02:00
1 parent ec43d34b4b
commit 2e81c43091
14 files changed
+287 -5

No files matched your search

@@ -10,6 +10,8 @@ class VisibleLimit {
required this.verifiedMinor,
required this.currentMinor,
required this.remainingMinor,
required this.usedMinor,
required this.reservedMinor,
});
final LimitPeriod period;
final String currency;
@@ -17,6 +19,13 @@ class VisibleLimit {
final int verifiedMinor;
final int currentMinor;
final int remainingMinor;
final int usedMinor;
final int reservedMinor;
/// Presentation only: remaining capacity and payment authorization stay server-owned.
double get occupiedFraction => currentMinor <= 0
? 0
: ((usedMinor + reservedMinor) / currentMinor).clamp(0.0, 1.0);
}
class Limits {
@@ -76,7 +76,9 @@ class DummyLimitsService implements LimitsService {
10000,
250000,
approved ? 250000 : 10000,
approved ? 250000 : 10000,
(approved ? 250000 : 10000) - 4000,
3000,
1000,
),
LimitDTO(
'month',
@@ -84,7 +86,9 @@ class DummyLimitsService implements LimitsService {
50000,
1000000,
approved ? 1000000 : 50000,
approved ? 1000000 : 50000,
(approved ? 1000000 : 50000) - 19000,
18000,
1000,
),
],
),
@@ -38,10 +38,12 @@ class LimitDTO {
this.verified,
this.current,
this.remaining,
this.used,
this.reserved,
);
final String period;
final String currency;
final int basic, verified, current, remaining;
final int basic, verified, current, remaining, used, reserved;
}
class LimitsMapper {
@@ -57,6 +59,8 @@ class LimitsMapper {
verifiedMinor: r.verified,
currentMinor: r.current,
remainingMinor: r.remaining,
usedMinor: r.used,
reservedMinor: r.reserved,
),
)
.toList(),