Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add brij logging #1673

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:uuid/uuid.dart';

import '../../../../../config.dart';
import '../../../../../data/db/db.dart';
import '../../../../../utils/errors.dart';
import '../../../../accounts/auth_scope.dart';
import '../../../../accounts/models/ec_wallet.dart';
import '../../../../analytics/analytics_manager.dart';
Expand All @@ -25,6 +26,7 @@ import '../../../../tokens/token.dart';
import '../../../../transactions/models/tx_results.dart';
import '../../../../transactions/services/resign_tx.dart';
import '../../../../transactions/services/tx_sender.dart';
import '../../../services/extensions.dart';
import '../models/brij_order_status.dart';

@Singleton(scope: authScope)
Expand Down Expand Up @@ -80,6 +82,10 @@ class BrijOffRampOrderService implements Disposable {
.watchSingleOrNull()
.whereNotNull()
.asyncExpand<OffRampOrderRowsCompanion?>((order) {
logMessage(
message: 'BrijOffRampOrderStatusChange',
data: order.toSentry(),
);
switch (order.status) {
case OffRampOrderStatus.waitingPartnerReview:
_waitingPartnerReviewWatcher(order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:rxdart/rxdart.dart';
import 'package:uuid/uuid.dart';

import '../../../../../data/db/db.dart';
import '../../../../../utils/errors.dart';
import '../../../../accounts/auth_scope.dart';
import '../../../../analytics/analytics_manager.dart';
import '../../../../currency/models/amount.dart';
Expand All @@ -17,6 +18,7 @@ import '../../../../kyc_sharing/utils/kyc_utils.dart';
import '../../../../ramp_partner/models/ramp_partner.dart';
import '../../../../ramp_partner/models/ramp_type.dart';
import '../../../../tokens/token.dart';
import '../../../services/extensions.dart';
import '../models/brij_order_status.dart';

@Singleton(scope: authScope)
Expand Down Expand Up @@ -65,6 +67,10 @@ class BrijOnRampOrderService implements Disposable {
.watchSingleOrNull()
.whereNotNull()
.asyncExpand<OnRampOrderRowsCompanion?>((order) {
logMessage(
message: 'BrijOnRampOrderStatusChange',
data: order.toSentry(),
);
switch (order.status) {
case OnRampOrderStatus.waitingPartnerReview:
_waitingPartnerReviewWatcher(order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import '../../../../transactions/services/resign_tx.dart';
import '../../../../transactions/services/tx_confirm.dart';
import '../../../../transactions/services/tx_sender.dart';
import '../../../data/my_database_ext.dart';
import '../../../services/extensions.dart';
import '../../../services/off_ramp_order_service.dart';
import '../data/allbridge_client.dart';
import '../data/allbridge_dto.dart' hide TransactionStatus;
Expand Down Expand Up @@ -105,7 +106,7 @@ class MoneygramOffRampOrderService implements Disposable {
.asyncExpand<OffRampOrderRowsCompanion?>((order) {
logMessage(
message: 'MGOffRampOrderStatusChange',
data: order.toSentry,
data: order.toSentry(),
);

switch (order.status) {
Expand Down Expand Up @@ -845,18 +846,3 @@ class MoneygramOffRampOrderService implements Disposable {
}

const _minimumInitBalance = 1.5; // 1.5 XLM

extension on OffRampOrderRow {
Map<String, dynamic> get toSentry {
final json = toJson();

const filter = ['transaction', 'slot'];

json.removeWhere(
(key, value) =>
value == null || value == '' || filter.contains(key) || value == 0.0,
);

return json;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import '../../../../stellar/service/stellar_client.dart';
import '../../../../tokens/token.dart';
import '../../../../transactions/models/tx_results.dart';
import '../../../../transactions/services/tx_confirm.dart';
import '../../../services/extensions.dart';
import '../data/allbridge_client.dart';
import '../data/allbridge_dto.dart' hide TransactionStatus;
import '../data/dto.dart';
Expand Down Expand Up @@ -92,7 +93,7 @@ class MoneygramOnRampOrderService implements Disposable {
.asyncExpand<OnRampOrderRowsCompanion?>((order) {
logMessage(
message: 'MGOnRampOrderStatusChange',
data: order.toSentry,
data: order.toSentry(),
);

switch (order.status) {
Expand Down Expand Up @@ -487,10 +488,3 @@ class MoneygramOnRampOrderService implements Disposable {
}

const _minimumInitBalance = 1.5; // 1.5 XLM

extension on OnRampOrderRow {
Map<String, dynamic> get toSentry => toJson()
..removeWhere(
(key, value) => value == null || value == '' || value == 0.0,
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import '../../../data/db/db.dart';

extension OffRampOrderRowExt on OffRampOrderRow {
Map<String, dynamic> toSentry() {
final json = toJson();

const filter = ['transaction', 'slot'];

json.removeWhere(
(key, value) =>
value == null || value == '' || filter.contains(key) || value == 0.0,
);

return json;
}
}

extension OnRampOrderRowExt on OnRampOrderRow {
Map<String, dynamic> toSentry() => toJson()
..removeWhere(
(key, value) => value == null || value == '' || value == 0.0,
);
}
Loading