Skip to content

Commit

Permalink
feat: add brij logging (#1673)
Browse files Browse the repository at this point in the history
Co-authored-by: Kirill Bubochkin <[email protected]>
  • Loading branch information
justinenerio and ookami-kb authored Jan 23, 2025
1 parent dcc065a commit 0fcd846
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
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 @@ -87,6 +89,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 @@ -72,6 +74,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,
);
}

0 comments on commit 0fcd846

Please sign in to comment.