What changed, and why it matters
This commit is a small code-quality cleanup in a cryptocurrency wallet app. It replaces a hardcoded text string ('NEW') and a hardcoded status value with references to a shared enum definition. There is no direct evidence in the commit that this fixes an exploitable security vulnerability; it appears to be a maintainability improvement that reduces the chance of future typos or mismatched status values.
Treat as a routine refactoring commit. Reviewers may optionally verify that `TicketState.newTicket.value` equals the previously hardcoded 'NEW' string and that `fromTicketState` maps it to the same `ShopInBitOrderStatus.pending` value, ensuring no behavioral regression. No urgent security action is indicated.
Security signals we found
Hardcoded raw string replaced by enum-derived value
Status mapping centralized via ShopInBitOrderStatus.fromTicketState
No input validation, auth, crypto, or network changes visible
Evidence from the diff
The change removes two hardcoded raw values used when inserting a new ShopInBit ticket into the local Drift database: status: ShopInBitOrderStatus.pending and statusRaw: 'NEW' are replaced by TicketState.newTicket mapped through ShopInBitOrderStatus.fromTicketState(ticketState) and ticketState.value. Imports are updated to pull in shopinbit_enums.dart and shopinbit_api.dart. This centralizes the canonical ‘new ticket’ state and its serialized form, preventing divergence between the enum and the raw string. No input validation, cryptographic, network, or access-control changes are present in the diff.
Changed components
lib/pages/shopinbit/shopinbit_car_research_payment_view.dartlib/services/shopinbit/shopinbit_service.dartInspect captured patch +8 / −6
diff --git a/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart b/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
index 8846e6a..9445683 100644
--- a/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
+++ b/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
@@ -6,11 +6,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../app_config.dart';
import '../../db/drift/shared_db/shared_database.dart';
+import '../../models/shopinbit/shopinbit_enums.dart';
import '../../notifications/show_flush_bar.dart';
import '../../providers/global/shopin_bit_service_provider.dart';
import '../../providers/providers.dart';
-import '../../services/shopinbit/src/client.dart';
-import '../../services/shopinbit/src/models/car_research.dart';
+import '../../services/shopinbit/shopinbit_api.dart';
import '../../themes/stack_colors.dart';
import '../../utilities/assets.dart';
import '../../utilities/logger.dart';
@@ -368,6 +368,7 @@ class _ShopInBitCarResearchPaymentViewState
);
if (ticket == null) {
+ const ticketState = TicketState.newTicket;
// insert bare minimum - will be updated automatically later
await service.db.shopInBitTicketsDao.insertTicket(
ShopInBitTicketsCompanion.insert(
@@ -377,8 +378,8 @@ class _ShopInBitCarResearchPaymentViewState
category: .car,
requestDescription: fullTicket.productName ?? "",
deliveryCountry: fullTicket.deliveryCountry,
- status: .pending,
- statusRaw: "NEW",
+ status: ShopInBitOrderStatus.fromTicketState(ticketState)!,
+ statusRaw: ticketState.value,
),
);
}
diff --git a/lib/services/shopinbit/shopinbit_service.dart b/lib/services/shopinbit/shopinbit_service.dart
index 09f6d73..3da7aa1 100644
--- a/lib/services/shopinbit/shopinbit_service.dart
+++ b/lib/services/shopinbit/shopinbit_service.dart
@@ -112,6 +112,7 @@ class ShopInBitService {
if (resp.hasError || resp.value == null) return null;
final TicketRef ref = resp.value!;
+ const ticketState = TicketState.newTicket;
await db.shopInBitTicketsDao.insertTicket(
ShopInBitTicketsCompanion.insert(
apiTicketId: ref.id,
@@ -120,8 +121,8 @@ class ShopInBitService {
category: category,
requestDescription: comment,
deliveryCountry: deliveryCountry,
- status: ShopInBitOrderStatus.pending,
- statusRaw: "NEW",
+ status: ShopInBitOrderStatus.fromTicketState(ticketState)!,
+ statusRaw: ticketState.value,
),
);
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.