Build exchange workspace and shared transaction services (#28)
This commit is contained in:
1 parent
52b7135eda
commit
c496da8a55
48 files changed
+4757
-120
No files matched your search
@@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:math';
|
||||
|
||||
enum JourneyKind { login, signup, verification, kyc }
|
||||
enum JourneyKind { login, signup, verification, kyc, topUp, exchange, payout }
|
||||
|
||||
enum JourneyStep {
|
||||
login,
|
||||
@@ -14,6 +14,10 @@ enum JourneyStep {
|
||||
kycSelfie,
|
||||
kycSubmission,
|
||||
kycStatus,
|
||||
transferDraft,
|
||||
transferQuote,
|
||||
transferSubmission,
|
||||
settlement,
|
||||
}
|
||||
|
||||
enum JourneySignal {
|
||||
@@ -27,6 +31,9 @@ enum JourneySignal {
|
||||
}
|
||||
|
||||
enum JourneyFailure {
|
||||
insufficientFunds,
|
||||
limitExceeded,
|
||||
declined,
|
||||
document,
|
||||
invalidCredentials,
|
||||
emailInUse,
|
||||
@@ -79,7 +86,13 @@ class AnalyticsEvent {
|
||||
final bool simulated;
|
||||
final DateTime occurredAt;
|
||||
String get name {
|
||||
final area = kind == JourneyKind.kyc ? 'kyc' : 'auth';
|
||||
final area = switch (kind) {
|
||||
JourneyKind.kyc => 'kyc',
|
||||
JourneyKind.topUp => 'top_up',
|
||||
JourneyKind.exchange => 'exchange',
|
||||
JourneyKind.payout => 'payout',
|
||||
_ => 'auth',
|
||||
};
|
||||
var stage = step == null ? 'journey' : _snake(step!.name);
|
||||
if (kind == JourneyKind.kyc) stage = stage.replaceFirst('kyc_', '');
|
||||
return '${area}_${stage}_${signal.name}';
|
||||
@@ -189,7 +202,7 @@ class JourneyRecorder {
|
||||
operation._finished = true;
|
||||
journey.pending--;
|
||||
journey.simulated |= simulated;
|
||||
final complete = failure == null && !cancelled && terminal;
|
||||
final complete = !cancelled && terminal;
|
||||
_emit(
|
||||
journey,
|
||||
cancelled
|
||||
@@ -257,8 +270,8 @@ class JourneyRecorder {
|
||||
);
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
abandon(JourneyExit.disposed);
|
||||
void dispose({bool abandonActive = true}) {
|
||||
if (abandonActive) abandon(JourneyExit.disposed);
|
||||
_disposed = true;
|
||||
_idle?.cancel();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user