What changed, and why it matters
This commit is a large work-in-progress refactor of the ShopinBit feature inside the Stack Wallet app. It restructures local database tables, generated code, and UI files to support a new customer-key-based account model and ticket storage. There is no direct evidence in the commit message or diff that this is a security fix, security patch, or response to a reported vulnerability. It appears to be ordinary feature/codebase maintenance.
Treat as routine feature refactor. If reviewing for release, verify that the accompanying migration preserves user data and that the new customer-key handling does not introduce authorization or data-isolation issues in the full service layer (not visible in this diff). No immediate security action required based on supplied materials.
Security signals we found
Large refactor with no security-related commit message or comments
Database schema migration from single-row settings to per-customer-key settings
Enum serialization changed from integer indices to string names (data compatibility change, not a security boundary)
No explicit input validation, crypto, or network security changes visible in supplied diff
Evidence from the diff
The diff shows a broad refactor of the ShopinBit integration: renaming tables (ShopinBitSettings → ShopInBitSettings), replacing a single-row settings model with a per-customer-key model, adding a ShopInBitTicketsDao, changing enum serialization from integer indices to string names, and updating generated Drift code accordingly. UI/service files are touched but the supplied diff only covers the database layer. No security-relevant changes (e.g., input sanitization, authentication, cryptography, network validation) are visible in the provided diff.
Changed components
lib/db/drift/shared_db/shared_database.dartlib/db/drift/shared_db/shared_database.g.dartlib/db/drift/shared_db/tables/shopin_bit_settings.dartlib/db/drift/shared_db/tables/shopin_bit_tickets.dartlib/models/shopinbit/shopinbit_enums.dartlib/models/shopinbit/shopinbit_order_model.dartlib/models/shopinbit/shopinbit_request_draft.dartlib/services/shopinbit/shopinbit_service.dartlib/services/shopinbit/shopinbit_orders_service.dartlib/services/shopinbit/src/client.dartlib/services/shopinbit/src/models/message.dartlib/services/shopinbit/src/models/ticket.dartInspect captured patch +2909 / −4148
diff --git a/lib/db/drift/shared_db/shared_database.dart b/lib/db/drift/shared_db/shared_database.dart
index fa6f94e..ec39151 100644
--- a/lib/db/drift/shared_db/shared_database.dart
+++ b/lib/db/drift/shared_db/shared_database.dart
@@ -2,8 +2,8 @@ import 'package:drift/drift.dart';
import 'package:drift_flutter/drift_flutter.dart';
import 'package:path/path.dart' as path;
-import '../../../models/shopinbit/shopinbit_order_model.dart'
- show ShopInBitCategory, ShopInBitOrderStatus;
+import "../../../models/shopinbit/shopinbit_enums.dart";
+import "../../../services/shopinbit/src/models/message.dart";
import '../../../utilities/stack_file_system.dart';
import 'tables/cakepay_orders.dart';
import 'tables/shopin_bit_settings.dart';
@@ -27,8 +27,8 @@ abstract final class SharedDrift {
}
@DriftDatabase(
- tables: [CakepayOrders, ShopinBitSettings, ShopInBitTickets],
- daos: [ShopinBitSettingsDao],
+ tables: [CakepayOrders, ShopInBitSettings, ShopInBitTickets],
+ daos: [ShopInBitSettingsDao, ShopInBitTicketsDao],
)
final class SharedDatabase extends _$SharedDatabase {
SharedDatabase._([QueryExecutor? executor])
@@ -41,7 +41,7 @@ final class SharedDatabase extends _$SharedDatabase {
MigrationStrategy get migration => MigrationStrategy(
onUpgrade: (m, from, to) async {
if (from == 1 && to == 2) {
- await m.createTable(shopinBitSettings);
+ await m.createTable(shopInBitSettings);
await m.createTable(shopInBitTickets);
}
},
@@ -61,35 +61,183 @@ final class SharedDatabase extends _$SharedDatabase {
}
}
-@DriftAccessor(tables: [ShopinBitSettings])
-class ShopinBitSettingsDao extends DatabaseAccessor<SharedDatabase>
- with _$ShopinBitSettingsDaoMixin {
- ShopinBitSettingsDao(super.db);
+@DriftAccessor(tables: [ShopInBitTickets])
+class ShopInBitTicketsDao extends DatabaseAccessor<SharedDatabase>
+ with _$ShopInBitTicketsDaoMixin {
+ ShopInBitTicketsDao(super.db);
- Future<ShopinBitSetting> getSettings() async {
- final ShopinBitSetting? row = await (select(
- shopinBitSettings,
- )..where((t) => t.id.equals(0))).getSingleOrNull();
- if (row != null) return row;
+ // -- Reads --
- return into(
- shopinBitSettings,
- ).insertReturning(ShopinBitSettingsCompanion.insert(id: const Value(0)));
+ Future<ShopInBitTicket?> getByApiId(int apiTicketId) {
+ return (select(
+ shopInBitTickets,
+ )..where((t) => t.apiTicketId.equals(apiTicketId))).getSingleOrNull();
}
- Future<void> setGuidelinesAccepted(bool accepted) =>
- _update(ShopinBitSettingsCompanion(guidelinesAccepted: Value(accepted)));
+ Stream<ShopInBitTicket?> watchByApiId(int apiTicketId) {
+ return (select(
+ shopInBitTickets,
+ )..where((t) => t.apiTicketId.equals(apiTicketId))).watchSingleOrNull();
+ }
+
+ Future<List<ShopInBitTicket>> getByCustomerKey(String customerKey) {
+ return (select(shopInBitTickets)
+ ..where((t) => t.customerKey.equals(customerKey))
+ ..orderBy([(t) => OrderingTerm.desc(t.createdAt)]))
+ .get();
+ }
+
+ /// All tickets for the active customer key, newest first.
+ Stream<List<ShopInBitTicket>> watchByCustomerKey(String customerKey) {
+ return (select(shopInBitTickets)
+ ..where((t) => t.customerKey.equals(customerKey))
+ ..orderBy([(t) => OrderingTerm.desc(t.createdAt)]))
+ .watch();
+ }
+
+ // -- Writes --
+
+ /// Insert a brand-new ticket. Caller must supply every required field;
+ /// pass nullable fields through the companion's `Value(...)` wrappers.
+ Future<void> insertTicket(ShopInBitTicketsCompanion companion) async {
+ await into(shopInBitTickets).insert(companion);
+ }
+
+ /// Patch an existing ticket. Use `Value.absent()` (the companion default)
+ /// for fields you don't want to touch. Returns true if a row was updated.
+ Future<bool> updateTicket(
+ int apiTicketId,
+ ShopInBitTicketsCompanion patch,
+ ) async {
+ final int rows = await (update(
+ shopInBitTickets,
+ )..where((t) => t.apiTicketId.equals(apiTicketId))).write(patch);
+ return rows > 0;
+ }
+
+ Future<int> deleteByApiId(int apiTicketId) {
+ return (delete(
+ shopInBitTickets,
+ )..where((t) => t.apiTicketId.equals(apiTicketId))).go();
+ }
+
+ Future<int> deleteByCustomerKey(String customerKey) {
+ return (delete(
+ shopInBitTickets,
+ )..where((t) => t.customerKey.equals(customerKey))).go();
+ }
+}
+
+@DriftAccessor(tables: [ShopInBitSettings])
+class ShopInBitSettingsDao extends DatabaseAccessor<SharedDatabase>
+ with _$ShopInBitSettingsDaoMixin {
+ ShopInBitSettingsDao(super.db);
+
+ // -- "Current" (= most-recently-used) row --
+
+ /// Returns the settings row for the most-recently-used customer key,
+ /// or null if the user has never generated/recovered one.
+ Future<ShopInBitSetting?> getCurrentSettings() {
+ return (select(shopInBitSettings)
+ ..orderBy([(t) => OrderingTerm.desc(t.lastUsedAt)])
+ ..limit(1))
+ .getSingleOrNull();
+ }
+
+ Stream<ShopInBitSetting?> watchCurrentSettings() {
+ return (select(shopInBitSettings)
+ ..orderBy([(t) => OrderingTerm.desc(t.lastUsedAt)])
+ ..limit(1))
+ .watchSingleOrNull();
+ }
+
+ // -- Specific row by customer key --
+
+ Future<ShopInBitSetting?> getByKey(String customerKey) {
+ return (select(
+ shopInBitSettings,
+ )..where((t) => t.customerKey.equals(customerKey))).getSingleOrNull();
+ }
+
+ Stream<ShopInBitSetting?> watchByKey(String customerKey) {
+ return (select(
+ shopInBitSettings,
+ )..where((t) => t.customerKey.equals(customerKey))).watchSingleOrNull();
+ }
- Future<void> setSetupComplete(bool complete) =>
- _update(ShopinBitSettingsCompanion(setupComplete: Value(complete)));
+ Stream<List<ShopInBitSetting>> watchAll() {
+ return (select(
+ shopInBitSettings,
+ )..orderBy([(t) => OrderingTerm.desc(t.lastUsedAt)])).watch();
+ }
- Future<void> setDisplayName(String name) =>
- _update(ShopinBitSettingsCompanion(displayName: Value(name)));
+ // -- Writes --
- Future<void> _update(ShopinBitSettingsCompanion changes) async {
- await getSettings(); // ensure row exists
- await (update(
- shopinBitSettings,
- )..where((t) => t.id.equals(0))).write(changes);
+ /// Insert if missing, otherwise bump [lastUsedAt]. Returns the row.
+ Future<ShopInBitSetting> upsert(String customerKey) {
+ final DateTime now = DateTime.now();
+ return into(shopInBitSettings).insertReturning(
+ ShopInBitSettingsCompanion.insert(
+ customerKey: customerKey,
+ createdAt: Value(now),
+ lastUsedAt: Value(now),
+ ),
+ onConflict: DoUpdate(
+ (_) => ShopInBitSettingsCompanion(lastUsedAt: Value(now)),
+ target: [shopInBitSettings.customerKey],
+ ),
+ );
}
+
+ Future<int> touch(String customerKey) => _write(
+ customerKey,
+ ShopInBitSettingsCompanion(lastUsedAt: Value(DateTime.now())),
+ );
+
+ Future<int> setPrivacyAccepted(String customerKey, bool value) => _write(
+ customerKey,
+ ShopInBitSettingsCompanion(privacyAccepted: Value(value)),
+ );
+
+ Future<int> setGuidelinesAccepted(
+ String customerKey,
+ ShopInBitCategory category,
+ bool value,
+ ) {
+ final ShopInBitSettingsCompanion patch = switch (category) {
+ .concierge => ShopInBitSettingsCompanion(
+ conciergeGuidelinesAccepted: Value(value),
+ ),
+ .travel => ShopInBitSettingsCompanion(
+ travelGuidelinesAccepted: Value(value),
+ ),
+ .car => ShopInBitSettingsCompanion(carGuidelinesAccepted: Value(value)),
+ };
+ return _write(customerKey, patch);
+ }
+
+ Future<int> setSetupComplete(String customerKey, bool value) => _write(
+ customerKey,
+ ShopInBitSettingsCompanion(setupComplete: Value(value)),
+ );
+
+ Future<int> deleteByKey(String customerKey) {
+ return (delete(
+ shopInBitSettings,
+ )..where((t) => t.customerKey.equals(customerKey))).go();
+ }
+
+ Future<int> _write(String customerKey, ShopInBitSettingsCompanion changes) {
+ return (update(
+ shopInBitSettings,
+ )..where((t) => t.customerKey.equals(customerKey))).write(changes);
+ }
+}
+
+extension ShopInBitSettingGuidelines on ShopInBitSetting {
+ bool guidelinesAcceptedFor(ShopInBitCategory category) => switch (category) {
+ .concierge => conciergeGuidelinesAccepted,
+ .travel => travelGuidelinesAccepted,
+ .car => carGuidelinesAccepted,
+ };
}
diff --git a/lib/db/drift/shared_db/shared_database.g.dart b/lib/db/drift/shared_db/shared_database.g.dart
index 28c4c39..67c9b7a 100644
--- a/lib/db/drift/shared_db/shared_database.g.dart
+++ b/lib/db/drift/shared_db/shared_database.g.dart
@@ -165,36 +165,83 @@ class CakepayOrdersCompanion extends UpdateCompanion<CakepayOrder> {
}
}
-class $ShopinBitSettingsTable extends ShopinBitSettings
- with TableInfo<$ShopinBitSettingsTable, ShopinBitSetting> {
+class $ShopInBitSettingsTable extends ShopInBitSettings
+ with TableInfo<$ShopInBitSettingsTable, ShopInBitSetting> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
- $ShopinBitSettingsTable(this.attachedDatabase, [this._alias]);
- static const VerificationMeta _idMeta = const VerificationMeta('id');
+ $ShopInBitSettingsTable(this.attachedDatabase, [this._alias]);
+ static const VerificationMeta _customerKeyMeta = const VerificationMeta(
+ 'customerKey',
+ );
@override
- late final GeneratedColumn<int> id = GeneratedColumn<int>(
- 'id',
+ late final GeneratedColumn<String> customerKey = GeneratedColumn<String>(
+ 'customer_key',
aliasedName,
false,
- type: DriftSqlType.int,
- requiredDuringInsert: false,
- defaultValue: const Constant(0),
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ );
+ static const VerificationMeta _privacyAcceptedMeta = const VerificationMeta(
+ 'privacyAccepted',
);
- static const VerificationMeta _guidelinesAcceptedMeta =
- const VerificationMeta('guidelinesAccepted');
@override
- late final GeneratedColumn<bool> guidelinesAccepted = GeneratedColumn<bool>(
- 'guidelines_accepted',
+ late final GeneratedColumn<bool> privacyAccepted = GeneratedColumn<bool>(
+ 'privacy_accepted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
- 'CHECK ("guidelines_accepted" IN (0, 1))',
+ 'CHECK ("privacy_accepted" IN (0, 1))',
),
defaultValue: const Constant(false),
);
+ static const VerificationMeta _conciergeGuidelinesAcceptedMeta =
+ const VerificationMeta('conciergeGuidelinesAccepted');
+ @override
+ late final GeneratedColumn<bool> conciergeGuidelinesAccepted =
+ GeneratedColumn<bool>(
+ 'concierge_guidelines_accepted',
+ aliasedName,
+ false,
+ type: DriftSqlType.bool,
+ requiredDuringInsert: false,
+ defaultConstraints: GeneratedColumn.constraintIsAlways(
+ 'CHECK ("concierge_guidelines_accepted" IN (0, 1))',
+ ),
+ defaultValue: const Constant(false),
+ );
+ static const VerificationMeta _travelGuidelinesAcceptedMeta =
+ const VerificationMeta('travelGuidelinesAccepted');
+ @override
+ late final GeneratedColumn<bool> travelGuidelinesAccepted =
+ GeneratedColumn<bool>(
+ 'travel_guidelines_accepted',
+ aliasedName,
+ false,
+ type: DriftSqlType.bool,
+ requiredDuringInsert: false,
+ defaultConstraints: GeneratedColumn.constraintIsAlways(
+ 'CHECK ("travel_guidelines_accepted" IN (0, 1))',
+ ),
+ defaultValue: const Constant(false),
+ );
+ static const VerificationMeta _carGuidelinesAcceptedMeta =
+ const VerificationMeta('carGuidelinesAccepted');
+ @override
+ late final GeneratedColumn<bool> carGuidelinesAccepted =
+ GeneratedColumn<bool>(
+ 'car_guidelines_accepted',
+ aliasedName,
+ false,
+ type: DriftSqlType.bool,
+ requiredDuringInsert: false,
+ defaultConstraints: GeneratedColumn.constraintIsAlways(
+ 'CHECK ("car_guidelines_accepted" IN (0, 1))',
+ ),
+ defaultValue: const Constant(false),
+ );
static const VerificationMeta _setupCompleteMeta = const VerificationMeta(
'setupComplete',
);
@@ -210,45 +257,97 @@ class $ShopinBitSettingsTable extends ShopinBitSettings
),
defaultValue: const Constant(false),
);
- static const VerificationMeta _displayNameMeta = const VerificationMeta(
- 'displayName',
+ static const VerificationMeta _createdAtMeta = const VerificationMeta(
+ 'createdAt',
);
@override
- late final GeneratedColumn<String> displayName = GeneratedColumn<String>(
- 'display_name',
+ late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
+ 'created_at',
aliasedName,
- true,
- type: DriftSqlType.string,
+ false,
+ type: DriftSqlType.dateTime,
+ requiredDuringInsert: false,
+ defaultValue: currentDateAndTime,
+ );
+ static const VerificationMeta _lastUsedAtMeta = const VerificationMeta(
+ 'lastUsedAt',
+ );
+ @override
+ late final GeneratedColumn<DateTime> lastUsedAt = GeneratedColumn<DateTime>(
+ 'last_used_at',
+ aliasedName,
+ false,
+ type: DriftSqlType.dateTime,
requiredDuringInsert: false,
+ defaultValue: currentDateAndTime,
);
@override
List<GeneratedColumn> get $columns => [
- id,
- guidelinesAccepted,
+ customerKey,
+ privacyAccepted,
+ conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted,
+ carGuidelinesAccepted,
setupComplete,
- displayName,
+ createdAt,
+ lastUsedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
- static const String $name = 'shopin_bit_settings';
+ static const String $name = 'shop_in_bit_settings';
@override
VerificationContext validateIntegrity(
- Insertable<ShopinBitSetting> instance, {
+ Insertable<ShopInBitSetting> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
- if (data.containsKey('id')) {
- context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
+ if (data.containsKey('customer_key')) {
+ context.handle(
+ _customerKeyMeta,
+ customerKey.isAcceptableOrUnknown(
+ data['customer_key']!,
+ _customerKeyMeta,
+ ),
+ );
+ } else if (isInserting) {
+ context.missing(_customerKeyMeta);
+ }
+ if (data.containsKey('privacy_accepted')) {
+ context.handle(
+ _privacyAcceptedMeta,
+ privacyAccepted.isAcceptableOrUnknown(
+ data['privacy_accepted']!,
+ _privacyAcceptedMeta,
+ ),
+ );
}
- if (data.containsKey('guidelines_accepted')) {
+ if (data.containsKey('concierge_guidelines_accepted')) {
context.handle(
- _guidelinesAcceptedMeta,
- guidelinesAccepted.isAcceptableOrUnknown(
- data['guidelines_accepted']!,
- _guidelinesAcceptedMeta,
+ _conciergeGuidelinesAcceptedMeta,
+ conciergeGuidelinesAccepted.isAcceptableOrUnknown(
+ data['concierge_guidelines_accepted']!,
+ _conciergeGuidelinesAcceptedMeta,
+ ),
+ );
+ }
+ if (data.containsKey('travel_guidelines_accepted')) {
+ context.handle(
+ _travelGuidelinesAcceptedMeta,
+ travelGuidelinesAccepted.isAcceptableOrUnknown(
+ data['travel_guidelines_accepted']!,
+ _travelGuidelinesAcceptedMeta,
+ ),
+ );
+ }
+ if (data.containsKey('car_guidelines_accepted')) {
+ context.handle(
+ _carGuidelinesAcceptedMeta,
+ carGuidelinesAccepted.isAcceptableOrUnknown(
+ data['car_guidelines_accepted']!,
+ _carGuidelinesAcceptedMeta,
),
);
}
@@ -261,12 +360,18 @@ class $ShopinBitSettingsTable extends ShopinBitSettings
),
);
}
- if (data.containsKey('display_name')) {
+ if (data.containsKey('created_at')) {
+ context.handle(
+ _createdAtMeta,
+ createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
+ );
+ }
+ if (data.containsKey('last_used_at')) {
context.handle(
- _displayNameMeta,
- displayName.isAcceptableOrUnknown(
- data['display_name']!,
- _displayNameMeta,
+ _lastUsedAtMeta,
+ lastUsedAt.isAcceptableOrUnknown(
+ data['last_used_at']!,
+ _lastUsedAtMeta,
),
);
}
@@ -274,214 +379,362 @@ class $ShopinBitSettingsTable extends ShopinBitSettings
}
@override
- Set<GeneratedColumn> get $primaryKey => {id};
+ Set<GeneratedColumn> get $primaryKey => {customerKey};
@override
- ShopinBitSetting map(Map<String, dynamic> data, {String? tablePrefix}) {
+ ShopInBitSetting map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
- return ShopinBitSetting(
- id: attachedDatabase.typeMapping.read(
- DriftSqlType.int,
- data['${effectivePrefix}id'],
+ return ShopInBitSetting(
+ customerKey: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}customer_key'],
+ )!,
+ privacyAccepted: attachedDatabase.typeMapping.read(
+ DriftSqlType.bool,
+ data['${effectivePrefix}privacy_accepted'],
)!,
- guidelinesAccepted: attachedDatabase.typeMapping.read(
+ conciergeGuidelinesAccepted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
- data['${effectivePrefix}guidelines_accepted'],
+ data['${effectivePrefix}concierge_guidelines_accepted'],
+ )!,
+ travelGuidelinesAccepted: attachedDatabase.typeMapping.read(
+ DriftSqlType.bool,
+ data['${effectivePrefix}travel_guidelines_accepted'],
+ )!,
+ carGuidelinesAccepted: attachedDatabase.typeMapping.read(
+ DriftSqlType.bool,
+ data['${effectivePrefix}car_guidelines_accepted'],
)!,
setupComplete: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}setup_complete'],
)!,
- displayName: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}display_name'],
- ),
+ createdAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.dateTime,
+ data['${effectivePrefix}created_at'],
+ )!,
+ lastUsedAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.dateTime,
+ data['${effectivePrefix}last_used_at'],
+ )!,
);
}
@override
- $ShopinBitSettingsTable createAlias(String alias) {
- return $ShopinBitSettingsTable(attachedDatabase, alias);
+ $ShopInBitSettingsTable createAlias(String alias) {
+ return $ShopInBitSettingsTable(attachedDatabase, alias);
}
+
+ @override
+ bool get withoutRowId => true;
}
-class ShopinBitSetting extends DataClass
- implements Insertable<ShopinBitSetting> {
- final int id;
- final bool guidelinesAccepted;
+class ShopInBitSetting extends DataClass
+ implements Insertable<ShopInBitSetting> {
+ final String customerKey;
+ final bool privacyAccepted;
+ final bool conciergeGuidelinesAccepted;
+ final bool travelGuidelinesAccepted;
+ final bool carGuidelinesAccepted;
final bool setupComplete;
- final String? displayName;
- const ShopinBitSetting({
- required this.id,
- required this.guidelinesAccepted,
+ final DateTime createdAt;
+ final DateTime lastUsedAt;
+ const ShopInBitSetting({
+ required this.customerKey,
+ required this.privacyAccepted,
+ required this.conciergeGuidelinesAccepted,
+ required this.travelGuidelinesAccepted,
+ required this.carGuidelinesAccepted,
required this.setupComplete,
- this.displayName,
+ required this.createdAt,
+ required this.lastUsedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
- map['id'] = Variable<int>(id);
- map['guidelines_accepted'] = Variable<bool>(guidelinesAccepted);
+ map['customer_key'] = Variable<String>(customerKey);
+ map['privacy_accepted'] = Variable<bool>(privacyAccepted);
+ map['concierge_guidelines_accepted'] = Variable<bool>(
+ conciergeGuidelinesAccepted,
+ );
+ map['travel_guidelines_accepted'] = Variable<bool>(
+ travelGuidelinesAccepted,
+ );
+ map['car_guidelines_accepted'] = Variable<bool>(carGuidelinesAccepted);
map['setup_complete'] = Variable<bool>(setupComplete);
- if (!nullToAbsent || displayName != null) {
- map['display_name'] = Variable<String>(displayName);
- }
+ map['created_at'] = Variable<DateTime>(createdAt);
+ map['last_used_at'] = Variable<DateTime>(lastUsedAt);
return map;
}
- ShopinBitSettingsCompanion toCompanion(bool nullToAbsent) {
- return ShopinBitSettingsCompanion(
- id: Value(id),
- guidelinesAccepted: Value(guidelinesAccepted),
+ ShopInBitSettingsCompanion toCompanion(bool nullToAbsent) {
+ return ShopInBitSettingsCompanion(
+ customerKey: Value(customerKey),
+ privacyAccepted: Value(privacyAccepted),
+ conciergeGuidelinesAccepted: Value(conciergeGuidelinesAccepted),
+ travelGuidelinesAccepted: Value(travelGuidelinesAccepted),
+ carGuidelinesAccepted: Value(carGuidelinesAccepted),
setupComplete: Value(setupComplete),
- displayName: displayName == null && nullToAbsent
- ? const Value.absent()
- : Value(displayName),
+ createdAt: Value(createdAt),
+ lastUsedAt: Value(lastUsedAt),
);
}
- factory ShopinBitSetting.fromJson(
+ factory ShopInBitSetting.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
- return ShopinBitSetting(
- id: serializer.fromJson<int>(json['id']),
- guidelinesAccepted: serializer.fromJson<bool>(json['guidelinesAccepted']),
+ return ShopInBitSetting(
+ customerKey: serializer.fromJson<String>(json['customerKey']),
+ privacyAccepted: serializer.fromJson<bool>(json['privacyAccepted']),
+ conciergeGuidelinesAccepted: serializer.fromJson<bool>(
+ json['conciergeGuidelinesAccepted'],
+ ),
+ travelGuidelinesAccepted: serializer.fromJson<bool>(
+ json['travelGuidelinesAccepted'],
+ ),
+ carGuidelinesAccepted: serializer.fromJson<bool>(
+ json['carGuidelinesAccepted'],
+ ),
setupComplete: serializer.fromJson<bool>(json['setupComplete']),
- displayName: serializer.fromJson<String?>(json['displayName']),
+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),
+ lastUsedAt: serializer.fromJson<DateTime>(json['lastUsedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
- 'id': serializer.toJson<int>(id),
- 'guidelinesAccepted': serializer.toJson<bool>(guidelinesAccepted),
+ 'customerKey': serializer.toJson<String>(customerKey),
+ 'privacyAccepted': serializer.toJson<bool>(privacyAccepted),
+ 'conciergeGuidelinesAccepted': serializer.toJson<bool>(
+ conciergeGuidelinesAccepted,
+ ),
+ 'travelGuidelinesAccepted': serializer.toJson<bool>(
+ travelGuidelinesAccepted,
+ ),
+ 'carGuidelinesAccepted': serializer.toJson<bool>(carGuidelinesAccepted),
'setupComplete': serializer.toJson<bool>(setupComplete),
- 'displayName': serializer.toJson<String?>(displayName),
+ 'createdAt': serializer.toJson<DateTime>(createdAt),
+ 'lastUsedAt': serializer.toJson<DateTime>(lastUsedAt),
};
}
- ShopinBitSetting copyWith({
- int? id,
- bool? guidelinesAccepted,
+ ShopInBitSetting copyWith({
+ String? customerKey,
+ bool? privacyAccepted,
+ bool? conciergeGuidelinesAccepted,
+ bool? travelGuidelinesAccepted,
+ bool? carGuidelinesAccepted,
bool? setupComplete,
- Value<String?> displayName = const Value.absent(),
- }) => ShopinBitSetting(
- id: id ?? this.id,
- guidelinesAccepted: guidelinesAccepted ?? this.guidelinesAccepted,
+ DateTime? createdAt,
+ DateTime? lastUsedAt,
+ }) => ShopInBitSetting(
+ customerKey: customerKey ?? this.customerKey,
+ privacyAccepted: privacyAccepted ?? this.privacyAccepted,
+ conciergeGuidelinesAccepted:
+ conciergeGuidelinesAccepted ?? this.conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted:
+ travelGuidelinesAccepted ?? this.travelGuidelinesAccepted,
+ carGuidelinesAccepted: carGuidelinesAccepted ?? this.carGuidelinesAccepted,
setupComplete: setupComplete ?? this.setupComplete,
- displayName: displayName.present ? displayName.value : this.displayName,
- );
- ShopinBitSetting copyWithCompanion(ShopinBitSettingsCompanion data) {
- return ShopinBitSetting(
- id: data.id.present ? data.id.value : this.id,
- guidelinesAccepted: data.guidelinesAccepted.present
- ? data.guidelinesAccepted.value
- : this.guidelinesAccepted,
+ createdAt: createdAt ?? this.createdAt,
+ lastUsedAt: lastUsedAt ?? this.lastUsedAt,
+ );
+ ShopInBitSetting copyWithCompanion(ShopInBitSettingsCompanion data) {
+ return ShopInBitSetting(
+ customerKey: data.customerKey.present
+ ? data.customerKey.value
+ : this.customerKey,
+ privacyAccepted: data.privacyAccepted.present
+ ? data.privacyAccepted.value
+ : this.privacyAccepted,
+ conciergeGuidelinesAccepted: data.conciergeGuidelinesAccepted.present
+ ? data.conciergeGuidelinesAccepted.value
+ : this.conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted: data.travelGuidelinesAccepted.present
+ ? data.travelGuidelinesAccepted.value
+ : this.travelGuidelinesAccepted,
+ carGuidelinesAccepted: data.carGuidelinesAccepted.present
+ ? data.carGuidelinesAccepted.value
+ : this.carGuidelinesAccepted,
setupComplete: data.setupComplete.present
? data.setupComplete.value
: this.setupComplete,
- displayName: data.displayName.present
- ? data.displayName.value
- : this.displayName,
+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
+ lastUsedAt: data.lastUsedAt.present
+ ? data.lastUsedAt.value
+ : this.lastUsedAt,
);
}
@override
String toString() {
- return (StringBuffer('ShopinBitSetting(')
- ..write('id: $id, ')
- ..write('guidelinesAccepted: $guidelinesAccepted, ')
+ return (StringBuffer('ShopInBitSetting(')
+ ..write('customerKey: $customerKey, ')
+ ..write('privacyAccepted: $privacyAccepted, ')
+ ..write('conciergeGuidelinesAccepted: $conciergeGuidelinesAccepted, ')
+ ..write('travelGuidelinesAccepted: $travelGuidelinesAccepted, ')
+ ..write('carGuidelinesAccepted: $carGuidelinesAccepted, ')
..write('setupComplete: $setupComplete, ')
- ..write('displayName: $displayName')
+ ..write('createdAt: $createdAt, ')
+ ..write('lastUsedAt: $lastUsedAt')
..write(')'))
.toString();
}
@override
- int get hashCode =>
- Object.hash(id, guidelinesAccepted, setupComplete, displayName);
+ int get hashCode => Object.hash(
+ customerKey,
+ privacyAccepted,
+ conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted,
+ carGuidelinesAccepted,
+ setupComplete,
+ createdAt,
+ lastUsedAt,
+ );
@override
bool operator ==(Object other) =>
identical(this, other) ||
- (other is ShopinBitSetting &&
- other.id == this.id &&
- other.guidelinesAccepted == this.guidelinesAccepted &&
+ (other is ShopInBitSetting &&
+ other.customerKey == this.customerKey &&
+ other.privacyAccepted == this.privacyAccepted &&
+ other.conciergeGuidelinesAccepted ==
+ this.conciergeGuidelinesAccepted &&
+ other.travelGuidelinesAccepted == this.travelGuidelinesAccepted &&
+ other.carGuidelinesAccepted == this.carGuidelinesAccepted &&
other.setupComplete == this.setupComplete &&
- other.displayName == this.displayName);
+ other.createdAt == this.createdAt &&
+ other.lastUsedAt == this.lastUsedAt);
}
-class ShopinBitSettingsCompanion extends UpdateCompanion<ShopinBitSetting> {
- final Value<int> id;
- final Value<bool> guidelinesAccepted;
+class ShopInBitSettingsCompanion extends UpdateCompanion<ShopInBitSetting> {
+ final Value<String> customerKey;
+ final Value<bool> privacyAccepted;
+ final Value<bool> conciergeGuidelinesAccepted;
+ final Value<bool> travelGuidelinesAccepted;
+ final Value<bool> carGuidelinesAccepted;
final Value<bool> setupComplete;
- final Value<String?> displayName;
- const ShopinBitSettingsCompanion({
- this.id = const Value.absent(),
- this.guidelinesAccepted = const Value.absent(),
+ final Value<DateTime> createdAt;
+ final Value<DateTime> lastUsedAt;
+ const ShopInBitSettingsCompanion({
+ this.customerKey = const Value.absent(),
+ this.privacyAccepted = const Value.absent(),
+ this.conciergeGuidelinesAccepted = const Value.absent(),
+ this.travelGuidelinesAccepted = const Value.absent(),
+ this.carGuidelinesAccepted = const Value.absent(),
this.setupComplete = const Value.absent(),
- this.displayName = const Value.absent(),
+ this.createdAt = const Value.absent(),
+ this.lastUsedAt = const Value.absent(),
});
- ShopinBitSettingsCompanion.insert({
- this.id = const Value.absent(),
- this.guidelinesAccepted = const Value.absent(),
+ ShopInBitSettingsCompanion.insert({
+ required String customerKey,
+ this.privacyAccepted = const Value.absent(),
+ this.conciergeGuidelinesAccepted = const Value.absent(),
+ this.travelGuidelinesAccepted = const Value.absent(),
+ this.carGuidelinesAccepted = const Value.absent(),
this.setupComplete = const Value.absent(),
- this.displayName = const Value.absent(),
- });
- static Insertable<ShopinBitSetting> custom({
- Expression<int>? id,
- Expression<bool>? guidelinesAccepted,
+ this.createdAt = const Value.absent(),
+ this.lastUsedAt = const Value.absent(),
+ }) : customerKey = Value(customerKey);
+ static Insertable<ShopInBitSetting> custom({
+ Expression<String>? customerKey,
+ Expression<bool>? privacyAccepted,
+ Expression<bool>? conciergeGuidelinesAccepted,
+ Expression<bool>? travelGuidelinesAccepted,
+ Expression<bool>? carGuidelinesAccepted,
Expression<bool>? setupComplete,
- Expression<String>? displayName,
+ Expression<DateTime>? createdAt,
+ Expression<DateTime>? lastUsedAt,
}) {
return RawValuesInsertable({
- if (id != null) 'id': id,
- if (guidelinesAccepted != null) 'guidelines_accepted': guidelinesAccepted,
+ if (customerKey != null) 'customer_key': customerKey,
+ if (privacyAccepted != null) 'privacy_accepted': privacyAccepted,
+ if (conciergeGuidelinesAccepted != null)
+ 'concierge_guidelines_accepted': conciergeGuidelinesAccepted,
+ if (travelGuidelinesAccepted != null)
+ 'travel_guidelines_accepted': travelGuidelinesAccepted,
+ if (carGuidelinesAccepted != null)
+ 'car_guidelines_accepted': carGuidelinesAccepted,
if (setupComplete != null) 'setup_complete': setupComplete,
- if (displayName != null) 'display_name': displayName,
+ if (createdAt != null) 'created_at': createdAt,
+ if (lastUsedAt != null) 'last_used_at': lastUsedAt,
});
}
- ShopinBitSettingsCompanion copyWith({
- Value<int>? id,
- Value<bool>? guidelinesAccepted,
+ ShopInBitSettingsCompanion copyWith({
+ Value<String>? customerKey,
+ Value<bool>? privacyAccepted,
+ Value<bool>? conciergeGuidelinesAccepted,
+ Value<bool>? travelGuidelinesAccepted,
+ Value<bool>? carGuidelinesAccepted,
Value<bool>? setupComplete,
- Value<String?>? displayName,
+ Value<DateTime>? createdAt,
+ Value<DateTime>? lastUsedAt,
}) {
- return ShopinBitSettingsCompanion(
- id: id ?? this.id,
- guidelinesAccepted: guidelinesAccepted ?? this.guidelinesAccepted,
+ return ShopInBitSettingsCompanion(
+ customerKey: customerKey ?? this.customerKey,
+ privacyAccepted: privacyAccepted ?? this.privacyAccepted,
+ conciergeGuidelinesAccepted:
+ conciergeGuidelinesAccepted ?? this.conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted:
+ travelGuidelinesAccepted ?? this.travelGuidelinesAccepted,
+ carGuidelinesAccepted:
+ carGuidelinesAccepted ?? this.carGuidelinesAccepted,
setupComplete: setupComplete ?? this.setupComplete,
- displayName: displayName ?? this.displayName,
+ createdAt: createdAt ?? this.createdAt,
+ lastUsedAt: lastUsedAt ?? this.lastUsedAt,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
- if (id.present) {
- map['id'] = Variable<int>(id.value);
+ if (customerKey.present) {
+ map['customer_key'] = Variable<String>(customerKey.value);
+ }
+ if (privacyAccepted.present) {
+ map['privacy_accepted'] = Variable<bool>(privacyAccepted.value);
+ }
+ if (conciergeGuidelinesAccepted.present) {
+ map['concierge_guidelines_accepted'] = Variable<bool>(
+ conciergeGuidelinesAccepted.value,
+ );
+ }
+ if (travelGuidelinesAccepted.present) {
+ map['travel_guidelines_accepted'] = Variable<bool>(
+ travelGuidelinesAccepted.value,
+ );
}
- if (guidelinesAccepted.present) {
- map['guidelines_accepted'] = Variable<bool>(guidelinesAccepted.value);
+ if (carGuidelinesAccepted.present) {
+ map['car_guidelines_accepted'] = Variable<bool>(
+ carGuidelinesAccepted.value,
+ );
}
if (setupComplete.present) {
map['setup_complete'] = Variable<bool>(setupComplete.value);
}
- if (displayName.present) {
- map['display_name'] = Variable<String>(displayName.value);
+ if (createdAt.present) {
+ map['created_at'] = Variable<DateTime>(createdAt.value);
+ }
+ if (lastUsedAt.present) {
+ map['last_used_at'] = Variable<DateTime>(lastUsedAt.value);
}
return map;
}
@override
String toString() {
- return (StringBuffer('ShopinBitSettingsCompanion(')
- ..write('id: $id, ')
- ..write('guidelinesAccepted: $guidelinesAccepted, ')
+ return (StringBuffer('ShopInBitSettingsCompanion(')
+ ..write('customerKey: $customerKey, ')
+ ..write('privacyAccepted: $privacyAccepted, ')
+ ..write('conciergeGuidelinesAccepted: $conciergeGuidelinesAccepted, ')
+ ..write('travelGuidelinesAccepted: $travelGuidelinesAccepted, ')
+ ..write('carGuidelinesAccepted: $carGuidelinesAccepted, ')
..write('setupComplete: $setupComplete, ')
- ..write('displayName: $displayName')
+ ..write('createdAt: $createdAt, ')
+ ..write('lastUsedAt: $lastUsedAt')
..write(')'))
.toString();
}
@@ -493,62 +746,48 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
final GeneratedDatabase attachedDatabase;
final String? _alias;
$ShopInBitTicketsTable(this.attachedDatabase, [this._alias]);
- static const VerificationMeta _ticketIdMeta = const VerificationMeta(
- 'ticketId',
+ static const VerificationMeta _apiTicketIdMeta = const VerificationMeta(
+ 'apiTicketId',
);
@override
- late final GeneratedColumn<String> ticketId = GeneratedColumn<String>(
- 'ticket_id',
+ late final GeneratedColumn<int> apiTicketId = GeneratedColumn<int>(
+ 'api_ticket_id',
aliasedName,
false,
- type: DriftSqlType.string,
+ type: DriftSqlType.int,
requiredDuringInsert: true,
);
- static const VerificationMeta _displayNameMeta = const VerificationMeta(
- 'displayName',
+ static const VerificationMeta _customerKeyMeta = const VerificationMeta(
+ 'customerKey',
);
@override
- late final GeneratedColumn<String> displayName = GeneratedColumn<String>(
- 'display_name',
+ late final GeneratedColumn<String> customerKey = GeneratedColumn<String>(
+ 'customer_key',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
- @override
- late final GeneratedColumnWithTypeConverter<ShopInBitCategory, int> category =
- GeneratedColumn<int>(
- 'category',
- aliasedName,
- false,
- type: DriftSqlType.int,
- requiredDuringInsert: true,
- ).withConverter<ShopInBitCategory>(
- $ShopInBitTicketsTable.$convertercategory,
- );
- @override
- late final GeneratedColumnWithTypeConverter<ShopInBitOrderStatus, int>
- status =
- GeneratedColumn<int>(
- 'status',
- aliasedName,
- false,
- type: DriftSqlType.int,
- requiredDuringInsert: true,
- ).withConverter<ShopInBitOrderStatus>(
- $ShopInBitTicketsTable.$converterstatus,
- );
- static const VerificationMeta _statusRawMeta = const VerificationMeta(
- 'statusRaw',
+ static const VerificationMeta _ticketNumberMeta = const VerificationMeta(
+ 'ticketNumber',
);
@override
- late final GeneratedColumn<String> statusRaw = GeneratedColumn<String>(
- 'status_raw',
+ late final GeneratedColumn<String> ticketNumber = GeneratedColumn<String>(
+ 'ticket_number',
aliasedName,
- true,
+ false,
type: DriftSqlType.string,
- requiredDuringInsert: false,
+ requiredDuringInsert: true,
);
+ @override
+ late final GeneratedColumnWithTypeConverter<ShopInBitCategory, String>
+ category = GeneratedColumn<String>(
+ 'category',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ ).withConverter<ShopInBitCategory>($ShopInBitTicketsTable.$convertercategory);
static const VerificationMeta _requestDescriptionMeta =
const VerificationMeta('requestDescription');
@override
@@ -571,6 +810,29 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
type: DriftSqlType.string,
requiredDuringInsert: true,
);
+ @override
+ late final GeneratedColumnWithTypeConverter<ShopInBitOrderStatus, String>
+ status =
+ GeneratedColumn<String>(
+ 'status',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ ).withConverter<ShopInBitOrderStatus>(
+ $ShopInBitTicketsTable.$converterstatus,
+ );
+ static const VerificationMeta _statusRawMeta = const VerificationMeta(
+ 'statusRaw',
+ );
+ @override
+ late final GeneratedColumn<String> statusRaw = GeneratedColumn<String>(
+ 'status_raw',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ );
static const VerificationMeta _offerProductNameMeta = const VerificationMeta(
'offerProductName',
);
@@ -593,85 +855,61 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
type: DriftSqlType.string,
requiredDuringInsert: false,
);
- static const VerificationMeta _shippingNameMeta = const VerificationMeta(
- 'shippingName',
- );
- @override
- late final GeneratedColumn<String> shippingName = GeneratedColumn<String>(
- 'shipping_name',
- aliasedName,
- false,
- type: DriftSqlType.string,
- requiredDuringInsert: true,
- );
- static const VerificationMeta _shippingStreetMeta = const VerificationMeta(
- 'shippingStreet',
- );
- @override
- late final GeneratedColumn<String> shippingStreet = GeneratedColumn<String>(
- 'shipping_street',
- aliasedName,
- false,
- type: DriftSqlType.string,
- requiredDuringInsert: true,
- );
- static const VerificationMeta _shippingCityMeta = const VerificationMeta(
- 'shippingCity',
- );
- @override
- late final GeneratedColumn<String> shippingCity = GeneratedColumn<String>(
- 'shipping_city',
- aliasedName,
- false,
- type: DriftSqlType.string,
- requiredDuringInsert: true,
- );
- static const VerificationMeta _shippingPostalCodeMeta =
- const VerificationMeta('shippingPostalCode');
+ static const VerificationMeta _paymentInvoiceStatusMeta =
+ const VerificationMeta('paymentInvoiceStatus');
@override
- late final GeneratedColumn<String> shippingPostalCode =
+ late final GeneratedColumn<String> paymentInvoiceStatus =
GeneratedColumn<String>(
- 'shipping_postal_code',
+ 'payment_invoice_status',
aliasedName,
- false,
+ true,
type: DriftSqlType.string,
- requiredDuringInsert: true,
+ requiredDuringInsert: false,
);
- static const VerificationMeta _shippingCountryMeta = const VerificationMeta(
- 'shippingCountry',
+ static const VerificationMeta _trackingLinkMeta = const VerificationMeta(
+ 'trackingLink',
);
@override
- late final GeneratedColumn<String> shippingCountry = GeneratedColumn<String>(
- 'shipping_country',
+ late final GeneratedColumn<String> trackingLink = GeneratedColumn<String>(
+ 'tracking_link',
aliasedName,
- false,
+ true,
type: DriftSqlType.string,
- requiredDuringInsert: true,
+ requiredDuringInsert: false,
);
- static const VerificationMeta _paymentMethodMeta = const VerificationMeta(
- 'paymentMethod',
+ static const VerificationMeta _lastAgentMessageAtMeta =
+ const VerificationMeta('lastAgentMessageAt');
+ @override
+ late final GeneratedColumn<DateTime> lastAgentMessageAt =
+ GeneratedColumn<DateTime>(
+ 'last_agent_message_at',
+ aliasedName,
+ true,
+ type: DriftSqlType.dateTime,
+ requiredDuringInsert: false,
+ );
+ static const VerificationMeta _feeTicketNumberMeta = const VerificationMeta(
+ 'feeTicketNumber',
);
@override
- late final GeneratedColumn<String> paymentMethod = GeneratedColumn<String>(
- 'payment_method',
+ late final GeneratedColumn<String> feeTicketNumber = GeneratedColumn<String>(
+ 'fee_ticket_number',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
@override
- late final GeneratedColumnWithTypeConverter<
- List<ShopInBitTicketMessage>,
- String
- >
+ late final GeneratedColumnWithTypeConverter<List<TicketMessage>, String>
messages =
GeneratedColumn<String>(
'messages',
aliasedName,
false,
type: DriftSqlType.string,
- requiredDuringInsert: true,
- ).withConverter<List<ShopInBitTicketMessage>>(
+ requiredDuringInsert: false,
+ defaultValue: const Constant("[]"),
+ ).withConverter<List<TicketMessage>>(
$ShopInBitTicketsTable.$convertermessages,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
@@ -683,116 +921,40 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
aliasedName,
false,
type: DriftSqlType.dateTime,
- requiredDuringInsert: true,
- );
- static const VerificationMeta _apiTicketIdMeta = const VerificationMeta(
- 'apiTicketId',
- );
- @override
- late final GeneratedColumn<int> apiTicketId = GeneratedColumn<int>(
- 'api_ticket_id',
- aliasedName,
- false,
- type: DriftSqlType.int,
- requiredDuringInsert: true,
- );
- static const VerificationMeta _carResearchInvoiceIdMeta =
- const VerificationMeta('carResearchInvoiceId');
- @override
- late final GeneratedColumn<String> carResearchInvoiceId =
- GeneratedColumn<String>(
- 'car_research_invoice_id',
- aliasedName,
- true,
- type: DriftSqlType.string,
- requiredDuringInsert: false,
- );
- static const VerificationMeta _feeTicketNumberMeta = const VerificationMeta(
- 'feeTicketNumber',
- );
- @override
- late final GeneratedColumn<String> feeTicketNumber = GeneratedColumn<String>(
- 'fee_ticket_number',
- aliasedName,
- true,
- type: DriftSqlType.string,
requiredDuringInsert: false,
+ defaultValue: currentDateAndTime,
);
- static const VerificationMeta _needsCreateRequestMeta =
- const VerificationMeta('needsCreateRequest');
- @override
- late final GeneratedColumn<bool> needsCreateRequest = GeneratedColumn<bool>(
- 'needs_create_request',
- aliasedName,
- false,
- type: DriftSqlType.bool,
- requiredDuringInsert: true,
- defaultConstraints: GeneratedColumn.constraintIsAlways(
- 'CHECK ("needs_create_request" IN (0, 1))',
- ),
- );
- static const VerificationMeta _isPendingPaymentMeta = const VerificationMeta(
- 'isPendingPayment',
+ static const VerificationMeta _updatedAtMeta = const VerificationMeta(
+ 'updatedAt',
);
@override
- late final GeneratedColumn<bool> isPendingPayment = GeneratedColumn<bool>(
- 'is_pending_payment',
+ late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
+ 'updated_at',
aliasedName,
false,
- type: DriftSqlType.bool,
- requiredDuringInsert: true,
- defaultConstraints: GeneratedColumn.constraintIsAlways(
- 'CHECK ("is_pending_payment" IN (0, 1))',
- ),
+ type: DriftSqlType.dateTime,
+ requiredDuringInsert: false,
+ defaultValue: currentDateAndTime,
);
- static const VerificationMeta _carResearchExpiresAtMeta =
- const VerificationMeta('carResearchExpiresAt');
- @override
- late final GeneratedColumn<DateTime> carResearchExpiresAt =
- GeneratedColumn<DateTime>(
- 'car_research_expires_at',
- aliasedName,
- true,
- type: DriftSqlType.dateTime,
- requiredDuringInsert: false,
- );
- static const VerificationMeta _carResearchPaymentLinksMeta =
- const VerificationMeta('carResearchPaymentLinks');
- @override
- late final GeneratedColumn<String> carResearchPaymentLinks =
- GeneratedColumn<String>(
- 'car_research_payment_links',
- aliasedName,
- true,
- type: DriftSqlType.string,
- requiredDuringInsert: false,
- );
@override
List<GeneratedColumn> get $columns => [
- ticketId,
- displayName,
+ apiTicketId,
+ customerKey,
+ ticketNumber,
category,
- status,
- statusRaw,
requestDescription,
deliveryCountry,
+ status,
+ statusRaw,
offerProductName,
offerPrice,
- shippingName,
- shippingStreet,
- shippingCity,
- shippingPostalCode,
- shippingCountry,
- paymentMethod,
+ paymentInvoiceStatus,
+ trackingLink,
+ lastAgentMessageAt,
+ feeTicketNumber,
messages,
createdAt,
- apiTicketId,
- carResearchInvoiceId,
- feeTicketNumber,
- needsCreateRequest,
- isPendingPayment,
- carResearchExpiresAt,
- carResearchPaymentLinks,
+ updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@@ -806,30 +968,38 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
- if (data.containsKey('ticket_id')) {
+ if (data.containsKey('api_ticket_id')) {
context.handle(
- _ticketIdMeta,
- ticketId.isAcceptableOrUnknown(data['ticket_id']!, _ticketIdMeta),
+ _apiTicketIdMeta,
+ apiTicketId.isAcceptableOrUnknown(
+ data['api_ticket_id']!,
+ _apiTicketIdMeta,
+ ),
);
} else if (isInserting) {
- context.missing(_ticketIdMeta);
+ context.missing(_apiTicketIdMeta);
}
- if (data.containsKey('display_name')) {
+ if (data.containsKey('customer_key')) {
context.handle(
- _displayNameMeta,
- displayName.isAcceptableOrUnknown(
- data['display_name']!,
- _displayNameMeta,
+ _customerKeyMeta,
+ customerKey.isAcceptableOrUnknown(
+ data['customer_key']!,
+ _customerKeyMeta,
),
);
} else if (isInserting) {
- context.missing(_displayNameMeta);
+ context.missing(_customerKeyMeta);
}
- if (data.containsKey('status_raw')) {
+ if (data.containsKey('ticket_number')) {
context.handle(
- _statusRawMeta,
- statusRaw.isAcceptableOrUnknown(data['status_raw']!, _statusRawMeta),
+ _ticketNumberMeta,
+ ticketNumber.isAcceptableOrUnknown(
+ data['ticket_number']!,
+ _ticketNumberMeta,
+ ),
);
+ } else if (isInserting) {
+ context.missing(_ticketNumberMeta);
}
if (data.containsKey('request_description')) {
context.handle(
@@ -853,6 +1023,14 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
} else if (isInserting) {
context.missing(_deliveryCountryMeta);
}
+ if (data.containsKey('status_raw')) {
+ context.handle(
+ _statusRawMeta,
+ statusRaw.isAcceptableOrUnknown(data['status_raw']!, _statusRawMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_statusRawMeta);
+ }
if (data.containsKey('offer_product_name')) {
context.handle(
_offerProductNameMeta,
@@ -868,95 +1046,30 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
offerPrice.isAcceptableOrUnknown(data['offer_price']!, _offerPriceMeta),
);
}
- if (data.containsKey('shipping_name')) {
+ if (data.containsKey('payment_invoice_status')) {
context.handle(
- _shippingNameMeta,
- shippingName.isAcceptableOrUnknown(
- data['shipping_name']!,
- _shippingNameMeta,
+ _paymentInvoiceStatusMeta,
+ paymentInvoiceStatus.isAcceptableOrUnknown(
+ data['payment_invoice_status']!,
+ _paymentInvoiceStatusMeta,
),
);
- } else if (isInserting) {
- context.missing(_shippingNameMeta);
- }
- if (data.containsKey('shipping_street')) {
- context.handle(
- _shippingStreetMeta,
- shippingStreet.isAcceptableOrUnknown(
- data['shipping_street']!,
- _shippingStreetMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_shippingStreetMeta);
- }
- if (data.containsKey('shipping_city')) {
- context.handle(
- _shippingCityMeta,
- shippingCity.isAcceptableOrUnknown(
- data['shipping_city']!,
- _shippingCityMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_shippingCityMeta);
- }
- if (data.containsKey('shipping_postal_code')) {
- context.handle(
- _shippingPostalCodeMeta,
- shippingPostalCode.isAcceptableOrUnknown(
- data['shipping_postal_code']!,
- _shippingPostalCodeMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_shippingPostalCodeMeta);
- }
- if (data.containsKey('shipping_country')) {
- context.handle(
- _shippingCountryMeta,
- shippingCountry.isAcceptableOrUnknown(
- data['shipping_country']!,
- _shippingCountryMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_shippingCountryMeta);
- }
- if (data.containsKey('payment_method')) {
- context.handle(
- _paymentMethodMeta,
- paymentMethod.isAcceptableOrUnknown(
- data['payment_method']!,
- _paymentMethodMeta,
- ),
- );
- }
- if (data.containsKey('created_at')) {
- context.handle(
- _createdAtMeta,
- createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
- );
- } else if (isInserting) {
- context.missing(_createdAtMeta);
}
- if (data.containsKey('api_ticket_id')) {
+ if (data.containsKey('tracking_link')) {
context.handle(
- _apiTicketIdMeta,
- apiTicketId.isAcceptableOrUnknown(
- data['api_ticket_id']!,
- _apiTicketIdMeta,
+ _trackingLinkMeta,
+ trackingLink.isAcceptableOrUnknown(
+ data['tracking_link']!,
+ _trackingLinkMeta,
),
);
- } else if (isInserting) {
- context.missing(_apiTicketIdMeta);
}
- if (data.containsKey('car_research_invoice_id')) {
+ if (data.containsKey('last_agent_message_at')) {
context.handle(
- _carResearchInvoiceIdMeta,
- carResearchInvoiceId.isAcceptableOrUnknown(
- data['car_research_invoice_id']!,
- _carResearchInvoiceIdMeta,
+ _lastAgentMessageAtMeta,
+ lastAgentMessageAt.isAcceptableOrUnknown(
+ data['last_agent_message_at']!,
+ _lastAgentMessageAtMeta,
),
);
}
@@ -969,86 +1082,62 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
),
);
}
- if (data.containsKey('needs_create_request')) {
- context.handle(
- _needsCreateRequestMeta,
- needsCreateRequest.isAcceptableOrUnknown(
- data['needs_create_request']!,
- _needsCreateRequestMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_needsCreateRequestMeta);
- }
- if (data.containsKey('is_pending_payment')) {
- context.handle(
- _isPendingPaymentMeta,
- isPendingPayment.isAcceptableOrUnknown(
- data['is_pending_payment']!,
- _isPendingPaymentMeta,
- ),
- );
- } else if (isInserting) {
- context.missing(_isPendingPaymentMeta);
- }
- if (data.containsKey('car_research_expires_at')) {
+ if (data.containsKey('created_at')) {
context.handle(
- _carResearchExpiresAtMeta,
- carResearchExpiresAt.isAcceptableOrUnknown(
- data['car_research_expires_at']!,
- _carResearchExpiresAtMeta,
- ),
+ _createdAtMeta,
+ createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
- if (data.containsKey('car_research_payment_links')) {
+ if (data.containsKey('updated_at')) {
context.handle(
- _carResearchPaymentLinksMeta,
- carResearchPaymentLinks.isAcceptableOrUnknown(
- data['car_research_payment_links']!,
- _carResearchPaymentLinksMeta,
- ),
+ _updatedAtMeta,
+ updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
- Set<GeneratedColumn> get $primaryKey => {ticketId};
+ Set<GeneratedColumn> get $primaryKey => {apiTicketId};
@override
ShopInBitTicket map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ShopInBitTicket(
- ticketId: attachedDatabase.typeMapping.read(
+ apiTicketId: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}api_ticket_id'],
+ )!,
+ customerKey: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}ticket_id'],
+ data['${effectivePrefix}customer_key'],
)!,
- displayName: attachedDatabase.typeMapping.read(
+ ticketNumber: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}display_name'],
+ data['${effectivePrefix}ticket_number'],
)!,
category: $ShopInBitTicketsTable.$convertercategory.fromSql(
attachedDatabase.typeMapping.read(
- DriftSqlType.int,
+ DriftSqlType.string,
data['${effectivePrefix}category'],
)!,
),
- status: $ShopInBitTicketsTable.$converterstatus.fromSql(
- attachedDatabase.typeMapping.read(
- DriftSqlType.int,
- data['${effectivePrefix}status'],
- )!,
- ),
- statusRaw: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}status_raw'],
- ),
requestDescription: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}request_description'],
)!,
deliveryCountry: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}delivery_country'],
+ data['${effectivePrefix}delivery_country'],
+ )!,
+ status: $ShopInBitTicketsTable.$converterstatus.fromSql(
+ attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}status'],
+ )!,
+ ),
+ statusRaw: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}status_raw'],
)!,
offerProductName: attachedDatabase.typeMapping.read(
DriftSqlType.string,
@@ -1058,29 +1147,21 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
DriftSqlType.string,
data['${effectivePrefix}offer_price'],
),
- shippingName: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}shipping_name'],
- )!,
- shippingStreet: attachedDatabase.typeMapping.read(
+ paymentInvoiceStatus: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}shipping_street'],
- )!,
- shippingCity: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}shipping_city'],
- )!,
- shippingPostalCode: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}shipping_postal_code'],
- )!,
- shippingCountry: attachedDatabase.typeMapping.read(
+ data['${effectivePrefix}payment_invoice_status'],
+ ),
+ trackingLink: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}shipping_country'],
- )!,
- paymentMethod: attachedDatabase.typeMapping.read(
+ data['${effectivePrefix}tracking_link'],
+ ),
+ lastAgentMessageAt: attachedDatabase.typeMapping.read(
+ DriftSqlType.dateTime,
+ data['${effectivePrefix}last_agent_message_at'],
+ ),
+ feeTicketNumber: attachedDatabase.typeMapping.read(
DriftSqlType.string,
- data['${effectivePrefix}payment_method'],
+ data['${effectivePrefix}fee_ticket_number'],
),
messages: $ShopInBitTicketsTable.$convertermessages.fromSql(
attachedDatabase.typeMapping.read(
@@ -1092,34 +1173,10 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
DriftSqlType.dateTime,
data['${effectivePrefix}created_at'],
)!,
- apiTicketId: attachedDatabase.typeMapping.read(
- DriftSqlType.int,
- data['${effectivePrefix}api_ticket_id'],
- )!,
- carResearchInvoiceId: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}car_research_invoice_id'],
- ),
- feeTicketNumber: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}fee_ticket_number'],
- ),
- needsCreateRequest: attachedDatabase.typeMapping.read(
- DriftSqlType.bool,
- data['${effectivePrefix}needs_create_request'],
- )!,
- isPendingPayment: attachedDatabase.typeMapping.read(
- DriftSqlType.bool,
- data['${effectivePrefix}is_pending_payment'],
- )!,
- carResearchExpiresAt: attachedDatabase.typeMapping.read(
+ updatedAt: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
- data['${effectivePrefix}car_research_expires_at'],
- ),
- carResearchPaymentLinks: attachedDatabase.typeMapping.read(
- DriftSqlType.string,
- data['${effectivePrefix}car_research_payment_links'],
- ),
+ data['${effectivePrefix}updated_at'],
+ )!,
);
}
@@ -1128,169 +1185,135 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
return $ShopInBitTicketsTable(attachedDatabase, alias);
}
- static JsonTypeConverter2<ShopInBitCategory, int, int> $convertercategory =
- const EnumIndexConverter<ShopInBitCategory>(ShopInBitCategory.values);
- static JsonTypeConverter2<ShopInBitOrderStatus, int, int> $converterstatus =
- const EnumIndexConverter<ShopInBitOrderStatus>(
- ShopInBitOrderStatus.values,
- );
- static JsonTypeConverter2<List<ShopInBitTicketMessage>, String, List<dynamic>>
- $convertermessages = const ShopInBitTicketMessagesConverter();
+ static JsonTypeConverter2<ShopInBitCategory, String, String>
+ $convertercategory = const EnumNameConverter<ShopInBitCategory>(
+ ShopInBitCategory.values,
+ );
+ static JsonTypeConverter2<ShopInBitOrderStatus, String, String>
+ $converterstatus = const EnumNameConverter<ShopInBitOrderStatus>(
+ ShopInBitOrderStatus.values,
+ );
+ static TypeConverter<List<TicketMessage>, String> $convertermessages =
+ const MessagesConverter();
+ @override
+ bool get withoutRowId => true;
}
class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
- final String ticketId;
- final String displayName;
+ final int apiTicketId;
+ final String customerKey;
+ final String ticketNumber;
final ShopInBitCategory category;
- final ShopInBitOrderStatus status;
- final String? statusRaw;
final String requestDescription;
final String deliveryCountry;
+ final ShopInBitOrderStatus status;
+ final String statusRaw;
final String? offerProductName;
final String? offerPrice;
- final String shippingName;
- final String shippingStreet;
- final String shippingCity;
- final String shippingPostalCode;
- final String shippingCountry;
- final String? paymentMethod;
- final List<ShopInBitTicketMessage> messages;
- final DateTime createdAt;
- final int apiTicketId;
- final String? carResearchInvoiceId;
+ final String? paymentInvoiceStatus;
+ final String? trackingLink;
+ final DateTime? lastAgentMessageAt;
final String? feeTicketNumber;
- final bool needsCreateRequest;
- final bool isPendingPayment;
- final DateTime? carResearchExpiresAt;
- final String? carResearchPaymentLinks;
+ final List<TicketMessage> messages;
+ final DateTime createdAt;
+ final DateTime updatedAt;
const ShopInBitTicket({
- required this.ticketId,
- required this.displayName,
+ required this.apiTicketId,
+ required this.customerKey,
+ required this.ticketNumber,
required this.category,
- required this.status,
- this.statusRaw,
required this.requestDescription,
required this.deliveryCountry,
+ required this.status,
+ required this.statusRaw,
this.offerProductName,
this.offerPrice,
- required this.shippingName,
- required this.shippingStreet,
- required this.shippingCity,
- required this.shippingPostalCode,
- required this.shippingCountry,
- this.paymentMethod,
+ this.paymentInvoiceStatus,
+ this.trackingLink,
+ this.lastAgentMessageAt,
+ this.feeTicketNumber,
required this.messages,
required this.createdAt,
- required this.apiTicketId,
- this.carResearchInvoiceId,
- this.feeTicketNumber,
- required this.needsCreateRequest,
- required this.isPendingPayment,
- this.carResearchExpiresAt,
- this.carResearchPaymentLinks,
+ required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
- map['ticket_id'] = Variable<String>(ticketId);
- map['display_name'] = Variable<String>(displayName);
+ map['api_ticket_id'] = Variable<int>(apiTicketId);
+ map['customer_key'] = Variable<String>(customerKey);
+ map['ticket_number'] = Variable<String>(ticketNumber);
{
- map['category'] = Variable<int>(
+ map['category'] = Variable<String>(
$ShopInBitTicketsTable.$convertercategory.toSql(category),
);
}
+ map['request_description'] = Variable<String>(requestDescription);
+ map['delivery_country'] = Variable<String>(deliveryCountry);
{
- map['status'] = Variable<int>(
+ map['status'] = Variable<String>(
$ShopInBitTicketsTable.$converterstatus.toSql(status),
);
}
- if (!nullToAbsent || statusRaw != null) {
- map['status_raw'] = Variable<String>(statusRaw);
- }
- map['request_description'] = Variable<String>(requestDescription);
- map['delivery_country'] = Variable<String>(deliveryCountry);
+ map['status_raw'] = Variable<String>(statusRaw);
if (!nullToAbsent || offerProductName != null) {
map['offer_product_name'] = Variable<String>(offerProductName);
}
if (!nullToAbsent || offerPrice != null) {
map['offer_price'] = Variable<String>(offerPrice);
}
- map['shipping_name'] = Variable<String>(shippingName);
- map['shipping_street'] = Variable<String>(shippingStreet);
- map['shipping_city'] = Variable<String>(shippingCity);
- map['shipping_postal_code'] = Variable<String>(shippingPostalCode);
- map['shipping_country'] = Variable<String>(shippingCountry);
- if (!nullToAbsent || paymentMethod != null) {
- map['payment_method'] = Variable<String>(paymentMethod);
+ if (!nullToAbsent || paymentInvoiceStatus != null) {
+ map['payment_invoice_status'] = Variable<String>(paymentInvoiceStatus);
}
- {
- map['messages'] = Variable<String>(
- $ShopInBitTicketsTable.$convertermessages.toSql(messages),
- );
+ if (!nullToAbsent || trackingLink != null) {
+ map['tracking_link'] = Variable<String>(trackingLink);
}
- map['created_at'] = Variable<DateTime>(createdAt);
- map['api_ticket_id'] = Variable<int>(apiTicketId);
- if (!nullToAbsent || carResearchInvoiceId != null) {
- map['car_research_invoice_id'] = Variable<String>(carResearchInvoiceId);
+ if (!nullToAbsent || lastAgentMessageAt != null) {
+ map['last_agent_message_at'] = Variable<DateTime>(lastAgentMessageAt);
}
if (!nullToAbsent || feeTicketNumber != null) {
map['fee_ticket_number'] = Variable<String>(feeTicketNumber);
}
- map['needs_create_request'] = Variable<bool>(needsCreateRequest);
- map['is_pending_payment'] = Variable<bool>(isPendingPayment);
- if (!nullToAbsent || carResearchExpiresAt != null) {
- map['car_research_expires_at'] = Variable<DateTime>(carResearchExpiresAt);
- }
- if (!nullToAbsent || carResearchPaymentLinks != null) {
- map['car_research_payment_links'] = Variable<String>(
- carResearchPaymentLinks,
+ {
+ map['messages'] = Variable<String>(
+ $ShopInBitTicketsTable.$convertermessages.toSql(messages),
);
}
+ map['created_at'] = Variable<DateTime>(createdAt);
+ map['updated_at'] = Variable<DateTime>(updatedAt);
return map;
}
ShopInBitTicketsCompanion toCompanion(bool nullToAbsent) {
return ShopInBitTicketsCompanion(
- ticketId: Value(ticketId),
- displayName: Value(displayName),
+ apiTicketId: Value(apiTicketId),
+ customerKey: Value(customerKey),
+ ticketNumber: Value(ticketNumber),
category: Value(category),
- status: Value(status),
- statusRaw: statusRaw == null && nullToAbsent
- ? const Value.absent()
- : Value(statusRaw),
requestDescription: Value(requestDescription),
deliveryCountry: Value(deliveryCountry),
+ status: Value(status),
+ statusRaw: Value(statusRaw),
offerProductName: offerProductName == null && nullToAbsent
? const Value.absent()
: Value(offerProductName),
offerPrice: offerPrice == null && nullToAbsent
? const Value.absent()
: Value(offerPrice),
- shippingName: Value(shippingName),
- shippingStreet: Value(shippingStreet),
- shippingCity: Value(shippingCity),
- shippingPostalCode: Value(shippingPostalCode),
- shippingCountry: Value(shippingCountry),
- paymentMethod: paymentMethod == null && nullToAbsent
+ paymentInvoiceStatus: paymentInvoiceStatus == null && nullToAbsent
? const Value.absent()
- : Value(paymentMethod),
- messages: Value(messages),
- createdAt: Value(createdAt),
- apiTicketId: Value(apiTicketId),
- carResearchInvoiceId: carResearchInvoiceId == null && nullToAbsent
+ : Value(paymentInvoiceStatus),
+ trackingLink: trackingLink == null && nullToAbsent
? const Value.absent()
- : Value(carResearchInvoiceId),
+ : Value(trackingLink),
+ lastAgentMessageAt: lastAgentMessageAt == null && nullToAbsent
+ ? const Value.absent()
+ : Value(lastAgentMessageAt),
feeTicketNumber: feeTicketNumber == null && nullToAbsent
? const Value.absent()
: Value(feeTicketNumber),
- needsCreateRequest: Value(needsCreateRequest),
- isPendingPayment: Value(isPendingPayment),
- carResearchExpiresAt: carResearchExpiresAt == null && nullToAbsent
- ? const Value.absent()
- : Value(carResearchExpiresAt),
- carResearchPaymentLinks: carResearchPaymentLinks == null && nullToAbsent
- ? const Value.absent()
- : Value(carResearchPaymentLinks),
+ messages: Value(messages),
+ createdAt: Value(createdAt),
+ updatedAt: Value(updatedAt),
);
}
@@ -1300,569 +1323,416 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ShopInBitTicket(
- ticketId: serializer.fromJson<String>(json['ticketId']),
- displayName: serializer.fromJson<String>(json['displayName']),
+ apiTicketId: serializer.fromJson<int>(json['apiTicketId']),
+ customerKey: serializer.fromJson<String>(json['customerKey']),
+ ticketNumber: serializer.fromJson<String>(json['ticketNumber']),
category: $ShopInBitTicketsTable.$convertercategory.fromJson(
- serializer.fromJson<int>(json['category']),
+ serializer.fromJson<String>(json['category']),
),
- status: $ShopInBitTicketsTable.$converterstatus.fromJson(
- serializer.fromJson<int>(json['status']),
- ),
- statusRaw: serializer.fromJson<String?>(json['statusRaw']),
requestDescription: serializer.fromJson<String>(
json['requestDescription'],
),
deliveryCountry: serializer.fromJson<String>(json['deliveryCountry']),
+ status: $ShopInBitTicketsTable.$converterstatus.fromJson(
+ serializer.fromJson<String>(json['status']),
+ ),
+ statusRaw: serializer.fromJson<String>(json['statusRaw']),
offerProductName: serializer.fromJson<String?>(json['offerProductName']),
offerPrice: serializer.fromJson<String?>(json['offerPrice']),
- shippingName: serializer.fromJson<String>(json['shippingName']),
- shippingStreet: serializer.fromJson<String>(json['shippingStreet']),
- shippingCity: serializer.fromJson<String>(json['shippingCity']),
- shippingPostalCode: serializer.fromJson<String>(
- json['shippingPostalCode'],
+ paymentInvoiceStatus: serializer.fromJson<String?>(
+ json['paymentInvoiceStatus'],
),
- shippingCountry: serializer.fromJson<String>(json['shippingCountry']),
- paymentMethod: serializer.fromJson<String?>(json['paymentMethod']),
- messages: $ShopInBitTicketsTable.$convertermessages.fromJson(
- serializer.fromJson<List<dynamic>>(json['messages']),
- ),
- createdAt: serializer.fromJson<DateTime>(json['createdAt']),
- apiTicketId: serializer.fromJson<int>(json['apiTicketId']),
- carResearchInvoiceId: serializer.fromJson<String?>(
- json['carResearchInvoiceId'],
+ trackingLink: serializer.fromJson<String?>(json['trackingLink']),
+ lastAgentMessageAt: serializer.fromJson<DateTime?>(
+ json['lastAgentMessageAt'],
),
feeTicketNumber: serializer.fromJson<String?>(json['feeTicketNumber']),
- needsCreateRequest: serializer.fromJson<bool>(json['needsCreateRequest']),
- isPendingPayment: serializer.fromJson<bool>(json['isPendingPayment']),
- carResearchExpiresAt: serializer.fromJson<DateTime?>(
- json['carResearchExpiresAt'],
- ),
- carResearchPaymentLinks: serializer.fromJson<String?>(
- json['carResearchPaymentLinks'],
- ),
+ messages: serializer.fromJson<List<TicketMessage>>(json['messages']),
+ createdAt: serializer.fromJson<DateTime>(json['createdAt']),
+ updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
- 'ticketId': serializer.toJson<String>(ticketId),
- 'displayName': serializer.toJson<String>(displayName),
- 'category': serializer.toJson<int>(
+ 'apiTicketId': serializer.toJson<int>(apiTicketId),
+ 'customerKey': serializer.toJson<String>(customerKey),
+ 'ticketNumber': serializer.toJson<String>(ticketNumber),
+ 'category': serializer.toJson<String>(
$ShopInBitTicketsTable.$convertercategory.toJson(category),
),
- 'status': serializer.toJson<int>(
- $ShopInBitTicketsTable.$converterstatus.toJson(status),
- ),
- 'statusRaw': serializer.toJson<String?>(statusRaw),
'requestDescription': serializer.toJson<String>(requestDescription),
'deliveryCountry': serializer.toJson<String>(deliveryCountry),
+ 'status': serializer.toJson<String>(
+ $ShopInBitTicketsTable.$converterstatus.toJson(status),
+ ),
+ 'statusRaw': serializer.toJson<String>(statusRaw),
'offerProductName': serializer.toJson<String?>(offerProductName),
'offerPrice': serializer.toJson<String?>(offerPrice),
- 'shippingName': serializer.toJson<String>(shippingName),
- 'shippingStreet': serializer.toJson<String>(shippingStreet),
- 'shippingCity': serializer.toJson<String>(shippingCity),
- 'shippingPostalCode': serializer.toJson<String>(shippingPostalCode),
- 'shippingCountry': serializer.toJson<String>(shippingCountry),
- 'paymentMethod': serializer.toJson<String?>(paymentMethod),
- 'messages': serializer.toJson<List<dynamic>>(
- $ShopInBitTicketsTable.$convertermessages.toJson(messages),
- ),
- 'createdAt': serializer.toJson<DateTime>(createdAt),
- 'apiTicketId': serializer.toJson<int>(apiTicketId),
- 'carResearchInvoiceId': serializer.toJson<String?>(carResearchInvoiceId),
+ 'paymentInvoiceStatus': serializer.toJson<String?>(paymentInvoiceStatus),
+ 'trackingLink': serializer.toJson<String?>(trackingLink),
+ 'lastAgentMessageAt': serializer.toJson<DateTime?>(lastAgentMessageAt),
'feeTicketNumber': serializer.toJson<String?>(feeTicketNumber),
- 'needsCreateRequest': serializer.toJson<bool>(needsCreateRequest),
- 'isPendingPayment': serializer.toJson<bool>(isPendingPayment),
- 'carResearchExpiresAt': serializer.toJson<DateTime?>(
- carResearchExpiresAt,
- ),
- 'carResearchPaymentLinks': serializer.toJson<String?>(
- carResearchPaymentLinks,
- ),
+ 'messages': serializer.toJson<List<TicketMessage>>(messages),
+ 'createdAt': serializer.toJson<DateTime>(createdAt),
+ 'updatedAt': serializer.toJson<DateTime>(updatedAt),
};
}
ShopInBitTicket copyWith({
- String? ticketId,
- String? displayName,
+ int? apiTicketId,
+ String? customerKey,
+ String? ticketNumber,
ShopInBitCategory? category,
- ShopInBitOrderStatus? status,
- Value<String?> statusRaw = const Value.absent(),
String? requestDescription,
String? deliveryCountry,
+ ShopInBitOrderStatus? status,
+ String? statusRaw,
Value<String?> offerProductName = const Value.absent(),
Value<String?> offerPrice = const Value.absent(),
- String? shippingName,
- String? shippingStreet,
- String? shippingCity,
- String? shippingPostalCode,
- String? shippingCountry,
- Value<String?> paymentMethod = const Value.absent(),
- List<ShopInBitTicketMessage>? messages,
- DateTime? createdAt,
- int? apiTicketId,
- Value<String?> carResearchInvoiceId = const Value.absent(),
+ Value<String?> paymentInvoiceStatus = const Value.absent(),
+ Value<String?> trackingLink = const Value.absent(),
+ Value<DateTime?> lastAgentMessageAt = const Value.absent(),
Value<String?> feeTicketNumber = const Value.absent(),
- bool? needsCreateRequest,
- bool? isPendingPayment,
- Value<DateTime?> carResearchExpiresAt = const Value.absent(),
- Value<String?> carResearchPaymentLinks = const Value.absent(),
+ List<TicketMessage>? messages,
+ DateTime? createdAt,
+ DateTime? updatedAt,
}) => ShopInBitTicket(
- ticketId: ticketId ?? this.ticketId,
- displayName: displayName ?? this.displayName,
+ apiTicketId: apiTicketId ?? this.apiTicketId,
+ customerKey: customerKey ?? this.customerKey,
+ ticketNumber: ticketNumber ?? this.ticketNumber,
category: category ?? this.category,
- status: status ?? this.status,
- statusRaw: statusRaw.present ? statusRaw.value : this.statusRaw,
requestDescription: requestDescription ?? this.requestDescription,
deliveryCountry: deliveryCountry ?? this.deliveryCountry,
+ status: status ?? this.status,
+ statusRaw: statusRaw ?? this.statusRaw,
offerProductName: offerProductName.present
? offerProductName.value
: this.offerProductName,
offerPrice: offerPrice.present ? offerPrice.value : this.offerPrice,
- shippingName: shippingName ?? this.shippingName,
- shippingStreet: shippingStreet ?? this.shippingStreet,
- shippingCity: shippingCity ?? this.shippingCity,
- shippingPostalCode: shippingPostalCode ?? this.shippingPostalCode,
- shippingCountry: shippingCountry ?? this.shippingCountry,
- paymentMethod: paymentMethod.present
- ? paymentMethod.value
- : this.paymentMethod,
- messages: messages ?? this.messages,
- createdAt: createdAt ?? this.createdAt,
- apiTicketId: apiTicketId ?? this.apiTicketId,
- carResearchInvoiceId: carResearchInvoiceId.present
- ? carResearchInvoiceId.value
- : this.carResearchInvoiceId,
+ paymentInvoiceStatus: paymentInvoiceStatus.present
+ ? paymentInvoiceStatus.value
+ : this.paymentInvoiceStatus,
+ trackingLink: trackingLink.present ? trackingLink.value : this.trackingLink,
+ lastAgentMessageAt: lastAgentMessageAt.present
+ ? lastAgentMessageAt.value
+ : this.lastAgentMessageAt,
feeTicketNumber: feeTicketNumber.present
? feeTicketNumber.value
: this.feeTicketNumber,
- needsCreateRequest: needsCreateRequest ?? this.needsCreateRequest,
- isPendingPayment: isPendingPayment ?? this.isPendingPayment,
- carResearchExpiresAt: carResearchExpiresAt.present
- ? carResearchExpiresAt.value
- : this.carResearchExpiresAt,
- carResearchPaymentLinks: carResearchPaymentLinks.present
- ? carResearchPaymentLinks.value
- : this.carResearchPaymentLinks,
+ messages: messages ?? this.messages,
+ createdAt: createdAt ?? this.createdAt,
+ updatedAt: updatedAt ?? this.updatedAt,
);
ShopInBitTicket copyWithCompanion(ShopInBitTicketsCompanion data) {
return ShopInBitTicket(
- ticketId: data.ticketId.present ? data.ticketId.value : this.ticketId,
- displayName: data.displayName.present
- ? data.displayName.value
- : this.displayName,
+ apiTicketId: data.apiTicketId.present
+ ? data.apiTicketId.value
+ : this.apiTicketId,
+ customerKey: data.customerKey.present
+ ? data.customerKey.value
+ : this.customerKey,
+ ticketNumber: data.ticketNumber.present
+ ? data.ticketNumber.value
+ : this.ticketNumber,
category: data.category.present ? data.category.value : this.category,
- status: data.status.present ? data.status.value : this.status,
- statusRaw: data.statusRaw.present ? data.statusRaw.value : this.statusRaw,
requestDescription: data.requestDescription.present
? data.requestDescription.value
: this.requestDescription,
deliveryCountry: data.deliveryCountry.present
? data.deliveryCountry.value
: this.deliveryCountry,
+ status: data.status.present ? data.status.value : this.status,
+ statusRaw: data.statusRaw.present ? data.statusRaw.value : this.statusRaw,
offerProductName: data.offerProductName.present
? data.offerProductName.value
: this.offerProductName,
offerPrice: data.offerPrice.present
? data.offerPrice.value
: this.offerPrice,
- shippingName: data.shippingName.present
- ? data.shippingName.value
- : this.shippingName,
- shippingStreet: data.shippingStreet.present
- ? data.shippingStreet.value
- : this.shippingStreet,
- shippingCity: data.shippingCity.present
- ? data.shippingCity.value
- : this.shippingCity,
- shippingPostalCode: data.shippingPostalCode.present
- ? data.shippingPostalCode.value
- : this.shippingPostalCode,
- shippingCountry: data.shippingCountry.present
- ? data.shippingCountry.value
- : this.shippingCountry,
- paymentMethod: data.paymentMethod.present
- ? data.paymentMethod.value
- : this.paymentMethod,
- messages: data.messages.present ? data.messages.value : this.messages,
- createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
- apiTicketId: data.apiTicketId.present
- ? data.apiTicketId.value
- : this.apiTicketId,
- carResearchInvoiceId: data.carResearchInvoiceId.present
- ? data.carResearchInvoiceId.value
- : this.carResearchInvoiceId,
+ paymentInvoiceStatus: data.paymentInvoiceStatus.present
+ ? data.paymentInvoiceStatus.value
+ : this.paymentInvoiceStatus,
+ trackingLink: data.trackingLink.present
+ ? data.trackingLink.value
+ : this.trackingLink,
+ lastAgentMessageAt: data.lastAgentMessageAt.present
+ ? data.lastAgentMessageAt.value
+ : this.lastAgentMessageAt,
feeTicketNumber: data.feeTicketNumber.present
? data.feeTicketNumber.value
: this.feeTicketNumber,
- needsCreateRequest: data.needsCreateRequest.present
- ? data.needsCreateRequest.value
- : this.needsCreateRequest,
- isPendingPayment: data.isPendingPayment.present
- ? data.isPendingPayment.value
- : this.isPendingPayment,
- carResearchExpiresAt: data.carResearchExpiresAt.present
- ? data.carResearchExpiresAt.value
- : this.carResearchExpiresAt,
- carResearchPaymentLinks: data.carResearchPaymentLinks.present
- ? data.carResearchPaymentLinks.value
- : this.carResearchPaymentLinks,
+ messages: data.messages.present ? data.messages.value : this.messages,
+ createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
+ updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('ShopInBitTicket(')
- ..write('ticketId: $ticketId, ')
- ..write('displayName: $displayName, ')
+ ..write('apiTicketId: $apiTicketId, ')
+ ..write('customerKey: $customerKey, ')
+ ..write('ticketNumber: $ticketNumber, ')
..write('category: $category, ')
- ..write('status: $status, ')
- ..write('statusRaw: $statusRaw, ')
..write('requestDescription: $requestDescription, ')
..write('deliveryCountry: $deliveryCountry, ')
+ ..write('status: $status, ')
+ ..write('statusRaw: $statusRaw, ')
..write('offerProductName: $offerProductName, ')
..write('offerPrice: $offerPrice, ')
- ..write('shippingName: $shippingName, ')
- ..write('shippingStreet: $shippingStreet, ')
- ..write('shippingCity: $shippingCity, ')
- ..write('shippingPostalCode: $shippingPostalCode, ')
- ..write('shippingCountry: $shippingCountry, ')
- ..write('paymentMethod: $paymentMethod, ')
+ ..write('paymentInvoiceStatus: $paymentInvoiceStatus, ')
+ ..write('trackingLink: $trackingLink, ')
+ ..write('lastAgentMessageAt: $lastAgentMessageAt, ')
+ ..write('feeTicketNumber: $feeTicketNumber, ')
..write('messages: $messages, ')
..write('createdAt: $createdAt, ')
- ..write('apiTicketId: $apiTicketId, ')
- ..write('carResearchInvoiceId: $carResearchInvoiceId, ')
- ..write('feeTicketNumber: $feeTicketNumber, ')
- ..write('needsCreateRequest: $needsCreateRequest, ')
- ..write('isPendingPayment: $isPendingPayment, ')
- ..write('carResearchExpiresAt: $carResearchExpiresAt, ')
- ..write('carResearchPaymentLinks: $carResearchPaymentLinks')
+ ..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
- int get hashCode => Object.hashAll([
- ticketId,
- displayName,
+ int get hashCode => Object.hash(
+ apiTicketId,
+ customerKey,
+ ticketNumber,
category,
- status,
- statusRaw,
requestDescription,
deliveryCountry,
+ status,
+ statusRaw,
offerProductName,
offerPrice,
- shippingName,
- shippingStreet,
- shippingCity,
- shippingPostalCode,
- shippingCountry,
- paymentMethod,
+ paymentInvoiceStatus,
+ trackingLink,
+ lastAgentMessageAt,
+ feeTicketNumber,
messages,
createdAt,
- apiTicketId,
- carResearchInvoiceId,
- feeTicketNumber,
- needsCreateRequest,
- isPendingPayment,
- carResearchExpiresAt,
- carResearchPaymentLinks,
- ]);
+ updatedAt,
+ );
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ShopInBitTicket &&
- other.ticketId == this.ticketId &&
- other.displayName == this.displayName &&
+ other.apiTicketId == this.apiTicketId &&
+ other.customerKey == this.customerKey &&
+ other.ticketNumber == this.ticketNumber &&
other.category == this.category &&
- other.status == this.status &&
- other.statusRaw == this.statusRaw &&
other.requestDescription == this.requestDescription &&
other.deliveryCountry == this.deliveryCountry &&
+ other.status == this.status &&
+ other.statusRaw == this.statusRaw &&
other.offerProductName == this.offerProductName &&
other.offerPrice == this.offerPrice &&
- other.shippingName == this.shippingName &&
- other.shippingStreet == this.shippingStreet &&
- other.shippingCity == this.shippingCity &&
- other.shippingPostalCode == this.shippingPostalCode &&
- other.shippingCountry == this.shippingCountry &&
- other.paymentMethod == this.paymentMethod &&
+ other.paymentInvoiceStatus == this.paymentInvoiceStatus &&
+ other.trackingLink == this.trackingLink &&
+ other.lastAgentMessageAt == this.lastAgentMessageAt &&
+ other.feeTicketNumber == this.feeTicketNumber &&
other.messages == this.messages &&
other.createdAt == this.createdAt &&
- other.apiTicketId == this.apiTicketId &&
- other.carResearchInvoiceId == this.carResearchInvoiceId &&
- other.feeTicketNumber == this.feeTicketNumber &&
- other.needsCreateRequest == this.needsCreateRequest &&
- other.isPendingPayment == this.isPendingPayment &&
- other.carResearchExpiresAt == this.carResearchExpiresAt &&
- other.carResearchPaymentLinks == this.carResearchPaymentLinks);
+ other.updatedAt == this.updatedAt);
}
class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
- final Value<String> ticketId;
- final Value<String> displayName;
+ final Value<int> apiTicketId;
+ final Value<String> customerKey;
+ final Value<String> ticketNumber;
final Value<ShopInBitCategory> category;
- final Value<ShopInBitOrderStatus> status;
- final Value<String?> statusRaw;
final Value<String> requestDescription;
final Value<String> deliveryCountry;
+ final Value<ShopInBitOrderStatus> status;
+ final Value<String> statusRaw;
final Value<String?> offerProductName;
final Value<String?> offerPrice;
- final Value<String> shippingName;
- final Value<String> shippingStreet;
- final Value<String> shippingCity;
- final Value<String> shippingPostalCode;
- final Value<String> shippingCountry;
- final Value<String?> paymentMethod;
- final Value<List<ShopInBitTicketMessage>> messages;
- final Value<DateTime> createdAt;
- final Value<int> apiTicketId;
- final Value<String?> carResearchInvoiceId;
+ final Value<String?> paymentInvoiceStatus;
+ final Value<String?> trackingLink;
+ final Value<DateTime?> lastAgentMessageAt;
final Value<String?> feeTicketNumber;
- final Value<bool> needsCreateRequest;
- final Value<bool> isPendingPayment;
- final Value<DateTime?> carResearchExpiresAt;
- final Value<String?> carResearchPaymentLinks;
- final Value<int> rowid;
+ final Value<List<TicketMessage>> messages;
+ final Value<DateTime> createdAt;
+ final Value<DateTime> updatedAt;
const ShopInBitTicketsCompanion({
- this.ticketId = const Value.absent(),
- this.displayName = const Value.absent(),
+ this.apiTicketId = const Value.absent(),
+ this.customerKey = const Value.absent(),
+ this.ticketNumber = const Value.absent(),
this.category = const Value.absent(),
- this.status = const Value.absent(),
- this.statusRaw = const Value.absent(),
this.requestDescription = const Value.absent(),
this.deliveryCountry = const Value.absent(),
+ this.status = const Value.absent(),
+ this.statusRaw = const Value.absent(),
this.offerProductName = const Value.absent(),
this.offerPrice = const Value.absent(),
- this.shippingName = const Value.absent(),
- this.shippingStreet = const Value.absent(),
- this.shippingCity = const Value.absent(),
- this.shippingPostalCode = const Value.absent(),
- this.shippingCountry = const Value.absent(),
- this.paymentMethod = const Value.absent(),
+ this.paymentInvoiceStatus = const Value.absent(),
+ this.trackingLink = const Value.absent(),
+ this.lastAgentMessageAt = const Value.absent(),
+ this.feeTicketNumber = const Value.absent(),
this.messages = const Value.absent(),
this.createdAt = const Value.absent(),
- this.apiTicketId = const Value.absent(),
- this.carResearchInvoiceId = const Value.absent(),
- this.feeTicketNumber = const Value.absent(),
- this.needsCreateRequest = const Value.absent(),
- this.isPendingPayment = const Value.absent(),
- this.carResearchExpiresAt = const Value.absent(),
- this.carResearchPaymentLinks = const Value.absent(),
- this.rowid = const Value.absent(),
+ this.updatedAt = const Value.absent(),
});
ShopInBitTicketsCompanion.insert({
- required String ticketId,
- required String displayName,
+ required int apiTicketId,
+ required String customerKey,
+ required String ticketNumber,
required ShopInBitCategory category,
- required ShopInBitOrderStatus status,
- this.statusRaw = const Value.absent(),
required String requestDescription,
required String deliveryCountry,
+ required ShopInBitOrderStatus status,
+ required String statusRaw,
this.offerProductName = const Value.absent(),
this.offerPrice = const Value.absent(),
- required String shippingName,
- required String shippingStreet,
- required String shippingCity,
- required String shippingPostalCode,
- required String shippingCountry,
- this.paymentMethod = const Value.absent(),
- required List<ShopInBitTicketMessage> messages,
- required DateTime createdAt,
- required int apiTicketId,
- this.carResearchInvoiceId = const Value.absent(),
+ this.paymentInvoiceStatus = const Value.absent(),
+ this.trackingLink = const Value.absent(),
+ this.lastAgentMessageAt = const Value.absent(),
this.feeTicketNumber = const Value.absent(),
- required bool needsCreateRequest,
- required bool isPendingPayment,
- this.carResearchExpiresAt = const Value.absent(),
- this.carResearchPaymentLinks = const Value.absent(),
- this.rowid = const Value.absent(),
- }) : ticketId = Value(ticketId),
- displayName = Value(displayName),
+ this.messages = const Value.absent(),
+ this.createdAt = const Value.absent(),
+ this.updatedAt = const Value.absent(),
+ }) : apiTicketId = Value(apiTicketId),
+ customerKey = Value(customerKey),
+ ticketNumber = Value(ticketNumber),
category = Value(category),
- status = Value(status),
requestDescription = Value(requestDescription),
deliveryCountry = Value(deliveryCountry),
- shippingName = Value(shippingName),
- shippingStreet = Value(shippingStreet),
- shippingCity = Value(shippingCity),
- shippingPostalCode = Value(shippingPostalCode),
- shippingCountry = Value(shippingCountry),
- messages = Value(messages),
- createdAt = Value(createdAt),
- apiTicketId = Value(apiTicketId),
- needsCreateRequest = Value(needsCreateRequest),
- isPendingPayment = Value(isPendingPayment);
+ status = Value(status),
+ statusRaw = Value(statusRaw);
static Insertable<ShopInBitTicket> custom({
- Expression<String>? ticketId,
- Expression<String>? displayName,
- Expression<int>? category,
- Expression<int>? status,
- Expression<String>? statusRaw,
+ Expression<int>? apiTicketId,
+ Expression<String>? customerKey,
+ Expression<String>? ticketNumber,
+ Expression<String>? category,
Expression<String>? requestDescription,
Expression<String>? deliveryCountry,
+ Expression<String>? status,
+ Expression<String>? statusRaw,
Expression<String>? offerProductName,
Expression<String>? offerPrice,
- Expression<String>? shippingName,
- Expression<String>? shippingStreet,
- Expression<String>? shippingCity,
- Expression<String>? shippingPostalCode,
- Expression<String>? shippingCountry,
- Expression<String>? paymentMethod,
+ Expression<String>? paymentInvoiceStatus,
+ Expression<String>? trackingLink,
+ Expression<DateTime>? lastAgentMessageAt,
+ Expression<String>? feeTicketNumber,
Expression<String>? messages,
Expression<DateTime>? createdAt,
- Expression<int>? apiTicketId,
- Expression<String>? carResearchInvoiceId,
- Expression<String>? feeTicketNumber,
- Expression<bool>? needsCreateRequest,
- Expression<bool>? isPendingPayment,
- Expression<DateTime>? carResearchExpiresAt,
- Expression<String>? carResearchPaymentLinks,
- Expression<int>? rowid,
+ Expression<DateTime>? updatedAt,
}) {
return RawValuesInsertable({
- if (ticketId != null) 'ticket_id': ticketId,
- if (displayName != null) 'display_name': displayName,
+ if (apiTicketId != null) 'api_ticket_id': apiTicketId,
+ if (customerKey != null) 'customer_key': customerKey,
+ if (ticketNumber != null) 'ticket_number': ticketNumber,
if (category != null) 'category': category,
- if (status != null) 'status': status,
- if (statusRaw != null) 'status_raw': statusRaw,
if (requestDescription != null) 'request_description': requestDescription,
if (deliveryCountry != null) 'delivery_country': deliveryCountry,
+ if (status != null) 'status': status,
+ if (statusRaw != null) 'status_raw': statusRaw,
if (offerProductName != null) 'offer_product_name': offerProductName,
if (offerPrice != null) 'offer_price': offerPrice,
- if (shippingName != null) 'shipping_name': shippingName,
- if (shippingStreet != null) 'shipping_street': shippingStreet,
- if (shippingCity != null) 'shipping_city': shippingCity,
- if (shippingPostalCode != null)
- 'shipping_postal_code': shippingPostalCode,
- if (shippingCountry != null) 'shipping_country': shippingCountry,
- if (paymentMethod != null) 'payment_method': paymentMethod,
+ if (paymentInvoiceStatus != null)
+ 'payment_invoice_status': paymentInvoiceStatus,
+ if (trackingLink != null) 'tracking_link': trackingLink,
+ if (lastAgentMessageAt != null)
+ 'last_agent_message_at': lastAgentMessageAt,
+ if (feeTicketNumber != null) 'fee_ticket_number': feeTicketNumber,
if (messages != null) 'messages': messages,
if (createdAt != null) 'created_at': createdAt,
- if (apiTicketId != null) 'api_ticket_id': apiTicketId,
- if (carResearchInvoiceId != null)
- 'car_research_invoice_id': carResearchInvoiceId,
- if (feeTicketNumber != null) 'fee_ticket_number': feeTicketNumber,
- if (needsCreateRequest != null)
- 'needs_create_request': needsCreateRequest,
- if (isPendingPayment != null) 'is_pending_payment': isPendingPayment,
- if (carResearchExpiresAt != null)
- 'car_research_expires_at': carResearchExpiresAt,
- if (carResearchPaymentLinks != null)
- 'car_research_payment_links': carResearchPaymentLinks,
- if (rowid != null) 'rowid': rowid,
+ if (updatedAt != null) 'updated_at': updatedAt,
});
}
ShopInBitTicketsCompanion copyWith({
- Value<String>? ticketId,
- Value<String>? displayName,
+ Value<int>? apiTicketId,
+ Value<String>? customerKey,
+ Value<String>? ticketNumber,
Value<ShopInBitCategory>? category,
- Value<ShopInBitOrderStatus>? status,
- Value<String?>? statusRaw,
Value<String>? requestDescription,
Value<String>? deliveryCountry,
+ Value<ShopInBitOrderStatus>? status,
+ Value<String>? statusRaw,
Value<String?>? offerProductName,
Value<String?>? offerPrice,
- Value<String>? shippingName,
- Value<String>? shippingStreet,
- Value<String>? shippingCity,
- Value<String>? shippingPostalCode,
- Value<String>? shippingCountry,
- Value<String?>? paymentMethod,
- Value<List<ShopInBitTicketMessage>>? messages,
- Value<DateTime>? createdAt,
- Value<int>? apiTicketId,
- Value<String?>? carResearchInvoiceId,
+ Value<String?>? paymentInvoiceStatus,
+ Value<String?>? trackingLink,
+ Value<DateTime?>? lastAgentMessageAt,
Value<String?>? feeTicketNumber,
- Value<bool>? needsCreateRequest,
- Value<bool>? isPendingPayment,
- Value<DateTime?>? carResearchExpiresAt,
- Value<String?>? carResearchPaymentLinks,
- Value<int>? rowid,
+ Value<List<TicketMessage>>? messages,
+ Value<DateTime>? createdAt,
+ Value<DateTime>? updatedAt,
}) {
return ShopInBitTicketsCompanion(
- ticketId: ticketId ?? this.ticketId,
- displayName: displayName ?? this.displayName,
+ apiTicketId: apiTicketId ?? this.apiTicketId,
+ customerKey: customerKey ?? this.customerKey,
+ ticketNumber: ticketNumber ?? this.ticketNumber,
category: category ?? this.category,
- status: status ?? this.status,
- statusRaw: statusRaw ?? this.statusRaw,
requestDescription: requestDescription ?? this.requestDescription,
deliveryCountry: deliveryCountry ?? this.deliveryCountry,
+ status: status ?? this.status,
+ statusRaw: statusRaw ?? this.statusRaw,
offerProductName: offerProductName ?? this.offerProductName,
offerPrice: offerPrice ?? this.offerPrice,
- shippingName: shippingName ?? this.shippingName,
- shippingStreet: shippingStreet ?? this.shippingStreet,
- shippingCity: shippingCity ?? this.shippingCity,
- shippingPostalCode: shippingPostalCode ?? this.shippingPostalCode,
- shippingCountry: shippingCountry ?? this.shippingCountry,
- paymentMethod: paymentMethod ?? this.paymentMethod,
+ paymentInvoiceStatus: paymentInvoiceStatus ?? this.paymentInvoiceStatus,
+ trackingLink: trackingLink ?? this.trackingLink,
+ lastAgentMessageAt: lastAgentMessageAt ?? this.lastAgentMessageAt,
+ feeTicketNumber: feeTicketNumber ?? this.feeTicketNumber,
messages: messages ?? this.messages,
createdAt: createdAt ?? this.createdAt,
- apiTicketId: apiTicketId ?? this.apiTicketId,
- carResearchInvoiceId: carResearchInvoiceId ?? this.carResearchInvoiceId,
- feeTicketNumber: feeTicketNumber ?? this.feeTicketNumber,
- needsCreateRequest: needsCreateRequest ?? this.needsCreateRequest,
- isPendingPayment: isPendingPayment ?? this.isPendingPayment,
- carResearchExpiresAt: carResearchExpiresAt ?? this.carResearchExpiresAt,
- carResearchPaymentLinks:
- carResearchPaymentLinks ?? this.carResearchPaymentLinks,
- rowid: rowid ?? this.rowid,
+ updatedAt: updatedAt ?? this.updatedAt,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
- if (ticketId.present) {
- map['ticket_id'] = Variable<String>(ticketId.value);
+ if (apiTicketId.present) {
+ map['api_ticket_id'] = Variable<int>(apiTicketId.value);
+ }
+ if (customerKey.present) {
+ map['customer_key'] = Variable<String>(customerKey.value);
}
- if (displayName.present) {
- map['display_name'] = Variable<String>(displayName.value);
+ if (ticketNumber.present) {
+ map['ticket_number'] = Variable<String>(ticketNumber.value);
}
if (category.present) {
- map['category'] = Variable<int>(
+ map['category'] = Variable<String>(
$ShopInBitTicketsTable.$convertercategory.toSql(category.value),
);
}
+ if (requestDescription.present) {
+ map['request_description'] = Variable<String>(requestDescription.value);
+ }
+ if (deliveryCountry.present) {
+ map['delivery_country'] = Variable<String>(deliveryCountry.value);
+ }
if (status.present) {
- map['status'] = Variable<int>(
+ map['status'] = Variable<String>(
$ShopInBitTicketsTable.$converterstatus.toSql(status.value),
);
}
if (statusRaw.present) {
map['status_raw'] = Variable<String>(statusRaw.value);
}
- if (requestDescription.present) {
- map['request_description'] = Variable<String>(requestDescription.value);
- }
- if (deliveryCountry.present) {
- map['delivery_country'] = Variable<String>(deliveryCountry.value);
- }
if (offerProductName.present) {
map['offer_product_name'] = Variable<String>(offerProductName.value);
}
if (offerPrice.present) {
map['offer_price'] = Variable<String>(offerPrice.value);
}
- if (shippingName.present) {
- map['shipping_name'] = Variable<String>(shippingName.value);
- }
- if (shippingStreet.present) {
- map['shipping_street'] = Variable<String>(shippingStreet.value);
- }
- if (shippingCity.present) {
- map['shipping_city'] = Variable<String>(shippingCity.value);
+ if (paymentInvoiceStatus.present) {
+ map['payment_invoice_status'] = Variable<String>(
+ paymentInvoiceStatus.value,
+ );
}
- if (shippingPostalCode.present) {
- map['shipping_postal_code'] = Variable<String>(shippingPostalCode.value);
+ if (trackingLink.present) {
+ map['tracking_link'] = Variable<String>(trackingLink.value);
}
- if (shippingCountry.present) {
- map['shipping_country'] = Variable<String>(shippingCountry.value);
+ if (lastAgentMessageAt.present) {
+ map['last_agent_message_at'] = Variable<DateTime>(
+ lastAgentMessageAt.value,
+ );
}
- if (paymentMethod.present) {
- map['payment_method'] = Variable<String>(paymentMethod.value);
+ if (feeTicketNumber.present) {
+ map['fee_ticket_number'] = Variable<String>(feeTicketNumber.value);
}
if (messages.present) {
map['messages'] = Variable<String>(
@@ -1872,35 +1742,8 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
if (createdAt.present) {
map['created_at'] = Variable<DateTime>(createdAt.value);
}
- if (apiTicketId.present) {
- map['api_ticket_id'] = Variable<int>(apiTicketId.value);
- }
- if (carResearchInvoiceId.present) {
- map['car_research_invoice_id'] = Variable<String>(
- carResearchInvoiceId.value,
- );
- }
- if (feeTicketNumber.present) {
- map['fee_ticket_number'] = Variable<String>(feeTicketNumber.value);
- }
- if (needsCreateRequest.present) {
- map['needs_create_request'] = Variable<bool>(needsCreateRequest.value);
- }
- if (isPendingPayment.present) {
- map['is_pending_payment'] = Variable<bool>(isPendingPayment.value);
- }
- if (carResearchExpiresAt.present) {
- map['car_research_expires_at'] = Variable<DateTime>(
- carResearchExpiresAt.value,
- );
- }
- if (carResearchPaymentLinks.present) {
- map['car_research_payment_links'] = Variable<String>(
- carResearchPaymentLinks.value,
- );
- }
- if (rowid.present) {
- map['rowid'] = Variable<int>(rowid.value);
+ if (updatedAt.present) {
+ map['updated_at'] = Variable<DateTime>(updatedAt.value);
}
return map;
}
@@ -1908,31 +1751,23 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
@override
String toString() {
return (StringBuffer('ShopInBitTicketsCompanion(')
- ..write('ticketId: $ticketId, ')
- ..write('displayName: $displayName, ')
- ..write('category: $category, ')
- ..write('status: $status, ')
- ..write('statusRaw: $statusRaw, ')
+ ..write('apiTicketId: $apiTicketId, ')
+ ..write('customerKey: $customerKey, ')
+ ..write('ticketNumber: $ticketNumber, ')
+ ..write('category: $category, ')
..write('requestDescription: $requestDescription, ')
..write('deliveryCountry: $deliveryCountry, ')
+ ..write('status: $status, ')
+ ..write('statusRaw: $statusRaw, ')
..write('offerProductName: $offerProductName, ')
..write('offerPrice: $offerPrice, ')
- ..write('shippingName: $shippingName, ')
- ..write('shippingStreet: $shippingStreet, ')
- ..write('shippingCity: $shippingCity, ')
- ..write('shippingPostalCode: $shippingPostalCode, ')
- ..write('shippingCountry: $shippingCountry, ')
- ..write('paymentMethod: $paymentMethod, ')
+ ..write('paymentInvoiceStatus: $paymentInvoiceStatus, ')
+ ..write('trackingLink: $trackingLink, ')
+ ..write('lastAgentMessageAt: $lastAgentMessageAt, ')
+ ..write('feeTicketNumber: $feeTicketNumber, ')
..write('messages: $messages, ')
..write('createdAt: $createdAt, ')
- ..write('apiTicketId: $apiTicketId, ')
- ..write('carResearchInvoiceId: $carResearchInvoiceId, ')
- ..write('feeTicketNumber: $feeTicketNumber, ')
- ..write('needsCreateRequest: $needsCreateRequest, ')
- ..write('isPendingPayment: $isPendingPayment, ')
- ..write('carResearchExpiresAt: $carResearchExpiresAt, ')
- ..write('carResearchPaymentLinks: $carResearchPaymentLinks, ')
- ..write('rowid: $rowid')
+ ..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@@ -1942,12 +1777,15 @@ abstract class _$SharedDatabase extends GeneratedDatabase {
_$SharedDatabase(QueryExecutor e) : super(e);
$SharedDatabaseManager get managers => $SharedDatabaseManager(this);
late final $CakepayOrdersTable cakepayOrders = $CakepayOrdersTable(this);
- late final $ShopinBitSettingsTable shopinBitSettings =
- $ShopinBitSettingsTable(this);
+ late final $ShopInBitSettingsTable shopInBitSettings =
+ $ShopInBitSettingsTable(this);
late final $ShopInBitTicketsTable shopInBitTickets = $ShopInBitTicketsTable(
this,
);
- late final ShopinBitSettingsDao shopinBitSettingsDao = ShopinBitSettingsDao(
+ late final ShopInBitSettingsDao shopInBitSettingsDao = ShopInBitSettingsDao(
+ this as SharedDatabase,
+ );
+ late final ShopInBitTicketsDao shopInBitTicketsDao = ShopInBitTicketsDao(
this as SharedDatabase,
);
@override
@@ -1956,7 +1794,7 @@ abstract class _$SharedDatabase extends GeneratedDatabase {
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [
cakepayOrders,
- shopinBitSettings,
+ shopInBitSettings,
shopInBitTickets,
];
}
@@ -2079,37 +1917,60 @@ typedef $$CakepayOrdersTableProcessedTableManager =
CakepayOrder,
PrefetchHooks Function()
>;
-typedef $$ShopinBitSettingsTableCreateCompanionBuilder =
- ShopinBitSettingsCompanion Function({
- Value<int> id,
- Value<bool> guidelinesAccepted,
+typedef $$ShopInBitSettingsTableCreateCompanionBuilder =
+ ShopInBitSettingsCompanion Function({
+ required String customerKey,
+ Value<bool> privacyAccepted,
+ Value<bool> conciergeGuidelinesAccepted,
+ Value<bool> travelGuidelinesAccepted,
+ Value<bool> carGuidelinesAccepted,
Value<bool> setupComplete,
- Value<String?> displayName,
+ Value<DateTime> createdAt,
+ Value<DateTime> lastUsedAt,
});
-typedef $$ShopinBitSettingsTableUpdateCompanionBuilder =
- ShopinBitSettingsCompanion Function({
- Value<int> id,
- Value<bool> guidelinesAccepted,
+typedef $$ShopInBitSettingsTableUpdateCompanionBuilder =
+ ShopInBitSettingsCompanion Function({
+ Value<String> customerKey,
+ Value<bool> privacyAccepted,
+ Value<bool> conciergeGuidelinesAccepted,
+ Value<bool> travelGuidelinesAccepted,
+ Value<bool> carGuidelinesAccepted,
Value<bool> setupComplete,
- Value<String?> displayName,
+ Value<DateTime> createdAt,
+ Value<DateTime> lastUsedAt,
});
-class $$ShopinBitSettingsTableFilterComposer
- extends Composer<_$SharedDatabase, $ShopinBitSettingsTable> {
- $$ShopinBitSettingsTableFilterComposer({
+class $$ShopInBitSettingsTableFilterComposer
+ extends Composer<_$SharedDatabase, $ShopInBitSettingsTable> {
+ $$ShopInBitSettingsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- ColumnFilters<int> get id => $composableBuilder(
- column: $table.id,
+ ColumnFilters<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters<bool> get privacyAccepted => $composableBuilder(
+ column: $table.privacyAccepted,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters<bool> get conciergeGuidelinesAccepted => $composableBuilder(
+ column: $table.conciergeGuidelinesAccepted,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters<bool> get travelGuidelinesAccepted => $composableBuilder(
+ column: $table.travelGuidelinesAccepted,
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<bool> get guidelinesAccepted => $composableBuilder(
- column: $table.guidelinesAccepted,
+ ColumnFilters<bool> get carGuidelinesAccepted => $composableBuilder(
+ column: $table.carGuidelinesAccepted,
builder: (column) => ColumnFilters(column),
);
@@ -2118,28 +1979,48 @@ class $$ShopinBitSettingsTableFilterComposer
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ ColumnFilters<DateTime> get createdAt => $composableBuilder(
+ column: $table.createdAt,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters<DateTime> get lastUsedAt => $composableBuilder(
+ column: $table.lastUsedAt,
builder: (column) => ColumnFilters(column),
);
}
-class $$ShopinBitSettingsTableOrderingComposer
- extends Composer<_$SharedDatabase, $ShopinBitSettingsTable> {
- $$ShopinBitSettingsTableOrderingComposer({
+class $$ShopInBitSettingsTableOrderingComposer
+ extends Composer<_$SharedDatabase, $ShopInBitSettingsTable> {
+ $$ShopInBitSettingsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- ColumnOrderings<int> get id => $composableBuilder(
- column: $table.id,
+ ColumnOrderings<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings<bool> get privacyAccepted => $composableBuilder(
+ column: $table.privacyAccepted,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings<bool> get conciergeGuidelinesAccepted => $composableBuilder(
+ column: $table.conciergeGuidelinesAccepted,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings<bool> get travelGuidelinesAccepted => $composableBuilder(
+ column: $table.travelGuidelinesAccepted,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<bool> get guidelinesAccepted => $composableBuilder(
- column: $table.guidelinesAccepted,
+ ColumnOrderings<bool> get carGuidelinesAccepted => $composableBuilder(
+ column: $table.carGuidelinesAccepted,
builder: (column) => ColumnOrderings(column),
);
@@ -2148,26 +2029,48 @@ class $$ShopinBitSettingsTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ ColumnOrderings<DateTime> get createdAt => $composableBuilder(
+ column: $table.createdAt,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings<DateTime> get lastUsedAt => $composableBuilder(
+ column: $table.lastUsedAt,
builder: (column) => ColumnOrderings(column),
);
}
-class $$ShopinBitSettingsTableAnnotationComposer
- extends Composer<_$SharedDatabase, $ShopinBitSettingsTable> {
- $$ShopinBitSettingsTableAnnotationComposer({
+class $$ShopInBitSettingsTableAnnotationComposer
+ extends Composer<_$SharedDatabase, $ShopInBitSettingsTable> {
+ $$ShopInBitSettingsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- GeneratedColumn<int> get id =>
- $composableBuilder(column: $table.id, builder: (column) => column);
+ GeneratedColumn<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
+ builder: (column) => column,
+ );
+
+ GeneratedColumn<bool> get privacyAccepted => $composableBuilder(
+ column: $table.privacyAccepted,
+ builder: (column) => column,
+ );
+
+ GeneratedColumn<bool> get conciergeGuidelinesAccepted => $composableBuilder(
+ column: $table.conciergeGuidelinesAccepted,
+ builder: (column) => column,
+ );
+
+ GeneratedColumn<bool> get travelGuidelinesAccepted => $composableBuilder(
+ column: $table.travelGuidelinesAccepted,
+ builder: (column) => column,
+ );
- GeneratedColumn<bool> get guidelinesAccepted => $composableBuilder(
- column: $table.guidelinesAccepted,
+ GeneratedColumn<bool> get carGuidelinesAccepted => $composableBuilder(
+ column: $table.carGuidelinesAccepted,
builder: (column) => column,
);
@@ -2176,73 +2079,92 @@ class $$ShopinBitSettingsTableAnnotationComposer
builder: (column) => column,
);
- GeneratedColumn<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ GeneratedColumn<DateTime> get createdAt =>
+ $composableBuilder(column: $table.createdAt, builder: (column) => column);
+
+ GeneratedColumn<DateTime> get lastUsedAt => $composableBuilder(
+ column: $table.lastUsedAt,
builder: (column) => column,
);
}
-class $$ShopinBitSettingsTableTableManager
+class $$ShopInBitSettingsTableTableManager
extends
RootTableManager<
_$SharedDatabase,
- $ShopinBitSettingsTable,
- ShopinBitSetting,
- $$ShopinBitSettingsTableFilterComposer,
- $$ShopinBitSettingsTableOrderingComposer,
- $$ShopinBitSettingsTableAnnotationComposer,
- $$ShopinBitSettingsTableCreateCompanionBuilder,
- $$ShopinBitSettingsTableUpdateCompanionBuilder,
+ $ShopInBitSettingsTable,
+ ShopInBitSetting,
+ $$ShopInBitSettingsTableFilterComposer,
+ $$ShopInBitSettingsTableOrderingComposer,
+ $$ShopInBitSettingsTableAnnotationComposer,
+ $$ShopInBitSettingsTableCreateCompanionBuilder,
+ $$ShopInBitSettingsTableUpdateCompanionBuilder,
(
- ShopinBitSetting,
+ ShopInBitSetting,
BaseReferences<
_$SharedDatabase,
- $ShopinBitSettingsTable,
- ShopinBitSetting
+ $ShopInBitSettingsTable,
+ ShopInBitSetting
>,
),
- ShopinBitSetting,
+ ShopInBitSetting,
PrefetchHooks Function()
> {
- $$ShopinBitSettingsTableTableManager(
+ $$ShopInBitSettingsTableTableManager(
_$SharedDatabase db,
- $ShopinBitSettingsTable table,
+ $ShopInBitSettingsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
- $$ShopinBitSettingsTableFilterComposer($db: db, $table: table),
+ $$ShopInBitSettingsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
- $$ShopinBitSettingsTableOrderingComposer($db: db, $table: table),
+ $$ShopInBitSettingsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
- $$ShopinBitSettingsTableAnnotationComposer(
+ $$ShopInBitSettingsTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
- Value<int> id = const Value.absent(),
- Value<bool> guidelinesAccepted = const Value.absent(),
+ Value<String> customerKey = const Value.absent(),
+ Value<bool> privacyAccepted = const Value.absent(),
+ Value<bool> conciergeGuidelinesAccepted = const Value.absent(),
+ Value<bool> travelGuidelinesAccepted = const Value.absent(),
+ Value<bool> carGuidelinesAccepted = const Value.absent(),
Value<bool> setupComplete = const Value.absent(),
- Value<String?> displayName = const Value.absent(),
- }) => ShopinBitSettingsCompanion(
- id: id,
- guidelinesAccepted: guidelinesAccepted,
+ Value<DateTime> createdAt = const Value.absent(),
+ Value<DateTime> lastUsedAt = const Value.absent(),
+ }) => ShopInBitSettingsCompanion(
+ customerKey: customerKey,
+ privacyAccepted: privacyAccepted,
+ conciergeGuidelinesAccepted: conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted: travelGuidelinesAccepted,
+ carGuidelinesAccepted: carGuidelinesAccepted,
setupComplete: setupComplete,
- displayName: displayName,
+ createdAt: createdAt,
+ lastUsedAt: lastUsedAt,
),
createCompanionCallback:
({
- Value<int> id = const Value.absent(),
- Value<bool> guidelinesAccepted = const Value.absent(),
+ required String customerKey,
+ Value<bool> privacyAccepted = const Value.absent(),
+ Value<bool> conciergeGuidelinesAccepted = const Value.absent(),
+ Value<bool> travelGuidelinesAccepted = const Value.absent(),
+ Value<bool> carGuidelinesAccepted = const Value.absent(),
Value<bool> setupComplete = const Value.absent(),
- Value<String?> displayName = const Value.absent(),
- }) => ShopinBitSettingsCompanion.insert(
- id: id,
- guidelinesAccepted: guidelinesAccepted,
+ Value<DateTime> createdAt = const Value.absent(),
+ Value<DateTime> lastUsedAt = const Value.absent(),
+ }) => ShopInBitSettingsCompanion.insert(
+ customerKey: customerKey,
+ privacyAccepted: privacyAccepted,
+ conciergeGuidelinesAccepted: conciergeGuidelinesAccepted,
+ travelGuidelinesAccepted: travelGuidelinesAccepted,
+ carGuidelinesAccepted: carGuidelinesAccepted,
setupComplete: setupComplete,
- displayName: displayName,
+ createdAt: createdAt,
+ lastUsedAt: lastUsedAt,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
@@ -2252,82 +2174,66 @@ class $$ShopinBitSettingsTableTableManager
);
}
-typedef $$ShopinBitSettingsTableProcessedTableManager =
+typedef $$ShopInBitSettingsTableProcessedTableManager =
ProcessedTableManager<
_$SharedDatabase,
- $ShopinBitSettingsTable,
- ShopinBitSetting,
- $$ShopinBitSettingsTableFilterComposer,
- $$ShopinBitSettingsTableOrderingComposer,
- $$ShopinBitSettingsTableAnnotationComposer,
- $$ShopinBitSettingsTableCreateCompanionBuilder,
- $$ShopinBitSettingsTableUpdateCompanionBuilder,
+ $ShopInBitSettingsTable,
+ ShopInBitSetting,
+ $$ShopInBitSettingsTableFilterComposer,
+ $$ShopInBitSettingsTableOrderingComposer,
+ $$ShopInBitSettingsTableAnnotationComposer,
+ $$ShopInBitSettingsTableCreateCompanionBuilder,
+ $$ShopInBitSettingsTableUpdateCompanionBuilder,
(
- ShopinBitSetting,
+ ShopInBitSetting,
BaseReferences<
_$SharedDatabase,
- $ShopinBitSettingsTable,
- ShopinBitSetting
+ $ShopInBitSettingsTable,
+ ShopInBitSetting
>,
),
- ShopinBitSetting,
+ ShopInBitSetting,
PrefetchHooks Function()
>;
typedef $$ShopInBitTicketsTableCreateCompanionBuilder =
ShopInBitTicketsCompanion Function({
- required String ticketId,
- required String displayName,
+ required int apiTicketId,
+ required String customerKey,
+ required String ticketNumber,
required ShopInBitCategory category,
- required ShopInBitOrderStatus status,
- Value<String?> statusRaw,
required String requestDescription,
required String deliveryCountry,
+ required ShopInBitOrderStatus status,
+ required String statusRaw,
Value<String?> offerProductName,
Value<String?> offerPrice,
- required String shippingName,
- required String shippingStreet,
- required String shippingCity,
- required String shippingPostalCode,
- required String shippingCountry,
- Value<String?> paymentMethod,
- required List<ShopInBitTicketMessage> messages,
- required DateTime createdAt,
- required int apiTicketId,
- Value<String?> carResearchInvoiceId,
+ Value<String?> paymentInvoiceStatus,
+ Value<String?> trackingLink,
+ Value<DateTime?> lastAgentMessageAt,
Value<String?> feeTicketNumber,
- required bool needsCreateRequest,
- required bool isPendingPayment,
- Value<DateTime?> carResearchExpiresAt,
- Value<String?> carResearchPaymentLinks,
- Value<int> rowid,
+ Value<List<TicketMessage>> messages,
+ Value<DateTime> createdAt,
+ Value<DateTime> updatedAt,
});
typedef $$ShopInBitTicketsTableUpdateCompanionBuilder =
ShopInBitTicketsCompanion Function({
- Value<String> ticketId,
- Value<String> displayName,
+ Value<int> apiTicketId,
+ Value<String> customerKey,
+ Value<String> ticketNumber,
Value<ShopInBitCategory> category,
- Value<ShopInBitOrderStatus> status,
- Value<String?> statusRaw,
Value<String> requestDescription,
Value<String> deliveryCountry,
+ Value<ShopInBitOrderStatus> status,
+ Value<String> statusRaw,
Value<String?> offerProductName,
Value<String?> offerPrice,
- Value<String> shippingName,
- Value<String> shippingStreet,
- Value<String> shippingCity,
- Value<String> shippingPostalCode,
- Value<String> shippingCountry,
- Value<String?> paymentMethod,
- Value<List<ShopInBitTicketMessage>> messages,
- Value<DateTime> createdAt,
- Value<int> apiTicketId,
- Value<String?> carResearchInvoiceId,
+ Value<String?> paymentInvoiceStatus,
+ Value<String?> trackingLink,
+ Value<DateTime?> lastAgentMessageAt,
Value<String?> feeTicketNumber,
- Value<bool> needsCreateRequest,
- Value<bool> isPendingPayment,
- Value<DateTime?> carResearchExpiresAt,
- Value<String?> carResearchPaymentLinks,
- Value<int> rowid,
+ Value<List<TicketMessage>> messages,
+ Value<DateTime> createdAt,
+ Value<DateTime> updatedAt,
});
class $$ShopInBitTicketsTableFilterComposer
@@ -2339,26 +2245,41 @@ class $$ShopInBitTicketsTableFilterComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- ColumnFilters<String> get ticketId => $composableBuilder(
- column: $table.ticketId,
+ ColumnFilters<int> get apiTicketId => $composableBuilder(
+ column: $table.apiTicketId,
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ ColumnFilters<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
builder: (column) => ColumnFilters(column),
);
- ColumnWithTypeConverterFilters<ShopInBitCategory, ShopInBitCategory, int>
+ ColumnFilters<String> get ticketNumber => $composableBuilder(
+ column: $table.ticketNumber,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnWithTypeConverterFilters<ShopInBitCategory, ShopInBitCategory, String>
get category => $composableBuilder(
column: $table.category,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
+ ColumnFilters<String> get requestDescription => $composableBuilder(
+ column: $table.requestDescription,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters<String> get deliveryCountry => $composableBuilder(
+ column: $table.deliveryCountry,
+ builder: (column) => ColumnFilters(column),
+ );
+
ColumnWithTypeConverterFilters<
ShopInBitOrderStatus,
ShopInBitOrderStatus,
- int
+ String
>
get status => $composableBuilder(
column: $table.status,
@@ -2370,16 +2291,6 @@ class $$ShopInBitTicketsTableFilterComposer
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get requestDescription => $composableBuilder(
- column: $table.requestDescription,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get deliveryCountry => $composableBuilder(
- column: $table.deliveryCountry,
- builder: (column) => ColumnFilters(column),
- );
-
ColumnFilters<String> get offerProductName => $composableBuilder(
column: $table.offerProductName,
builder: (column) => ColumnFilters(column),
@@ -2390,39 +2301,29 @@ class $$ShopInBitTicketsTableFilterComposer
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get shippingName => $composableBuilder(
- column: $table.shippingName,
+ ColumnFilters<String> get paymentInvoiceStatus => $composableBuilder(
+ column: $table.paymentInvoiceStatus,
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get shippingStreet => $composableBuilder(
- column: $table.shippingStreet,
+ ColumnFilters<String> get trackingLink => $composableBuilder(
+ column: $table.trackingLink,
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get shippingCity => $composableBuilder(
- column: $table.shippingCity,
+ ColumnFilters<DateTime> get lastAgentMessageAt => $composableBuilder(
+ column: $table.lastAgentMessageAt,
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<String> get shippingPostalCode => $composableBuilder(
- column: $table.shippingPostalCode,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get shippingCountry => $composableBuilder(
- column: $table.shippingCountry,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get paymentMethod => $composableBuilder(
- column: $table.paymentMethod,
+ ColumnFilters<String> get feeTicketNumber => $composableBuilder(
+ column: $table.feeTicketNumber,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<
- List<ShopInBitTicketMessage>,
- List<ShopInBitTicketMessage>,
+ List<TicketMessage>,
+ List<TicketMessage>,
String
>
get messages => $composableBuilder(
@@ -2435,38 +2336,8 @@ class $$ShopInBitTicketsTableFilterComposer
builder: (column) => ColumnFilters(column),
);
- ColumnFilters<int> get apiTicketId => $composableBuilder(
- column: $table.apiTicketId,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get carResearchInvoiceId => $composableBuilder(
- column: $table.carResearchInvoiceId,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get feeTicketNumber => $composableBuilder(
- column: $table.feeTicketNumber,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<bool> get needsCreateRequest => $composableBuilder(
- column: $table.needsCreateRequest,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<bool> get isPendingPayment => $composableBuilder(
- column: $table.isPendingPayment,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<DateTime> get carResearchExpiresAt => $composableBuilder(
- column: $table.carResearchExpiresAt,
- builder: (column) => ColumnFilters(column),
- );
-
- ColumnFilters<String> get carResearchPaymentLinks => $composableBuilder(
- column: $table.carResearchPaymentLinks,
+ ColumnFilters<DateTime> get updatedAt => $composableBuilder(
+ column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
}
@@ -2480,28 +2351,23 @@ class $$ShopInBitTicketsTableOrderingComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- ColumnOrderings<String> get ticketId => $composableBuilder(
- column: $table.ticketId,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ ColumnOrderings<int> get apiTicketId => $composableBuilder(
+ column: $table.apiTicketId,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<int> get category => $composableBuilder(
- column: $table.category,
+ ColumnOrderings<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<int> get status => $composableBuilder(
- column: $table.status,
+ ColumnOrderings<String> get ticketNumber => $composableBuilder(
+ column: $table.ticketNumber,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get statusRaw => $composableBuilder(
- column: $table.statusRaw,
+ ColumnOrderings<String> get category => $composableBuilder(
+ column: $table.category,
builder: (column) => ColumnOrderings(column),
);
@@ -2515,43 +2381,43 @@ class $$ShopInBitTicketsTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get offerProductName => $composableBuilder(
- column: $table.offerProductName,
+ ColumnOrderings<String> get status => $composableBuilder(
+ column: $table.status,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get offerPrice => $composableBuilder(
- column: $table.offerPrice,
+ ColumnOrderings<String> get statusRaw => $composableBuilder(
+ column: $table.statusRaw,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get shippingName => $composableBuilder(
- column: $table.shippingName,
+ ColumnOrderings<String> get offerProductName => $composableBuilder(
+ column: $table.offerProductName,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get shippingStreet => $composableBuilder(
- column: $table.shippingStreet,
+ ColumnOrderings<String> get offerPrice => $composableBuilder(
+ column: $table.offerPrice,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get shippingCity => $composableBuilder(
- column: $table.shippingCity,
+ ColumnOrderings<String> get paymentInvoiceStatus => $composableBuilder(
+ column: $table.paymentInvoiceStatus,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get shippingPostalCode => $composableBuilder(
- column: $table.shippingPostalCode,
+ ColumnOrderings<String> get trackingLink => $composableBuilder(
+ column: $table.trackingLink,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get shippingCountry => $composableBuilder(
- column: $table.shippingCountry,
+ ColumnOrderings<DateTime> get lastAgentMessageAt => $composableBuilder(
+ column: $table.lastAgentMessageAt,
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<String> get paymentMethod => $composableBuilder(
- column: $table.paymentMethod,
+ ColumnOrderings<String> get feeTicketNumber => $composableBuilder(
+ column: $table.feeTicketNumber,
builder: (column) => ColumnOrderings(column),
);
@@ -2565,38 +2431,8 @@ class $$ShopInBitTicketsTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
- ColumnOrderings<int> get apiTicketId => $composableBuilder(
- column: $table.apiTicketId,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<String> get carResearchInvoiceId => $composableBuilder(
- column: $table.carResearchInvoiceId,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<String> get feeTicketNumber => $composableBuilder(
- column: $table.feeTicketNumber,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<bool> get needsCreateRequest => $composableBuilder(
- column: $table.needsCreateRequest,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<bool> get isPendingPayment => $composableBuilder(
- column: $table.isPendingPayment,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<DateTime> get carResearchExpiresAt => $composableBuilder(
- column: $table.carResearchExpiresAt,
- builder: (column) => ColumnOrderings(column),
- );
-
- ColumnOrderings<String> get carResearchPaymentLinks => $composableBuilder(
- column: $table.carResearchPaymentLinks,
+ ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
+ column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
}
@@ -2610,22 +2446,23 @@ class $$ShopInBitTicketsTableAnnotationComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
- GeneratedColumn<String> get ticketId =>
- $composableBuilder(column: $table.ticketId, builder: (column) => column);
-
- GeneratedColumn<String> get displayName => $composableBuilder(
- column: $table.displayName,
+ GeneratedColumn<int> get apiTicketId => $composableBuilder(
+ column: $table.apiTicketId,
builder: (column) => column,
);
- GeneratedColumnWithTypeConverter<ShopInBitCategory, int> get category =>
- $composableBuilder(column: $table.category, builder: (column) => column);
+ GeneratedColumn<String> get customerKey => $composableBuilder(
+ column: $table.customerKey,
+ builder: (column) => column,
+ );
- GeneratedColumnWithTypeConverter<ShopInBitOrderStatus, int> get status =>
- $composableBuilder(column: $table.status, builder: (column) => column);
+ GeneratedColumn<String> get ticketNumber => $composableBuilder(
+ column: $table.ticketNumber,
+ builder: (column) => column,
+ );
- GeneratedColumn<String> get statusRaw =>
- $composableBuilder(column: $table.statusRaw, builder: (column) => column);
+ GeneratedColumnWithTypeConverter<ShopInBitCategory, String> get category =>
+ $composableBuilder(column: $table.category, builder: (column) => column);
GeneratedColumn<String> get requestDescription => $composableBuilder(
column: $table.requestDescription,
@@ -2637,6 +2474,12 @@ class $$ShopInBitTicketsTableAnnotationComposer
builder: (column) => column,
);
+ GeneratedColumnWithTypeConverter<ShopInBitOrderStatus, String> get status =>
+ $composableBuilder(column: $table.status, builder: (column) => column);
+
+ GeneratedColumn<String> get statusRaw =>
+ $composableBuilder(column: $table.statusRaw, builder: (column) => column);
+
GeneratedColumn<String> get offerProductName => $composableBuilder(
column: $table.offerProductName,
builder: (column) => column,
@@ -2647,77 +2490,34 @@ class $$ShopInBitTicketsTableAnnotationComposer
builder: (column) => column,
);
- GeneratedColumn<String> get shippingName => $composableBuilder(
- column: $table.shippingName,
- builder: (column) => column,
- );
-
- GeneratedColumn<String> get shippingStreet => $composableBuilder(
- column: $table.shippingStreet,
- builder: (column) => column,
- );
-
- GeneratedColumn<String> get shippingCity => $composableBuilder(
- column: $table.shippingCity,
+ GeneratedColumn<String> get paymentInvoiceStatus => $composableBuilder(
+ column: $table.paymentInvoiceStatus,
builder: (column) => column,
);
- GeneratedColumn<String> get shippingPostalCode => $composableBuilder(
- column: $table.shippingPostalCode,
+ GeneratedColumn<String> get trackingLink => $composableBuilder(
+ column: $table.trackingLink,
builder: (column) => column,
);
- GeneratedColumn<String> get shippingCountry => $composableBuilder(
- column: $table.shippingCountry,
+ GeneratedColumn<DateTime> get lastAgentMessageAt => $composableBuilder(
+ column: $table.lastAgentMessageAt,
builder: (column) => column,
);
- GeneratedColumn<String> get paymentMethod => $composableBuilder(
- column: $table.paymentMethod,
+ GeneratedColumn<String> get feeTicketNumber => $composableBuilder(
+ column: $table.feeTicketNumber,
builder: (column) => column,
);
- GeneratedColumnWithTypeConverter<List<ShopInBitTicketMessage>, String>
- get messages =>
+ GeneratedColumnWithTypeConverter<List<TicketMessage>, String> get messages =>
$composableBuilder(column: $table.messages, builder: (column) => column);
GeneratedColumn<DateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
- GeneratedColumn<int> get apiTicketId => $composableBuilder(
- column: $table.apiTicketId,
- builder: (column) => column,
- );
-
- GeneratedColumn<String> get carResearchInvoiceId => $composableBuilder(
- column: $table.carResearchInvoiceId,
- builder: (column) => column,
- );
-
- GeneratedColumn<String> get feeTicketNumber => $composableBuilder(
- column: $table.feeTicketNumber,
- builder: (column) => column,
- );
-
- GeneratedColumn<bool> get needsCreateRequest => $composableBuilder(
- column: $table.needsCreateRequest,
- builder: (column) => column,
- );
-
- GeneratedColumn<bool> get isPendingPayment => $composableBuilder(
- column: $table.isPendingPayment,
- builder: (column) => column,
- );
-
- GeneratedColumn<DateTime> get carResearchExpiresAt => $composableBuilder(
- column: $table.carResearchExpiresAt,
- builder: (column) => column,
- );
-
- GeneratedColumn<String> get carResearchPaymentLinks => $composableBuilder(
- column: $table.carResearchPaymentLinks,
- builder: (column) => column,
- );
+ GeneratedColumn<DateTime> get updatedAt =>
+ $composableBuilder(column: $table.updatedAt, builder: (column) => column);
}
class $$ShopInBitTicketsTableTableManager
@@ -2757,112 +2557,79 @@ class $$ShopInBitTicketsTableTableManager
$$ShopInBitTicketsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
- Value<String> ticketId = const Value.absent(),
- Value<String> displayName = const Value.absent(),
+ Value<int> apiTicketId = const Value.absent(),
+ Value<String> customerKey = const Value.absent(),
+ Value<String> ticketNumber = const Value.absent(),
Value<ShopInBitCategory> category = const Value.absent(),
- Value<ShopInBitOrderStatus> status = const Value.absent(),
- Value<String?> statusRaw = const Value.absent(),
Value<String> requestDescription = const Value.absent(),
Value<String> deliveryCountry = const Value.absent(),
+ Value<ShopInBitOrderStatus> status = const Value.absent(),
+ Value<String> statusRaw = const Value.absent(),
Value<String?> offerProductName = const Value.absent(),
Value<String?> offerPrice = const Value.absent(),
- Value<String> shippingName = const Value.absent(),
- Value<String> shippingStreet = const Value.absent(),
- Value<String> shippingCity = const Value.absent(),
- Value<String> shippingPostalCode = const Value.absent(),
- Value<String> shippingCountry = const Value.absent(),
- Value<String?> paymentMethod = const Value.absent(),
- Value<List<ShopInBitTicketMessage>> messages =
- const Value.absent(),
- Value<DateTime> createdAt = const Value.absent(),
- Value<int> apiTicketId = const Value.absent(),
- Value<String?> carResearchInvoiceId = const Value.absent(),
+ Value<String?> paymentInvoiceStatus = const Value.absent(),
+ Value<String?> trackingLink = const Value.absent(),
+ Value<DateTime?> lastAgentMessageAt = const Value.absent(),
Value<String?> feeTicketNumber = const Value.absent(),
- Value<bool> needsCreateRequest = const Value.absent(),
- Value<bool> isPendingPayment = const Value.absent(),
- Value<DateTime?> carResearchExpiresAt = const Value.absent(),
- Value<String?> carResearchPaymentLinks = const Value.absent(),
- Value<int> rowid = const Value.absent(),
+ Value<List<TicketMessage>> messages = const Value.absent(),
+ Value<DateTime> createdAt = const Value.absent(),
+ Value<DateTime> updatedAt = const Value.absent(),
}) => ShopInBitTicketsCompanion(
- ticketId: ticketId,
- displayName: displayName,
+ apiTicketId: apiTicketId,
+ customerKey: customerKey,
+ ticketNumber: ticketNumber,
category: category,
- status: status,
- statusRaw: statusRaw,
requestDescription: requestDescription,
deliveryCountry: deliveryCountry,
+ status: status,
+ statusRaw: statusRaw,
offerProductName: offerProductName,
offerPrice: offerPrice,
- shippingName: shippingName,
- shippingStreet: shippingStreet,
- shippingCity: shippingCity,
- shippingPostalCode: shippingPostalCode,
- shippingCountry: shippingCountry,
- paymentMethod: paymentMethod,
+ paymentInvoiceStatus: paymentInvoiceStatus,
+ trackingLink: trackingLink,
+ lastAgentMessageAt: lastAgentMessageAt,
+ feeTicketNumber: feeTicketNumber,
messages: messages,
createdAt: createdAt,
- apiTicketId: apiTicketId,
- carResearchInvoiceId: carResearchInvoiceId,
- feeTicketNumber: feeTicketNumber,
- needsCreateRequest: needsCreateRequest,
- isPendingPayment: isPendingPayment,
- carResearchExpiresAt: carResearchExpiresAt,
- carResearchPaymentLinks: carResearchPaymentLinks,
- rowid: rowid,
+ updatedAt: updatedAt,
),
createCompanionCallback:
({
- required String ticketId,
- required String displayName,
+ required int apiTicketId,
+ required String customerKey,
+ required String ticketNumber,
required ShopInBitCategory category,
- required ShopInBitOrderStatus status,
- Value<String?> statusRaw = const Value.absent(),
required String requestDescription,
required String deliveryCountry,
+ required ShopInBitOrderStatus status,
+ required String statusRaw,
Value<String?> offerProductName = const Value.absent(),
Value<String?> offerPrice = const Value.absent(),
- required String shippingName,
- required String shippingStreet,
- required String shippingCity,
- required String shippingPostalCode,
- required String shippingCountry,
- Value<String?> paymentMethod = const Value.absent(),
- required List<ShopInBitTicketMessage> messages,
- required DateTime createdAt,
- required int apiTicketId,
- Value<String?> carResearchInvoiceId = const Value.absent(),
+ Value<String?> paymentInvoiceStatus = const Value.absent(),
+ Value<String?> trackingLink = const Value.absent(),
+ Value<DateTime?> lastAgentMessageAt = const Value.absent(),
Value<String?> feeTicketNumber = const Value.absent(),
- required bool needsCreateRequest,
- required bool isPendingPayment,
- Value<DateTime?> carResearchExpiresAt = const Value.absent(),
- Value<String?> carResearchPaymentLinks = const Value.absent(),
- Value<int> rowid = const Value.absent(),
+ Value<List<TicketMessage>> messages = const Value.absent(),
+ Value<DateTime> createdAt = const Value.absent(),
+ Value<DateTime> updatedAt = const Value.absent(),
}) => ShopInBitTicketsCompanion.insert(
- ticketId: ticketId,
- displayName: displayName,
+ apiTicketId: apiTicketId,
+ customerKey: customerKey,
+ ticketNumber: ticketNumber,
category: category,
- status: status,
- statusRaw: statusRaw,
requestDescription: requestDescription,
deliveryCountry: deliveryCountry,
+ status: status,
+ statusRaw: statusRaw,
offerProductName: offerProductName,
offerPrice: offerPrice,
- shippingName: shippingName,
- shippingStreet: shippingStreet,
- shippingCity: shippingCity,
- shippingPostalCode: shippingPostalCode,
- shippingCountry: shippingCountry,
- paymentMethod: paymentMethod,
+ paymentInvoiceStatus: paymentInvoiceStatus,
+ trackingLink: trackingLink,
+ lastAgentMessageAt: lastAgentMessageAt,
+ feeTicketNumber: feeTicketNumber,
messages: messages,
createdAt: createdAt,
- apiTicketId: apiTicketId,
- carResearchInvoiceId: carResearchInvoiceId,
- feeTicketNumber: feeTicketNumber,
- needsCreateRequest: needsCreateRequest,
- isPendingPayment: isPendingPayment,
- carResearchExpiresAt: carResearchExpiresAt,
- carResearchPaymentLinks: carResearchPaymentLinks,
- rowid: rowid,
+ updatedAt: updatedAt,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
@@ -2899,24 +2666,40 @@ class $SharedDatabaseManager {
$SharedDatabaseManager(this._db);
$$CakepayOrdersTableTableManager get cakepayOrders =>
$$CakepayOrdersTableTableManager(_db, _db.cakepayOrders);
- $$ShopinBitSettingsTableTableManager get shopinBitSettings =>
- $$ShopinBitSettingsTableTableManager(_db, _db.shopinBitSettings);
+ $$ShopInBitSettingsTableTableManager get shopInBitSettings =>
+ $$ShopInBitSettingsTableTableManager(_db, _db.shopInBitSettings);
$$ShopInBitTicketsTableTableManager get shopInBitTickets =>
$$ShopInBitTicketsTableTableManager(_db, _db.shopInBitTickets);
}
-mixin _$ShopinBitSettingsDaoMixin on DatabaseAccessor<SharedDatabase> {
- $ShopinBitSettingsTable get shopinBitSettings =>
- attachedDatabase.shopinBitSettings;
- ShopinBitSettingsDaoManager get managers => ShopinBitSettingsDaoManager(this);
+mixin _$ShopInBitSettingsDaoMixin on DatabaseAccessor<SharedDatabase> {
+ $ShopInBitSettingsTable get shopInBitSettings =>
+ attachedDatabase.shopInBitSettings;
+ ShopInBitSettingsDaoManager get managers => ShopInBitSettingsDaoManager(this);
+}
+
+class ShopInBitSettingsDaoManager {
+ final _$ShopInBitSettingsDaoMixin _db;
+ ShopInBitSettingsDaoManager(this._db);
+ $$ShopInBitSettingsTableTableManager get shopInBitSettings =>
+ $$ShopInBitSettingsTableTableManager(
+ _db.attachedDatabase,
+ _db.shopInBitSettings,
+ );
+}
+
+mixin _$ShopInBitTicketsDaoMixin on DatabaseAccessor<SharedDatabase> {
+ $ShopInBitTicketsTable get shopInBitTickets =>
+ attachedDatabase.shopInBitTickets;
+ ShopInBitTicketsDaoManager get managers => ShopInBitTicketsDaoManager(this);
}
-class ShopinBitSettingsDaoManager {
- final _$ShopinBitSettingsDaoMixin _db;
- ShopinBitSettingsDaoManager(this._db);
- $$ShopinBitSettingsTableTableManager get shopinBitSettings =>
- $$ShopinBitSettingsTableTableManager(
+class ShopInBitTicketsDaoManager {
+ final _$ShopInBitTicketsDaoMixin _db;
+ ShopInBitTicketsDaoManager(this._db);
+ $$ShopInBitTicketsTableTableManager get shopInBitTickets =>
+ $$ShopInBitTicketsTableTableManager(
_db.attachedDatabase,
- _db.shopinBitSettings,
+ _db.shopInBitTickets,
);
}
diff --git a/lib/db/drift/shared_db/tables/shopin_bit_settings.dart b/lib/db/drift/shared_db/tables/shopin_bit_settings.dart
index e4c3253..4438f90 100644
--- a/lib/db/drift/shared_db/tables/shopin_bit_settings.dart
+++ b/lib/db/drift/shared_db/tables/shopin_bit_settings.dart
@@ -1,15 +1,30 @@
-import 'package:drift/drift.dart';
+import "package:drift/drift.dart";
-class ShopinBitSettings extends Table {
- // Single row table - always row 0
- IntColumn get id => integer().withDefault(const Constant(0))();
+/// One row per ShopinBit customer key the user has ever generated or
+/// recovered. Whichever row has the most recent `lastUsedAt` is the
+/// "current" key — see `ShopInBitSettingsDao.getCurrentSettings`.
+class ShopInBitSettings extends Table {
+ TextColumn get customerKey => text()();
- BoolColumn get guidelinesAccepted =>
+ BoolColumn get privacyAccepted =>
boolean().withDefault(const Constant(false))();
+
+ BoolColumn get conciergeGuidelinesAccepted =>
+ boolean().withDefault(const Constant(false))();
+ BoolColumn get travelGuidelinesAccepted =>
+ boolean().withDefault(const Constant(false))();
+ BoolColumn get carGuidelinesAccepted =>
+ boolean().withDefault(const Constant(false))();
+
BoolColumn get setupComplete =>
boolean().withDefault(const Constant(false))();
- TextColumn get displayName => text().nullable()();
+
+ DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
+ DateTimeColumn get lastUsedAt => dateTime().withDefault(currentDateAndTime)();
+
+ @override
+ Set<Column<Object>> get primaryKey => {customerKey};
@override
- Set<Column> get primaryKey => {id};
+ bool get withoutRowId => true;
}
diff --git a/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart b/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
index 450053a..54d8bd5 100644
--- a/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
+++ b/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
@@ -2,112 +2,58 @@ import "dart:convert";
import "package:drift/drift.dart";
-import '../../../../models/shopinbit/shopinbit_order_model.dart'
- show ShopInBitCategory, ShopInBitOrderStatus;
+import "../../../../models/shopinbit/shopinbit_enums.dart";
+import "../../../../services/shopinbit/src/models/message.dart";
class ShopInBitTickets extends Table {
- TextColumn get ticketId => text()();
-
- TextColumn get displayName => text()();
-
- IntColumn get category => intEnum<ShopInBitCategory>()();
- IntColumn get status => intEnum<ShopInBitOrderStatus>()();
- TextColumn get statusRaw => text().nullable()();
+ IntColumn get apiTicketId => integer()();
+ TextColumn get customerKey => text()();
+ TextColumn get ticketNumber => text()();
+ TextColumn get category => textEnum<ShopInBitCategory>()();
TextColumn get requestDescription => text()();
TextColumn get deliveryCountry => text()();
+
+ TextColumn get status => textEnum<ShopInBitOrderStatus>()();
+ TextColumn get statusRaw => text()();
+
TextColumn get offerProductName => text().nullable()();
TextColumn get offerPrice => text().nullable()();
- TextColumn get shippingName => text()();
- TextColumn get shippingStreet => text()();
- TextColumn get shippingCity => text()();
- TextColumn get shippingPostalCode => text()();
- TextColumn get shippingCountry => text()();
+ TextColumn get paymentInvoiceStatus => text().nullable()();
+ TextColumn get trackingLink => text().nullable()();
+ DateTimeColumn get lastAgentMessageAt => dateTime().nullable()();
- TextColumn get paymentMethod => text().nullable()();
+ TextColumn get feeTicketNumber => text().nullable()();
TextColumn get messages =>
- text().map(const ShopInBitTicketMessagesConverter())();
+ text().map(const MessagesConverter()).withDefault(const Constant("[]"))();
- DateTimeColumn get createdAt => dateTime()();
- IntColumn get apiTicketId => integer()();
-
- // Car research retry support
- TextColumn get carResearchInvoiceId => text().nullable()();
- TextColumn get feeTicketNumber => text().nullable()();
- BoolColumn get needsCreateRequest => boolean()();
-
- // Car research resumable payment state
- BoolColumn get isPendingPayment => boolean()();
- DateTimeColumn get carResearchExpiresAt => dateTime().nullable()();
- TextColumn get carResearchPaymentLinks => text().nullable()();
+ DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
+ DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
@override
- Set<Column<Object>> get primaryKey => {ticketId};
-}
-
-class ShopInBitTicketMessage {
- final String text;
- final DateTime timestamp;
- final bool isFromUser;
-
- const ShopInBitTicketMessage({
- required this.text,
- required this.timestamp,
- required this.isFromUser,
- });
-
- factory ShopInBitTicketMessage.fromJson(Map<String, dynamic> json) {
- return ShopInBitTicketMessage(
- text: json["text"] as String,
- timestamp: DateTime.parse(json["timestamp"] as String),
- isFromUser: json["isFromUser"] as bool,
- );
- }
-
- Map<String, dynamic> toMap() {
- return {
- "text": text,
- "timestamp": timestamp.toIso8601String(),
- "isFromUser": isFromUser,
- };
- }
+ Set<Column<Object>> get primaryKey => {apiTicketId};
@override
- String toString() => toMap().toString();
+ bool get withoutRowId => true;
}
-class ShopInBitTicketMessagesConverter
- extends TypeConverter<List<ShopInBitTicketMessage>, String>
- with
- JsonTypeConverter2<
- List<ShopInBitTicketMessage>,
- String,
- List<dynamic>
- > {
- const ShopInBitTicketMessagesConverter();
-
- @override
- List<ShopInBitTicketMessage> fromSql(String fromDb) {
- final List<dynamic> decoded = jsonDecode(fromDb) as List<dynamic>;
- return fromJson(decoded);
- }
-
- @override
- String toSql(List<ShopInBitTicketMessage> value) {
- return jsonEncode(toJson(value));
- }
+/// Drift TypeConverter so `messages` round-trips between a JSON column and
+/// `List<TicketMessage>` on the generated data class.
+class MessagesConverter extends TypeConverter<List<TicketMessage>, String> {
+ const MessagesConverter();
@override
- List<ShopInBitTicketMessage> fromJson(List<dynamic> json) {
- return json
- .map((e) => ShopInBitTicketMessage.fromJson(e as Map<String, dynamic>))
- .toList();
+ List<TicketMessage> fromSql(String fromDb) {
+ final List<dynamic> raw = jsonDecode(fromDb) as List<dynamic>;
+ return raw
+ .map((e) => TicketMessage.fromJson(e as Map<String, dynamic>))
+ .toList(growable: false);
}
@override
- List<dynamic> toJson(List<ShopInBitTicketMessage> value) {
- return value.map((m) => m.toMap()).toList();
+ String toSql(List<TicketMessage> value) {
+ return jsonEncode(value.map((m) => m.toMap()).toList());
}
}
diff --git a/lib/models/shopinbit/shopinbit_enums.dart b/lib/models/shopinbit/shopinbit_enums.dart
new file mode 100644
index 0000000..eca8d63
--- /dev/null
+++ b/lib/models/shopinbit/shopinbit_enums.dart
@@ -0,0 +1,82 @@
+import 'dart:ui';
+
+import "../../services/shopinbit/src/models/ticket.dart";
+import '../../themes/stack_colors.dart';
+
+// Stable string identifiers — these names are persisted in the DB via
+// `textEnum<E>()`. Renaming any value silently corrupts existing rows;
+// add new values to the end instead.
+
+enum ShopInBitCategory {
+ concierge,
+ travel,
+ car;
+
+ /// Value used for `service_type` in `POST /requests`. Matches the API
+ /// spec strings exactly; equivalent to [name] for the current set.
+ String get apiValue => name;
+
+ String get label => switch (this) {
+ .concierge => "Concierge",
+ .travel => "Travel",
+ .car => "Car",
+ };
+}
+
+enum ShopInBitOrderStatus {
+ pending,
+ reviewing,
+ offerAvailable,
+ accepted,
+ paymentPending,
+ paid,
+ shipping,
+ delivered,
+ closed,
+ cancelled,
+ refunded;
+
+ String get label => switch (this) {
+ .pending => "Pending",
+ .reviewing => "Under review",
+ .offerAvailable => "Offer available",
+ .accepted => "Accepted",
+ .paymentPending => "Awaiting payment",
+ .paid => "Paid",
+ .shipping => "Shipping",
+ .delivered => "Delivered",
+ .closed => "Closed",
+ .cancelled => "Cancelled",
+ .refunded => "Refunded",
+ };
+
+ /// Maps a raw API ticket state to a customer-facing status. Returns null
+ /// for unrecognized states so the caller can decide whether to skip the
+ /// row entirely or keep the previous value.
+ static ShopInBitOrderStatus? fromTicketState(TicketState state) =>
+ switch (state) {
+ .newTicket => ShopInBitOrderStatus.pending,
+ .checking ||
+ .inProgress ||
+ .replyNeeded => ShopInBitOrderStatus.reviewing,
+ .offerAvailable => ShopInBitOrderStatus.offerAvailable,
+ .clearing => ShopInBitOrderStatus.accepted,
+ .pendingClose => ShopInBitOrderStatus.paymentPending,
+ .shipped => ShopInBitOrderStatus.shipping,
+ .fulfilled => ShopInBitOrderStatus.delivered,
+ .closed || .merged => ShopInBitOrderStatus.closed,
+ .closedCancelled => ShopInBitOrderStatus.cancelled,
+ .refunded => ShopInBitOrderStatus.refunded,
+ .unknown => null,
+ };
+}
+
+extension ShopinbitStatusStyleExt on ShopInBitOrderStatus {
+ Color getColor(StackColors colors) => switch (this) {
+ .delivered => colors.accentColorGreen,
+ .offerAvailable => colors.accentColorBlue,
+ .pending || .reviewing => colors.accentColorYellow,
+ .closed || .cancelled || .refunded => colors.textSubtitle1,
+ _ => colors.accentColorDark,
+ };
+}
diff --git a/lib/models/shopinbit/shopinbit_order_model.dart b/lib/models/shopinbit/shopinbit_order_model.dart
deleted file mode 100644
index 14b5304..0000000
--- a/lib/models/shopinbit/shopinbit_order_model.dart
+++ /dev/null
@@ -1,382 +0,0 @@
-import 'dart:ui';
-
-import 'package:drift/drift.dart';
-import 'package:flutter/foundation.dart';
-
-import '../../db/drift/shared_db/shared_database.dart';
-import '../../db/drift/shared_db/tables/shopin_bit_tickets.dart';
-import '../../services/shopinbit/src/models/ticket.dart';
-import '../../themes/stack_colors.dart';
-
-// these enum indexes are stored in a db. Do not edit order
-enum ShopInBitCategory { concierge, travel, car }
-
-// these enum indexes are stored in a db. Do not edit order
-enum ShopInBitOrderStatus {
- pending,
- reviewing,
- offerAvailable,
- accepted,
- paymentPending,
- paid,
- shipping,
- delivered,
- closed,
- cancelled,
- refunded;
-
- String get label => switch (this) {
- .pending => "Pending",
- .reviewing => "Under review",
- .offerAvailable => "Offer available",
- .accepted => "Accepted",
- .paymentPending => "Awaiting payment",
- .paid => "Paid",
- .shipping => "Shipping",
- .delivered => "Delivered",
- .closed => "Closed",
- .cancelled => "Cancelled",
- .refunded => "Refunded",
- };
-
- Color getColor(StackColors colors) => switch (this) {
- .delivered => colors.accentColorGreen,
- .offerAvailable => colors.accentColorBlue,
- .pending || .reviewing => colors.accentColorYellow,
- .closed || .cancelled || .refunded => colors.textSubtitle1,
- _ => colors.accentColorDark,
- };
-}
-
-class ShopInBitMessage {
- final String text;
- final DateTime timestamp;
- final bool isFromUser;
-
- const ShopInBitMessage({
- required this.text,
- required this.timestamp,
- required this.isFromUser,
- });
-}
-
-class ShopInBitOrderModel extends ChangeNotifier {
- String _displayName = "";
- String get displayName => _displayName;
- set displayName(String value) {
- if (_displayName != value) {
- _displayName = value;
- notifyListeners();
- }
- }
-
- bool _privacyAccepted = false;
- bool get privacyAccepted => _privacyAccepted;
- set privacyAccepted(bool value) {
- if (_privacyAccepted != value) {
- _privacyAccepted = value;
- notifyListeners();
- }
- }
-
- ShopInBitCategory? _category;
- ShopInBitCategory? get category => _category;
- set category(ShopInBitCategory? value) {
- if (_category != value) {
- _category = value;
- notifyListeners();
- }
- }
-
- bool _guidelinesAccepted = false;
- bool get guidelinesAccepted => _guidelinesAccepted;
- set guidelinesAccepted(bool value) {
- if (_guidelinesAccepted != value) {
- _guidelinesAccepted = value;
- notifyListeners();
- }
- }
-
- String _requestDescription = "";
- String get requestDescription => _requestDescription;
- set requestDescription(String value) {
- if (_requestDescription != value) {
- _requestDescription = value;
- notifyListeners();
- }
- }
-
- String _deliveryCountry = "";
- String get deliveryCountry => _deliveryCountry;
- set deliveryCountry(String value) {
- if (_deliveryCountry != value) {
- _deliveryCountry = value;
- notifyListeners();
- }
- }
-
- int _apiTicketId = 0;
- int get apiTicketId => _apiTicketId;
- set apiTicketId(int value) {
- if (_apiTicketId != value) {
- _apiTicketId = value;
- notifyListeners();
- }
- }
-
- String? _ticketId;
- String? get ticketId => _ticketId;
- set ticketId(String? value) {
- if (_ticketId != value) {
- _ticketId = value;
- notifyListeners();
- }
- }
-
- ShopInBitOrderStatus _status = ShopInBitOrderStatus.pending;
- ShopInBitOrderStatus get status => _status;
- set status(ShopInBitOrderStatus value) {
- if (_status != value) {
- _status = value;
- notifyListeners();
- }
- }
-
- // The most recent raw API state string, persisted alongside _status so that
- // we can recover from contract drift (renames / new states) without losing
- // history. _status is the parsed/mapped value; _statusRaw is the source of
- // truth straight from the API.
- String? _statusRaw;
- String? get statusRaw => _statusRaw;
- set statusRaw(String? value) {
- if (_statusRaw != value) {
- _statusRaw = value;
- notifyListeners();
- }
- }
-
- String? _offerProductName;
- String? get offerProductName => _offerProductName;
-
- String? _offerPrice;
- String? get offerPrice => _offerPrice;
-
- void setOffer({required String productName, required String price}) {
- _offerProductName = productName;
- _offerPrice = price;
- _status = ShopInBitOrderStatus.offerAvailable;
- notifyListeners();
- }
-
- String _shippingName = "";
- String get shippingName => _shippingName;
-
- String _shippingStreet = "";
- String get shippingStreet => _shippingStreet;
-
- String _shippingCity = "";
- String get shippingCity => _shippingCity;
-
- String _shippingPostalCode = "";
- String get shippingPostalCode => _shippingPostalCode;
-
- String _shippingCountry = "";
- String get shippingCountry => _shippingCountry;
-
- void setShippingAddress({
- required String name,
- required String street,
- required String city,
- required String postalCode,
- required String country,
- }) {
- _shippingName = name;
- _shippingStreet = street;
- _shippingCity = city;
- _shippingPostalCode = postalCode;
- _shippingCountry = country;
- notifyListeners();
- }
-
- String? _paymentMethod;
- String? get paymentMethod => _paymentMethod;
- set paymentMethod(String? value) {
- if (_paymentMethod != value) {
- _paymentMethod = value;
- notifyListeners();
- }
- }
-
- String? _carResearchInvoiceId;
- String? get carResearchInvoiceId => _carResearchInvoiceId;
- set carResearchInvoiceId(String? value) {
- if (_carResearchInvoiceId != value) {
- _carResearchInvoiceId = value;
- notifyListeners();
- }
- }
-
- String? _feeTicketNumber;
- String? get feeTicketNumber => _feeTicketNumber;
- set feeTicketNumber(String? value) {
- if (_feeTicketNumber != value) {
- _feeTicketNumber = value;
- notifyListeners();
- }
- }
-
- bool _needsCreateRequest = false;
- bool get needsCreateRequest => _needsCreateRequest;
- set needsCreateRequest(bool value) {
- if (_needsCreateRequest != value) {
- _needsCreateRequest = value;
- notifyListeners();
- }
- }
-
- bool _isPendingPayment = false;
- bool get isPendingPayment => _isPendingPayment;
- set isPendingPayment(bool value) {
- if (_isPendingPayment != value) {
- _isPendingPayment = value;
- notifyListeners();
- }
- }
-
- DateTime? _carResearchExpiresAt;
- DateTime? get carResearchExpiresAt => _carResearchExpiresAt;
- set carResearchExpiresAt(DateTime? value) {
- if (_carResearchExpiresAt != value) {
- _carResearchExpiresAt = value;
- notifyListeners();
- }
- }
-
- String? _carResearchPaymentLinks;
- String? get carResearchPaymentLinks => _carResearchPaymentLinks;
- set carResearchPaymentLinks(String? value) {
- if (_carResearchPaymentLinks != value) {
- _carResearchPaymentLinks = value;
- notifyListeners();
- }
- }
-
- List<ShopInBitMessage> _messages = [];
- List<ShopInBitMessage> get messages => List.unmodifiable(_messages);
- void addMessage(ShopInBitMessage message) {
- _messages.add(message);
- notifyListeners();
- }
-
- void clearMessages() {
- _messages.clear();
- }
-
- ShopInBitTicketsCompanion toCompanion() {
- assert(_ticketId != null, "ticketId must be set before persisting");
-
- final List<ShopInBitTicketMessage> messages = _messages
- .map(
- (m) => ShopInBitTicketMessage(
- text: m.text,
- timestamp: m.timestamp,
- isFromUser: m.isFromUser,
- ),
- )
- .toList();
-
- return ShopInBitTicketsCompanion(
- ticketId: Value(_ticketId!),
- displayName: Value(_displayName),
- category: Value(_category ?? ShopInBitCategory.concierge),
- status: Value(_status),
- statusRaw: Value(_statusRaw),
- requestDescription: Value(_requestDescription),
- deliveryCountry: Value(_deliveryCountry),
- offerProductName: Value(_offerProductName),
- offerPrice: Value(_offerPrice),
- shippingName: Value(_shippingName),
- shippingStreet: Value(_shippingStreet),
- shippingCity: Value(_shippingCity),
- shippingPostalCode: Value(_shippingPostalCode),
- shippingCountry: Value(_shippingCountry),
- paymentMethod: Value(_paymentMethod),
- apiTicketId: Value(_apiTicketId),
- carResearchInvoiceId: Value(_carResearchInvoiceId),
- feeTicketNumber: Value(_feeTicketNumber),
- needsCreateRequest: Value(_needsCreateRequest),
- isPendingPayment: Value(_isPendingPayment),
- carResearchExpiresAt: Value(_carResearchExpiresAt),
- carResearchPaymentLinks: Value(_carResearchPaymentLinks),
- messages: Value(messages),
- createdAt: Value(DateTime.now()),
- );
- }
-
- static ShopInBitOrderModel fromDriftRow(ShopInBitTicket ticket) {
- final List<ShopInBitMessage> messages = ticket.messages
- .map(
- (m) => ShopInBitMessage(
- text: m.text,
- timestamp: m.timestamp,
- isFromUser: m.isFromUser,
- ),
- )
- .toList();
-
- return ShopInBitOrderModel()
- .._displayName = ticket.displayName
- .._category = ticket.category
- .._apiTicketId = ticket.apiTicketId
- .._ticketId = ticket.ticketId
- .._status = ticket.status
- .._statusRaw = ticket.statusRaw
- .._requestDescription = ticket.requestDescription
- .._deliveryCountry = ticket.deliveryCountry
- .._offerProductName = ticket.offerProductName
- .._offerPrice = ticket.offerPrice
- .._shippingName = ticket.shippingName
- .._shippingStreet = ticket.shippingStreet
- .._shippingCity = ticket.shippingCity
- .._shippingPostalCode = ticket.shippingPostalCode
- .._shippingCountry = ticket.shippingCountry
- .._paymentMethod = ticket.paymentMethod
- .._carResearchInvoiceId = ticket.carResearchInvoiceId
- .._feeTicketNumber = ticket.feeTicketNumber
- .._needsCreateRequest = ticket.needsCreateRequest
- .._isPendingPayment = ticket.isPendingPayment
- .._carResearchExpiresAt = ticket.carResearchExpiresAt
- .._carResearchPaymentLinks = ticket.carResearchPaymentLinks
- .._messages = messages;
- }
-
- static ShopInBitOrderStatus? statusFromTicketState(TicketState state) {
- switch (state) {
- case TicketState.newTicket:
- return ShopInBitOrderStatus.pending;
- case TicketState.checking:
- case TicketState.inProgress:
- case TicketState.replyNeeded:
- return ShopInBitOrderStatus.reviewing;
- case TicketState.offerAvailable:
- return ShopInBitOrderStatus.offerAvailable;
- case TicketState.clearing:
- return ShopInBitOrderStatus.accepted;
- case TicketState.pendingClose:
- return ShopInBitOrderStatus.paymentPending;
- case TicketState.shipped:
- return ShopInBitOrderStatus.shipping;
- case TicketState.fulfilled:
- return ShopInBitOrderStatus.delivered;
- case TicketState.closed:
- case TicketState.merged:
- return ShopInBitOrderStatus.closed;
- case TicketState.closedCancelled:
- return ShopInBitOrderStatus.cancelled;
- case TicketState.refunded:
- return ShopInBitOrderStatus.refunded;
- case TicketState.unknown:
- return null;
- }
- }
-}
diff --git a/lib/models/shopinbit/shopinbit_request_draft.dart b/lib/models/shopinbit/shopinbit_request_draft.dart
new file mode 100644
index 0000000..49be9fa
--- /dev/null
+++ b/lib/models/shopinbit/shopinbit_request_draft.dart
@@ -0,0 +1,25 @@
+import 'shopinbit_enums.dart';
+
+class ShopinbitRequestDraft {
+ final ShopInBitCategory category;
+ final String requestDescription;
+ final String deliveryCountry;
+ final String? voucherCode;
+
+ ShopinbitRequestDraft({
+ required this.category,
+ required this.requestDescription,
+ required this.deliveryCountry,
+ required this.voucherCode,
+ });
+
+ Map<String, dynamic> toMap() => {
+ "category": category.apiValue,
+ "requestDescription": requestDescription,
+ "deliveryCountry": deliveryCountry,
+ "voucherCode": voucherCode,
+ };
+
+ @override
+ String toString() => toMap().toString();
+}
diff --git a/lib/pages/more_view/services_view.dart b/lib/pages/more_view/services_view.dart
index f99bfa9..0561b07 100644
--- a/lib/pages/more_view/services_view.dart
+++ b/lib/pages/more_view/services_view.dart
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
-import '../../models/shopinbit/shopinbit_order_model.dart';
+import '../../db/drift/shared_db/shared_database.dart';
import '../../providers/providers.dart';
import '../../themes/stack_colors.dart';
import '../../utilities/assets.dart';
@@ -30,19 +30,19 @@ class ServicesView extends ConsumerStatefulWidget {
}
class _ServicesViewState extends ConsumerState<ServicesView> {
- void _showShopDialog() {
- showDialog<void>(
+ Future<void> _showShopDialog() async {
+ final result = await showDialog<(ShopInBitSetting?, bool)>(
context: context,
barrierDismissible: true,
- builder: (dialogContext) => StackDialogBase(
+ builder: (context) => StackDialogBase(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("ShopinBit", style: STextStyles.pageTitleH2(dialogContext)),
+ Text("ShopinBit", style: STextStyles.pageTitleH2(context)),
const SizedBox(height: 8),
RichText(
text: TextSpan(
- style: STextStyles.smallMed14(dialogContext),
+ style: STextStyles.smallMed14(context),
children: [
const TextSpan(
text:
@@ -53,9 +53,7 @@ class _ServicesViewState extends ConsumerState<ServicesView> {
),
TextSpan(
text: "Privacy Policy",
- style: STextStyles.richLink(
- dialogContext,
- ).copyWith(fontSize: 16),
+ style: STextStyles.richLink(context).copyWith(fontSize: 16),
recognizer: TapGestureRecognizer()
..onTap = () async {
const url =
@@ -75,59 +73,28 @@ class _ServicesViewState extends ConsumerState<ServicesView> {
Row(
children: [
Expanded(
- child: TextButton(
- onPressed: () {
- Navigator.of(dialogContext).pop();
- },
- child: Text(
- "Cancel",
- style: STextStyles.button(dialogContext).copyWith(
- color: Theme.of(
- dialogContext,
- ).extension<StackColors>()!.accentColorDark,
- ),
- ),
+ child: SecondaryButton(
+ label: "Cancel",
+ onPressed: Navigator.of(context).pop,
),
),
const SizedBox(width: 8),
Expanded(
child: TextButton(
- style: Theme.of(dialogContext)
+ style: Theme.of(context)
.extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(dialogContext),
+ .getPrimaryEnabledButtonStyle(context),
onPressed: () async {
- Navigator.of(dialogContext).pop();
- final model = ShopInBitOrderModel();
final settings = await ref
.read(pSharedDrift)
- .shopinBitSettingsDao
- .getSettings();
+ .shopInBitSettingsDao
+ .getCurrentSettings();
- if (!mounted) return;
+ if (!context.mounted) return;
- if (settings.setupComplete) {
- // Returning user: pre-load display name,
- // skip Step 1, go to Step 2
- final savedName = settings.displayName;
- if (savedName != null && savedName.isNotEmpty) {
- model.displayName = savedName;
- }
- await Navigator.of(
- context,
- ).pushNamed(ShopInBitStep2.routeName, arguments: model);
- } else {
- // First-time user: show setup flow
- await Navigator.of(context).pushNamed(
- ShopInBitSetupView.routeName,
- arguments: model,
- );
- }
- if (mounted) setState(() {});
+ Navigator.of(context).pop((true, settings));
},
- child: Text(
- "Continue",
- style: STextStyles.button(dialogContext),
- ),
+ child: Text("Continue", style: STextStyles.button(context)),
),
),
],
@@ -136,6 +103,17 @@ class _ServicesViewState extends ConsumerState<ServicesView> {
),
),
);
+
+ if (mounted && result != null && result.$2 == true) {
+ final settings = result.$1;
+ if (settings != null && settings.setupComplete) {
+ // Returning user: straight to category selection.
+ await Navigator.of(context).pushNamed(ShopInBitStep2.routeName);
+ } else {
+ // First-time (or incomplete) setup: show the key-backup screen.
+ await Navigator.of(context).pushNamed(ShopInBitSetupView.routeName);
+ }
+ }
}
@override
@@ -267,7 +245,6 @@ class _ServicesViewState extends ConsumerState<ServicesView> {
await Navigator.of(
context,
).pushNamed(ShopInBitTicketsView.routeName);
- if (mounted) setState(() {});
},
),
],
diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
index 6757653..cb4ec42 100644
--- a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
+++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
@@ -148,10 +148,11 @@ abstract class SWB {
static bool _checkShouldCancel(
PreRestoreState? revertToState,
SecureStorageInterface secureStorageInterface,
+ ShopInBitService shopinbitService,
) {
if (_shouldCancelRestore) {
if (revertToState != null) {
- _revert(revertToState, secureStorageInterface);
+ _revert(revertToState, secureStorageInterface, shopinbitService);
} else {
_cancelCompleter!.complete();
_shouldCancelRestore = false;
@@ -245,21 +246,15 @@ abstract class SWB {
Logging.instance.i("SWB backing up shopin bit info");
final sharedDB = SharedDrift.get();
- final shopinBitSettings = await sharedDB.shopinBitSettings.select().get();
- final shopinBitCustomerKey =
- await (ShopInBitService()..ensureInitialized(_secureStore))
- .loadCustomerKey();
- final shopinBitOrders = await sharedDB.shopInBitTickets.select().get();
+ final shopinBitCustomerKeys =
+ await (sharedDB.select(sharedDB.shopInBitSettings)
+ ..orderBy([(t) => OrderingTerm.desc(t.lastUsedAt)]))
+ .map((row) => row.customerKey)
+ .get();
backupJson["shopinBit"] = {
- if (shopinBitCustomerKey != null)
- "shopinBitCustomerKey": shopinBitCustomerKey,
- if (shopinBitSettings.isNotEmpty)
- "shopinBitSettings": shopinBitSettings.first.toJson(),
- if (shopinBitOrders.isNotEmpty)
- "shopinBitOrders": shopinBitOrders
- .map((e) => e.toJson())
- .toList(growable: false),
+ if (shopinBitCustomerKeys.isNotEmpty)
+ "shopinBitCustomerKeys": shopinBitCustomerKeys,
};
Logging.instance.d("SWB backing up prefs");
@@ -620,6 +615,7 @@ abstract class SWB {
StackRestoringUIState? uiState,
Map<String, String> oldToNewWalletIdMap,
SecureStorageInterface secureStorageInterface,
+ ShopInBitService shopinbitService,
) async {
final Map<String, dynamic> prefs =
validJSON["prefs"] as Map<String, dynamic>;
@@ -636,7 +632,7 @@ abstract class SWB {
uiState?.preferences = StackRestoringStatus.restoring;
Logging.instance.d("SWB restoring cakepay order ids and shop in bit info");
- await _restoreCakepayAndShopinBitInfo(validJSON, secureStorageInterface);
+ await _restoreCakepayAndShopinBitInfo(validJSON, shopinbitService);
Logging.instance.d("SWB restoring prefs");
await _restorePrefs(prefs);
@@ -702,6 +698,7 @@ abstract class SWB {
String jsonBackup,
StackRestoringUIState? uiState,
SecureStorageInterface secureStorageInterface,
+ ShopInBitService shopinbitService,
) async {
if (!Platform.isLinux) await WakelockPlus.enable();
@@ -741,7 +738,7 @@ abstract class SWB {
// basic cancel check here
// no reverting required yet as nothing has been written to store
- if (_checkShouldCancel(null, secureStorageInterface)) {
+ if (_checkShouldCancel(null, secureStorageInterface, shopinbitService)) {
return false;
}
@@ -750,10 +747,15 @@ abstract class SWB {
uiState,
oldToNewWalletIdMap,
secureStorageInterface,
+ shopinbitService,
);
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
@@ -770,7 +772,11 @@ abstract class SWB {
for (final walletbackup in wallets) {
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
@@ -826,13 +832,21 @@ abstract class SWB {
// final failovers = nodeService.failoverNodesFor(coin: coin);
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
managers.add(Tuple2(walletbackup, info));
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
@@ -845,7 +859,11 @@ abstract class SWB {
}
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
@@ -856,7 +874,11 @@ abstract class SWB {
// start restoring wallets
for (final tuple in managers) {
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
final bools = await _asyncRestore(
@@ -870,13 +892,21 @@ abstract class SWB {
}
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
for (final Future<bool> status in restoreStatuses) {
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
await status;
@@ -884,7 +914,11 @@ abstract class SWB {
if (!Platform.isLinux) await WakelockPlus.disable();
// check if cancel was requested and restore previous state
- if (_checkShouldCancel(preRestoreState, secureStorageInterface)) {
+ if (_checkShouldCancel(
+ preRestoreState,
+ secureStorageInterface,
+ shopinbitService,
+ )) {
return false;
}
@@ -902,6 +936,7 @@ abstract class SWB {
static Future<void> _revert(
PreRestoreState revertToState,
SecureStorageInterface secureStorageInterface,
+ ShopInBitService shopinbitService,
) async {
final Map<String, dynamic> prefs =
revertToState.validJSON["prefs"] as Map<String, dynamic>;
@@ -918,7 +953,7 @@ abstract class SWB {
// cakepay and shopinbit
await _restoreCakepayAndShopinBitInfo(
revertToState.validJSON,
- secureStorageInterface,
+ shopinbitService,
);
// prefs
@@ -1122,7 +1157,7 @@ abstract class SWB {
static Future<void> _restoreCakepayAndShopinBitInfo(
Map<String, dynamic> backupJson,
- SecureStorageInterface _secureStore,
+ ShopInBitService shopinbitService,
) async {
final cakepayOrderIds = (backupJson["cakepayOrderIds"] as List? ?? [])
.cast<String>();
@@ -1130,53 +1165,16 @@ abstract class SWB {
await CakePayService.instance.addOrderId(orderId);
}
- final sharedDB = SharedDrift.get();
final json = backupJson["shopinBit"] as Map? ?? {};
if (json.isEmpty) return;
- final shopinBitCustomerKey = json["shopinBitCustomerKey"] as String?;
- if (shopinBitCustomerKey != null) {
- final currentKey =
- await (ShopInBitService()..ensureInitialized(_secureStore))
- .loadCustomerKey();
-
- if (currentKey != null && currentKey != shopinBitCustomerKey) {
- // TODO come back to this at some point
- // for now
- Logging.instance.w(
- "SWB restore found mismatching shopinbit customer keys. "
- "Ignoring the backup data in favor of the current data.",
- );
- return;
+ final shopinBitCustomerKeys = json["shopinBitCustomerKeys"] as List?;
+ if (shopinBitCustomerKeys != null && shopinBitCustomerKeys.isNotEmpty) {
+ for (final key in shopinBitCustomerKeys.cast<String>()) {
+ await shopinbitService.recoverCustomerKey(key);
}
}
-
- final shopinBitSettings = json["shopinBitSettings"] as Map?;
- if (shopinBitSettings != null) {
- final settings = ShopinBitSetting.fromJson(shopinBitSettings.cast());
-
- await sharedDB.transaction(() async {
- await sharedDB
- .into(sharedDB.shopinBitSettings)
- .insertOnConflictUpdate(settings.toCompanion(true));
- });
- }
-
- final shopinBitOrders = json["shopinBitOrders"] as List?;
- if (shopinBitOrders != null) {
- final orders = shopinBitOrders
- .map((e) => ShopInBitTicket.fromJson((e as Map).cast()))
- .map((e) => e.toCompanion(true));
-
- await sharedDB.transaction(() async {
- for (final order in orders) {
- await sharedDB
- .into(sharedDB.shopInBitTickets)
- .insertOnConflictUpdate(order);
- }
- });
- }
}
static Future<void> _restorePrefs(Map<String, dynamic> prefs) async {
diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart
index 7b71dc8..2062ef3 100644
--- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart
+++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart
@@ -19,6 +19,7 @@ import '../../../../../pages_desktop_specific/desktop_home_view.dart';
import '../../../../../pages_desktop_specific/desktop_menu.dart';
import '../../../../../providers/desktop/current_desktop_menu_item.dart';
import '../../../../../providers/global/secure_store_provider.dart';
+import '../../../../../providers/global/shopin_bit_service_provider.dart';
import '../../../../../providers/providers.dart';
import '../../../../../providers/stack_restore/stack_restoring_ui_state_provider.dart';
import '../../../../../themes/stack_colors.dart';
@@ -69,34 +70,32 @@ class _StackRestoreProgressViewState
showDialog<void>(
barrierDismissible: false,
context: context,
- builder:
- (_) => WillPopScope(
- onWillPop: () async {
- return shouldPop;
- },
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Material(
- color: Colors.transparent,
- child: Center(
- child: Text(
- "Cancelling restore. Please wait.",
- style: STextStyles.pageTitleH2(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textWhite,
- ),
- ),
+ builder: (_) => WillPopScope(
+ onWillPop: () async {
+ return shouldPop;
+ },
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Material(
+ color: Colors.transparent,
+ child: Center(
+ child: Text(
+ "Cancelling restore. Please wait.",
+ style: STextStyles.pageTitleH2(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textWhite,
),
),
- const SizedBox(height: 64),
- const Center(child: LoadingIndicator(width: 100)),
- ],
+ ),
),
- ),
+ const SizedBox(height: 64),
+ const Center(child: LoadingIndicator(width: 100)),
+ ],
+ ),
+ ),
),
);
@@ -108,12 +107,12 @@ class _StackRestoreProgressViewState
if (mounted) {
!isDesktop
? Navigator.of(context).popUntil(
- ModalRoute.withName(
- widget.fromFile
- ? RestoreFromEncryptedStringView.routeName
- : StackBackupView.routeName,
- ),
- )
+ ModalRoute.withName(
+ widget.fromFile
+ ? RestoreFromEncryptedStringView.routeName
+ : StackBackupView.routeName,
+ ),
+ )
: Navigator.of(context).popUntil((_) => count++ >= 2);
}
}
@@ -164,6 +163,7 @@ class _StackRestoreProgressViewState
widget.jsonString,
uiState,
ref.read(secureStoreProvider),
+ ref.read(pShopinBitService),
);
} catch (e, s) {
Logging.instance.w("$e\n$s", error: e, stackTrace: s);
@@ -199,8 +199,9 @@ class _StackRestoreProgressViewState
case StackRestoringStatus.waiting:
return SvgPicture.asset(
Assets.svg.loader,
- color:
- Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
);
case StackRestoringStatus.restoring:
return SvgPicture.asset(
@@ -248,8 +249,9 @@ class _StackRestoreProgressViewState
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -302,69 +304,22 @@ class _StackRestoreProgressViewState
);
return !isDesktop
? RestoringItemCard(
- left: SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- padding: const EdgeInsets.all(0),
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonBackSecondary,
- child: Center(
- child: SvgPicture.asset(
- Assets.svg.gear,
- width: 16,
- height: 16,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- ),
- ),
- ),
- right: SizedBox(
- width: 20,
- height: 20,
- child: _getIconForState(state),
- ),
- title: "Preferences",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
- "Something went wrong",
- style: STextStyles.errorSmall(context),
- )
- : null,
- )
- : RoundedContainer(
- padding: EdgeInsets.zero,
- color:
- Theme.of(context).extension<StackColors>()!.popupBG,
- borderColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- child: RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.gear,
width: 16,
height: 16,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
@@ -375,15 +330,56 @@ class _StackRestoreProgressViewState
child: _getIconForState(state),
),
title: "Preferences",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
+ "Something went wrong",
+ style: STextStyles.errorSmall(context),
+ )
+ : null,
+ )
+ : RoundedContainer(
+ padding: EdgeInsets.zero,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.popupBG,
+ borderColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ child: RestoringItemCard(
+ left: SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ padding: const EdgeInsets.all(0),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
+ child: Center(
+ child: SvgPicture.asset(
+ Assets.svg.gear,
+ width: 16,
+ height: 16,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ ),
+ ),
+ ),
+ ),
+ right: SizedBox(
+ width: 20,
+ height: 20,
+ child: _getIconForState(state),
+ ),
+ title: "Preferences",
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
- : null,
- ),
- );
+ : null,
+ ),
+ );
},
),
const SizedBox(height: 12),
@@ -396,67 +392,21 @@ class _StackRestoreProgressViewState
);
return !isDesktop
? RestoringItemCard(
- left: SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- padding: const EdgeInsets.all(0),
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonBackSecondary,
- child: Center(
- child: AddressBookIcon(
- width: 16,
- height: 16,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- ),
- ),
- ),
- right: SizedBox(
- width: 20,
- height: 20,
- child: _getIconForState(state),
- ),
- title: "Address book",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
- "Something went wrong",
- style: STextStyles.errorSmall(context),
- )
- : null,
- )
- : RoundedContainer(
- padding: EdgeInsets.zero,
- color:
- Theme.of(context).extension<StackColors>()!.popupBG,
- borderColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- child: RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
child: Center(
child: AddressBookIcon(
width: 16,
height: 16,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
@@ -467,15 +417,55 @@ class _StackRestoreProgressViewState
child: _getIconForState(state),
),
title: "Address book",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
+ "Something went wrong",
+ style: STextStyles.errorSmall(context),
+ )
+ : null,
+ )
+ : RoundedContainer(
+ padding: EdgeInsets.zero,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.popupBG,
+ borderColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ child: RestoringItemCard(
+ left: SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ padding: const EdgeInsets.all(0),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
+ child: Center(
+ child: AddressBookIcon(
+ width: 16,
+ height: 16,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ ),
+ ),
+ ),
+ ),
+ right: SizedBox(
+ width: 20,
+ height: 20,
+ child: _getIconForState(state),
+ ),
+ title: "Address book",
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
- : null,
- ),
- );
+ : null,
+ ),
+ );
},
),
const SizedBox(height: 12),
@@ -488,69 +478,22 @@ class _StackRestoreProgressViewState
);
return !isDesktop
? RestoringItemCard(
- left: SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- padding: const EdgeInsets.all(0),
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonBackSecondary,
- child: Center(
- child: SvgPicture.asset(
- Assets.svg.node,
- width: 16,
- height: 16,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- ),
- ),
- ),
- right: SizedBox(
- width: 20,
- height: 20,
- child: _getIconForState(state),
- ),
- title: "Nodes",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
- "Something went wrong",
- style: STextStyles.errorSmall(context),
- )
- : null,
- )
- : RoundedContainer(
- padding: EdgeInsets.zero,
- color:
- Theme.of(context).extension<StackColors>()!.popupBG,
- borderColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- child: RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.node,
width: 16,
height: 16,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
@@ -561,15 +504,56 @@ class _StackRestoreProgressViewState
child: _getIconForState(state),
),
title: "Nodes",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
+ "Something went wrong",
+ style: STextStyles.errorSmall(context),
+ )
+ : null,
+ )
+ : RoundedContainer(
+ padding: EdgeInsets.zero,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.popupBG,
+ borderColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ child: RestoringItemCard(
+ left: SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ padding: const EdgeInsets.all(0),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
+ child: Center(
+ child: SvgPicture.asset(
+ Assets.svg.node,
+ width: 16,
+ height: 16,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ ),
+ ),
+ ),
+ ),
+ right: SizedBox(
+ width: 20,
+ height: 20,
+ child: _getIconForState(state),
+ ),
+ title: "Nodes",
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
- : null,
- ),
- );
+ : null,
+ ),
+ );
},
),
const SizedBox(height: 12),
@@ -582,69 +566,22 @@ class _StackRestoreProgressViewState
);
return !isDesktop
? RestoringItemCard(
- left: SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- padding: const EdgeInsets.all(0),
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonBackSecondary,
- child: Center(
- child: SvgPicture.asset(
- Assets.svg.arrowsTwoWay,
- width: 16,
- height: 16,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- ),
- ),
- ),
- right: SizedBox(
- width: 20,
- height: 20,
- child: _getIconForState(state),
- ),
- title: "Exchange history",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
- "Something went wrong",
- style: STextStyles.errorSmall(context),
- )
- : null,
- )
- : RoundedContainer(
- padding: EdgeInsets.zero,
- color:
- Theme.of(context).extension<StackColors>()!.popupBG,
- borderColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- child: RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.arrowsTwoWay,
width: 16,
height: 16,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
@@ -655,15 +592,56 @@ class _StackRestoreProgressViewState
child: _getIconForState(state),
),
title: "Exchange history",
- subTitle:
- state == StackRestoringStatus.failed
- ? Text(
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
+ "Something went wrong",
+ style: STextStyles.errorSmall(context),
+ )
+ : null,
+ )
+ : RoundedContainer(
+ padding: EdgeInsets.zero,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.popupBG,
+ borderColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ child: RestoringItemCard(
+ left: SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ padding: const EdgeInsets.all(0),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonBackSecondary,
+ child: Center(
+ child: SvgPicture.asset(
+ Assets.svg.arrowsTwoWay,
+ width: 16,
+ height: 16,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ ),
+ ),
+ ),
+ ),
+ right: SizedBox(
+ width: 20,
+ height: 20,
+ child: _getIconForState(state),
+ ),
+ title: "Exchange history",
+ subTitle: state == StackRestoringStatus.failed
+ ? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
- : null,
- ),
- );
+ : null,
+ ),
+ );
},
),
const SizedBox(height: 16),
@@ -685,55 +663,54 @@ class _StackRestoreProgressViewState
const SizedBox(height: 30),
SizedBox(
width: MediaQuery.of(context).size.width - 32,
- child:
- !isDesktop
- ? TextButton(
- onPressed: () async {
- if (_success) {
- if (widget.shouldPushToHome) {
- Navigator.of(context).popUntil(
- ModalRoute.withName(HomeView.routeName),
- );
- } else {
- Navigator.of(context).pop();
- }
+ child: !isDesktop
+ ? TextButton(
+ onPressed: () async {
+ if (_success) {
+ if (widget.shouldPushToHome) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(HomeView.routeName),
+ );
} else {
- if (await _requestCancel()) {
- await _cancel();
- }
+ Navigator.of(context).pop();
}
- },
- style: Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(context),
- child: Text(
- _success ? "OK" : "Cancel restore process",
- style: STextStyles.button(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonTextPrimary,
- ),
+ } else {
+ if (await _requestCancel()) {
+ await _cancel();
+ }
+ }
+ },
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(context),
+ child: Text(
+ _success ? "OK" : "Cancel restore process",
+ style: STextStyles.button(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextPrimary,
),
- )
- : Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- _success
- ? PrimaryButton(
+ ),
+ )
+ : Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ _success
+ ? PrimaryButton(
width: 248,
buttonHeight: ButtonHeight.l,
enabled: true,
label: "Done",
onPressed: () async {
- final DesktopMenuItemId keyID =
- DesktopMenuItemId.myStack;
+ const DesktopMenuItemId keyID = .myStack;
ref
- .read(
- currentDesktopMenuItemProvider.state,
- )
- .state = keyID;
+ .read(
+ currentDesktopMenuItemProvider
+ .state,
+ )
+ .state =
+ keyID;
if (widget.shouldPushToHome) {
unawaited(
@@ -756,7 +733,7 @@ class _StackRestoreProgressViewState
}
},
)
- : SecondaryButton(
+ : SecondaryButton(
width: 248,
buttonHeight: ButtonHeight.l,
enabled: true,
@@ -767,8 +744,8 @@ class _StackRestoreProgressViewState
}
},
),
- ],
- ),
+ ],
+ ),
),
],
),
diff --git a/lib/pages/shopinbit/shopinbit_car_fee_view.dart b/lib/pages/shopinbit/shopinbit_car_fee_view.dart
index 1606d4a..60ea3f4 100644
--- a/lib/pages/shopinbit/shopinbit_car_fee_view.dart
+++ b/lib/pages/shopinbit/shopinbit_car_fee_view.dart
@@ -1,14 +1,13 @@
import 'dart:async';
-import 'dart:convert';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
-import '../../models/shopinbit/shopinbit_order_model.dart';
-import '../../providers/db/drift_provider.dart';
+import '../../models/shopinbit/shopinbit_request_draft.dart';
import '../../providers/global/shopin_bit_service_provider.dart';
+import '../../services/shopinbit/shopinbit_service.dart';
import '../../services/shopinbit/src/models/address.dart';
import '../../services/shopinbit/src/models/car_research.dart';
import '../../themes/stack_colors.dart';
@@ -31,11 +30,11 @@ import 'shopinbit_car_research_payment_view.dart';
import 'shopinbit_step_2.dart';
class ShopInBitCarFeeView extends ConsumerStatefulWidget {
- const ShopInBitCarFeeView({super.key, required this.model});
+ const ShopInBitCarFeeView({super.key, required this.draft});
static const String routeName = "/shopInBitCarFee";
- final ShopInBitOrderModel model;
+ final ShopinbitRequestDraft draft;
@override
ConsumerState<ShopInBitCarFeeView> createState() =>
@@ -98,14 +97,10 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
@override
void initState() {
super.initState();
- _nameController = TextEditingController(text: widget.model.shippingName);
- _streetController = TextEditingController(
- text: widget.model.shippingStreet,
- );
- _cityController = TextEditingController(text: widget.model.shippingCity);
- _postalCodeController = TextEditingController(
- text: widget.model.shippingPostalCode,
- );
+ _nameController = TextEditingController();
+ _streetController = TextEditingController();
+ _cityController = TextEditingController();
+ _postalCodeController = TextEditingController();
_nameFocusNode = FocusNode();
_streetFocusNode = FocusNode();
_cityFocusNode = FocusNode();
@@ -133,11 +128,6 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
}
_fetchCountries();
-
- // Pre-select country on resume if model already has a shipping country.
- if (widget.model.shippingCountry.isNotEmpty) {
- _selectedCountryIso = widget.model.shippingCountry;
- }
}
@override
@@ -216,13 +206,6 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
// Delivery address (always provided)
final deliveryName = _splitFullName(_nameController.text);
- widget.model.setShippingAddress(
- name: _nameController.text.trim(),
- street: _streetController.text.trim(),
- city: _cityController.text.trim(),
- postalCode: _postalCodeController.text.trim(),
- country: _selectedCountryIso!,
- );
// Billing address: use separate billing fields if different,
// else use delivery
@@ -251,9 +234,9 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
// Cache the car request alongside billing so the backend failsafe can
// create the real car research ticket once the fee is paid.
final request = CarResearchRequest(
- customerPseudonym: widget.model.displayName,
- comment: widget.model.requestDescription,
- deliveryCountry: widget.model.deliveryCountry,
+ customerPseudonym: kShopInBitCustomerPseudonym,
+ comment: widget.draft.requestDescription,
+ deliveryCountry: widget.draft.deliveryCountry,
);
final resp = await ref
@@ -286,18 +269,8 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
final invoice = resp.value!;
- // Persist pending state so the user can resume if they close the dialog.
- // Sentinel ticketId; unique-replace index ensures at most one pending
- // record.
- widget.model.ticketId = "pending-car-research";
- widget.model.carResearchInvoiceId = invoice.btcpayInvoice;
- widget.model.isPendingPayment = true;
- widget.model.carResearchExpiresAt = invoice.expiresAt;
- widget.model.carResearchPaymentLinks = jsonEncode(invoice.paymentLinks);
- final db = ref.read(pSharedDrift);
- await db
- .into(db.shopInBitTickets)
- .insertOnConflictUpdate(widget.model.toCompanion());
+ // No local persistence: an unfinished fee is recovered server-side via
+ // `GET /car-research/invoices/current` (see the requests list).
// Best-effort fee fetch; do not block navigation on fee parse failure.
await _loadFee(invoice);
@@ -307,7 +280,7 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
unawaited(
Navigator.of(context).pushNamed(
ShopInBitCarResearchPaymentView.routeName,
- arguments: (widget.model, invoice),
+ arguments: invoice,
),
);
} catch (e, s) {
diff --git a/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart b/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
index 138b331..18676e9 100644
--- a/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
+++ b/lib/pages/shopinbit/shopinbit_car_research_payment_view.dart
@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../app_config.dart';
-import '../../models/shopinbit/shopinbit_order_model.dart';
import '../../notifications/show_flush_bar.dart';
import '../../providers/global/shopin_bit_service_provider.dart';
import '../../providers/providers.dart';
@@ -31,15 +30,10 @@ import 'shopinbit_tickets_view.dart';
enum _PaymentFlowState { idle, polling, finalizing, complete, error }
class ShopInBitCarResearchPaymentView extends ConsumerStatefulWidget {
- const ShopInBitCarResearchPaymentView({
- super.key,
- required this.model,
- required this.invoice,
- });
+ const ShopInBitCarResearchPaymentView({super.key, required this.invoice});
static const String routeName = "/shopInBitCarResearchPayment";
- final ShopInBitOrderModel model;
final CarResearchInvoice invoice;
@override
@@ -84,7 +78,8 @@ class _ShopInBitCarResearchPaymentViewState
paymentUri: _currentAddress,
address: target.address,
amount: target.amount,
- model: widget.model,
+ // The car research fee is paid before any ticket exists.
+ apiTicketId: 0,
// After the wallet send, pop back here so polling can continue.
routeOnSuccessName: ShopInBitCarResearchPaymentView.routeName,
);
@@ -280,8 +275,8 @@ class _ShopInBitCarResearchPaymentViewState
setState(() => _flowState = _PaymentFlowState.finalizing);
_pollTimer?.cancel();
- final db = ref.read(pSharedDrift);
- final client = ref.read(pShopinBitService).client;
+ final service = ref.read(pShopinBitService);
+ final client = service.client;
try {
// Best-effort: the BTCPay webhook is the failsafe that finalizes the fee
@@ -293,8 +288,7 @@ class _ShopInBitCarResearchPaymentViewState
if (logResp.hasError || logResp.value == null) {
// Payment is confirmed but we could not log it. The webhook will
// finalize it server side, so send the user to their requests where
- // the finalized ticket will appear, and leave the pending record so
- // they can resume if needed.
+ // the finalized ticket will appear.
if (mounted) {
await showDialog<void>(
context: context,
@@ -314,47 +308,29 @@ class _ShopInBitCarResearchPaymentViewState
}
final result = logResp.value!;
- widget.model.feeTicketNumber = result.ticketNumber;
// log-payment returns the partner-scoped fee receipt, which the customer
- // key cannot poll. Adopt the customer-facing car research ticket the
- // backend created from the cached request so polling targets it instead.
+ // key cannot poll. Pull the customer-facing car research ticket the
+ // backend created from the cached request into the local DB, then open
+ // it. `refreshAll` inserts it so the order-created view can read it.
+ await service.refreshAll();
final realTicket = await _resolveRealTicket(result.ticketId);
- final prevTicketId = widget.model.ticketId;
- if (realTicket != null) {
- widget.model.apiTicketId = realTicket.id;
- widget.model.ticketId = realTicket.number;
- } else {
- // Backend has not surfaced the ticket yet. Show the receipt number and
- // leave polling disabled so we don't hammer the inaccessible receipt;
- // the requests list refresh will pick up the real ticket later.
- widget.model.apiTicketId = 0;
- widget.model.ticketId = result.ticketNumber;
- }
- widget.model.status = ShopInBitOrderStatus.pending;
- widget.model.isPendingPayment = false;
- widget.model.needsCreateRequest = false;
-
- await db
- .into(db.shopInBitTickets)
- .insertOnConflictUpdate(widget.model.toCompanion());
-
- // Drop the sentinel pending row now that we have a real ticket id.
- if (prevTicketId != null && prevTicketId != widget.model.ticketId) {
- await (db.delete(
- db.shopInBitTickets,
- )..where((t) => t.ticketId.equals(prevTicketId))).go();
- }
-
if (!mounted) return;
setState(() => _flowState = _PaymentFlowState.complete);
- unawaited(
- Navigator.of(
- context,
- ).pushNamed(ShopInBitOrderCreated.routeName, arguments: widget.model),
- );
+ if (realTicket != null) {
+ unawaited(
+ Navigator.of(context).pushNamed(
+ ShopInBitOrderCreated.routeName,
+ arguments: realTicket.id,
+ ),
+ );
+ } else {
+ // Backend has not surfaced the ticket yet; the requests list will pick
+ // it up on its next refresh.
+ _popToTickets();
+ }
} catch (e) {
if (mounted) {
setState(() => _flowState = _PaymentFlowState.error);
@@ -373,26 +349,17 @@ class _ShopInBitCarResearchPaymentViewState
}
/// Find the customer-facing car research ticket the backend created from the
- /// cached request, excluding the partner-scoped fee receipt and any ticket we
- /// already track. Returns the newest match, or null if none is visible yet.
+ /// cached request, excluding the partner-scoped fee receipt. Returns the
+ /// newest match, or null if none is visible yet.
Future<TicketRef?> _resolveRealTicket(int receiptTicketId) async {
final service = ref.read(pShopinBitService);
- final db = ref.read(pSharedDrift);
try {
final customerKey = await service.ensureCustomerKey();
final resp = await service.client.getTicketsByCustomer(customerKey);
if (resp.hasError || resp.value == null) return null;
- final knownApiIds = (await db.select(db.shopInBitTickets).get())
- .map((t) => t.apiTicketId)
- .toSet();
-
final candidates =
- resp.value!
- .where(
- (t) => t.id != receiptTicketId && !knownApiIds.contains(t.id),
- )
- .toList()
+ resp.value!.where((t) => t.id != receiptTicketId).toList()
..sort((a, b) => b.id.compareTo(a.id));
return candidates.isEmpty ? null : candidates.first;
diff --git a/lib/pages/shopinbit/shopinbit_confirm_send_view.dart b/lib/pages/shopinbit/shopinbit_confirm_send_view.dart
index a6f85da..2587a17 100644
--- a/lib/pages/shopinbit/shopinbit_confirm_send_view.dart
+++ b/lib/pages/shopinbit/shopinbit_confirm_send_view.dart
@@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../models/isar/models/isar_models.dart';
-import '../../models/shopinbit/shopinbit_order_model.dart';
import '../../notifications/show_flush_bar.dart';
import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart';
+import '../../providers/global/shopin_bit_service_provider.dart';
import '../../providers/providers.dart';
import '../../route_generator.dart';
import '../../themes/stack_colors.dart';
@@ -40,7 +40,7 @@ class ShopInBitConfirmSendView extends ConsumerStatefulWidget {
required this.txData,
required this.walletId,
this.routeOnSuccessName = WalletView.routeName,
- required this.model,
+ required this.apiTicketId,
this.tokenContract,
});
@@ -49,7 +49,7 @@ class ShopInBitConfirmSendView extends ConsumerStatefulWidget {
final TxData txData;
final String walletId;
final String routeOnSuccessName;
- final ShopInBitOrderModel model;
+ final int apiTicketId;
final EthContract? tokenContract;
@override
@@ -61,7 +61,7 @@ class _ShopInBitConfirmSendViewState
extends ConsumerState<ShopInBitConfirmSendView> {
late final String walletId;
late final String routeOnSuccessName;
- late final ShopInBitOrderModel model;
+ late final int apiTicketId;
final isDesktop = Util.isDesktop;
@@ -118,16 +118,12 @@ class _ShopInBitConfirmSendViewState
TransactionNote(walletId: walletId, txid: txid, value: note),
);
- // Update model status after successful broadcast
- model.status = ShopInBitOrderStatus.paymentPending;
- model.paymentMethod = widget.tokenContract != null
- ? widget.tokenContract!.symbol.toUpperCase()
- : coin.ticker.toUpperCase();
-
- final db = ref.read(pSharedDrift);
- await db
- .into(db.shopInBitTickets)
- .insertOnConflictUpdate(model.toCompanion());
+ // The server (and the BTCPay webhook) own ticket + payment state from
+ // here, so there's nothing to persist locally; just nudge a refresh so
+ // the ticket row reflects the new payment status promptly.
+ if (apiTicketId != 0) {
+ unawaited(ref.read(pShopinBitService).refreshOne(apiTicketId));
+ }
// pop back to wallet
if (context.mounted) {
@@ -250,12 +246,15 @@ class _ShopInBitConfirmSendViewState
void initState() {
walletId = widget.walletId;
routeOnSuccessName = widget.routeOnSuccessName;
- model = widget.model;
+ apiTicketId = widget.apiTicketId;
super.initState();
}
@override
Widget build(BuildContext context) {
+ final ticketNumber =
+ ref.watch(pShopInBitTicket(apiTicketId)).asData?.value?.ticketNumber ??
+ "";
return ConditionalParent(
condition: !isDesktop,
builder: (child) {
@@ -674,7 +673,7 @@ class _ShopInBitConfirmSendViewState
children: [
Text("Request ID", style: STextStyles.smallMed12(context)),
Text(
- model.ticketId ?? "",
+ ticketNumber,
style: STextStyles.itemSubtitle12(context),
textAlign: TextAlign.right,
),
diff --git a/lib/pages/shopinbit/shopinbit_offer_view.dart b/lib/pages/shopinbit/shopinbit_offer_view.dart
index b159493..54ac5ba 100644
--- a/lib/pages/shopinbit/shopinbit_offer_view.dart
+++ b/lib/pages/shopinbit/shopinbit_offer_view.dart
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import '../../models/shopinbit/shopinbit_order_model.dart';
import '../../providers/global/shopin_bit_service_provider.dart';
import '../../themes/stack_colors.dart';
import '../../utilities/show_loading.dart';
@@ -19,11 +18,11 @@ import '../../widgets/stack_dialog.dart';
import 'shopinbit_shipping_view.dart';
class ShopInBitOfferView extends ConsumerStatefulWidget {
- const ShopInBitOfferView({super.key, required this.model});
+ const ShopInBitOfferView({super.key, required this.apiTicketId});
static const String routeName = "/shopInBitOffer";
- final ShopInBitOrderModel model;
+ final int apiTicketId;
@override
ConsumerState<ShopInBitOfferView> createState() => _ShopInBitOfferViewState();
@@ -35,7 +34,7 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
@override
void initState() {
super.initState();
- if (widget.model.apiTicketId != 0) {
+ if (widget.apiTicketId != 0) {
_loadOffer();
}
}
@@ -43,19 +42,11 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
Future<void> _loadOffer() async {
setState(() => _loading = true);
try {
- final resp = await ref
- .read(pShopinBitService)
- .client
- .getTicketFull(widget.model.apiTicketId);
- if (!resp.hasError && resp.value != null) {
- final t = resp.value!;
- widget.model.setOffer(
- productName: t.productName,
- price: t.customerPrice,
- );
- }
+ // Refresh pulls /full (offer product + price) into the ticket row, which
+ // we then read reactively from the DB stream.
+ await ref.read(pShopinBitService).refreshOne(widget.apiTicketId);
} catch (_) {
- // Fall back to local data
+ // Fall back to whatever the row already has.
} finally {
if (mounted) setState(() => _loading = false);
}
@@ -64,7 +55,10 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
@override
Widget build(BuildContext context) {
final isDesktop = Util.isDesktop;
- final model = widget.model;
+ final ticket = ref
+ .watch(pShopInBitTicket(widget.apiTicketId))
+ .asData
+ ?.value;
final content = Column(
mainAxisSize: .min,
@@ -96,7 +90,7 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
),
const SizedBox(height: 4),
Text(
- model.offerProductName ?? (_loading ? "Loading..." : "N/A"),
+ ticket?.offerProductName ?? (_loading ? "Loading..." : "N/A"),
style: isDesktop
? STextStyles.desktopTextSmall(context)
: STextStyles.titleBold12(context),
@@ -117,9 +111,9 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
),
const SizedBox(height: 4),
Text(
- _loading && model.offerPrice == null
+ _loading && ticket?.offerPrice == null
? "Loading..."
- : "${model.offerPrice ?? '0'} EUR",
+ : "${ticket?.offerPrice ?? '0'} EUR",
style: isDesktop
? STextStyles.desktopTextSmall(context)
: STextStyles.titleBold12(context),
@@ -148,8 +142,7 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
buttonHeight: Util.isDesktop ? ButtonHeight.l : null,
enabled: !_loading,
onPressed: () async {
- // TODO verify this is ok to stay set to accepted if the next route pops back and then decline is tapped
- model.status = ShopInBitOrderStatus.accepted;
+ final deliveryCountry = ticket?.deliveryCountry ?? "";
final shopinBitApi = ref.read(pShopinBitService).client;
final response = await showLoading(
@@ -171,12 +164,12 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
response?.exception?.toString() ??
"Failed to fetch countries data";
} else if (response!.value!
- .where((c) => c['iso'] == model.deliveryCountry)
+ .where((c) => c['iso'] == deliveryCountry)
.length !=
1) {
errorMessage =
"Delivery country code \""
- "${model.deliveryCountry}"
+ "$deliveryCountry"
"\" is invalid";
}
@@ -197,7 +190,11 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
if (context.mounted) {
await Navigator.of(context).pushNamed(
ShopInBitShippingView.routeName,
- arguments: (model: model, countries: response!.value!),
+ arguments: (
+ apiTicketId: widget.apiTicketId,
+ deliveryCountry: deliveryCountry,
+ countries: response!.value!,
+ ),
);
}
},
diff --git a/lib/pages/shopinbit/shopinbit_order_created.dart b/lib/pages/shopinbit/shopinbit_order_created.dart
index 9680519..0389a24 100644
--- a/lib/pages/shopinbit/shopinbit_order_created.dart
+++ b/lib/pages/shopinbit/shopinbit_order_created.dart
@@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
+import 'package:Why this scored 14/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.