Transaction matching
This commit is contained in:
parent
6b28d00f1a
commit
728af63cab
|
|
@ -139,6 +139,14 @@ abstract class TransactionEntity extends Object
|
||||||
@BuiltValueField(wireName: 'transaction_id')
|
@BuiltValueField(wireName: 'transaction_id')
|
||||||
int get transactionId;
|
int get transactionId;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(serialize: false)
|
||||||
|
String get pendingVendorId;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(serialize: false)
|
||||||
|
String get pendingCategoryId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EntityType get entityType => EntityType.transaction;
|
EntityType get entityType => EntityType.transaction;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -576,6 +576,10 @@ class _$TransactionEntity extends TransactionEntity {
|
||||||
@override
|
@override
|
||||||
final int transactionId;
|
final int transactionId;
|
||||||
@override
|
@override
|
||||||
|
final String pendingVendorId;
|
||||||
|
@override
|
||||||
|
final String pendingCategoryId;
|
||||||
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
@override
|
@override
|
||||||
final int createdAt;
|
final int createdAt;
|
||||||
|
|
@ -610,6 +614,8 @@ class _$TransactionEntity extends TransactionEntity {
|
||||||
this.expenseId,
|
this.expenseId,
|
||||||
this.vendorId,
|
this.vendorId,
|
||||||
this.transactionId,
|
this.transactionId,
|
||||||
|
this.pendingVendorId,
|
||||||
|
this.pendingCategoryId,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
|
|
@ -678,6 +684,8 @@ class _$TransactionEntity extends TransactionEntity {
|
||||||
expenseId == other.expenseId &&
|
expenseId == other.expenseId &&
|
||||||
vendorId == other.vendorId &&
|
vendorId == other.vendorId &&
|
||||||
transactionId == other.transactionId &&
|
transactionId == other.transactionId &&
|
||||||
|
pendingVendorId == other.pendingVendorId &&
|
||||||
|
pendingCategoryId == other.pendingCategoryId &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
updatedAt == other.updatedAt &&
|
updatedAt == other.updatedAt &&
|
||||||
|
|
@ -709,18 +717,18 @@ class _$TransactionEntity extends TransactionEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc($jc(0, amount.hashCode), currencyId.hashCode),
|
$jc($jc($jc($jc($jc(0, amount.hashCode), currencyId.hashCode), category.hashCode), baseType.hashCode),
|
||||||
category.hashCode),
|
date.hashCode),
|
||||||
baseType.hashCode),
|
bankAccountId.hashCode),
|
||||||
date.hashCode),
|
description.hashCode),
|
||||||
bankAccountId.hashCode),
|
statusId.hashCode),
|
||||||
description.hashCode),
|
categoryId.hashCode),
|
||||||
statusId.hashCode),
|
invoiceIds.hashCode),
|
||||||
categoryId.hashCode),
|
expenseId.hashCode),
|
||||||
invoiceIds.hashCode),
|
vendorId.hashCode),
|
||||||
expenseId.hashCode),
|
transactionId.hashCode),
|
||||||
vendorId.hashCode),
|
pendingVendorId.hashCode),
|
||||||
transactionId.hashCode),
|
pendingCategoryId.hashCode),
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
updatedAt.hashCode),
|
updatedAt.hashCode),
|
||||||
|
|
@ -747,6 +755,8 @@ class _$TransactionEntity extends TransactionEntity {
|
||||||
..add('expenseId', expenseId)
|
..add('expenseId', expenseId)
|
||||||
..add('vendorId', vendorId)
|
..add('vendorId', vendorId)
|
||||||
..add('transactionId', transactionId)
|
..add('transactionId', transactionId)
|
||||||
|
..add('pendingVendorId', pendingVendorId)
|
||||||
|
..add('pendingCategoryId', pendingCategoryId)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
..add('updatedAt', updatedAt)
|
..add('updatedAt', updatedAt)
|
||||||
|
|
@ -816,6 +826,16 @@ class TransactionEntityBuilder
|
||||||
int get transactionId => _$this._transactionId;
|
int get transactionId => _$this._transactionId;
|
||||||
set transactionId(int transactionId) => _$this._transactionId = transactionId;
|
set transactionId(int transactionId) => _$this._transactionId = transactionId;
|
||||||
|
|
||||||
|
String _pendingVendorId;
|
||||||
|
String get pendingVendorId => _$this._pendingVendorId;
|
||||||
|
set pendingVendorId(String pendingVendorId) =>
|
||||||
|
_$this._pendingVendorId = pendingVendorId;
|
||||||
|
|
||||||
|
String _pendingCategoryId;
|
||||||
|
String get pendingCategoryId => _$this._pendingCategoryId;
|
||||||
|
set pendingCategoryId(String pendingCategoryId) =>
|
||||||
|
_$this._pendingCategoryId = pendingCategoryId;
|
||||||
|
|
||||||
bool _isChanged;
|
bool _isChanged;
|
||||||
bool get isChanged => _$this._isChanged;
|
bool get isChanged => _$this._isChanged;
|
||||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||||
|
|
@ -870,6 +890,8 @@ class TransactionEntityBuilder
|
||||||
_expenseId = $v.expenseId;
|
_expenseId = $v.expenseId;
|
||||||
_vendorId = $v.vendorId;
|
_vendorId = $v.vendorId;
|
||||||
_transactionId = $v.transactionId;
|
_transactionId = $v.transactionId;
|
||||||
|
_pendingVendorId = $v.pendingVendorId;
|
||||||
|
_pendingCategoryId = $v.pendingCategoryId;
|
||||||
_isChanged = $v.isChanged;
|
_isChanged = $v.isChanged;
|
||||||
_createdAt = $v.createdAt;
|
_createdAt = $v.createdAt;
|
||||||
_updatedAt = $v.updatedAt;
|
_updatedAt = $v.updatedAt;
|
||||||
|
|
@ -920,6 +942,8 @@ class TransactionEntityBuilder
|
||||||
expenseId: BuiltValueNullFieldError.checkNotNull(expenseId, 'TransactionEntity', 'expenseId'),
|
expenseId: BuiltValueNullFieldError.checkNotNull(expenseId, 'TransactionEntity', 'expenseId'),
|
||||||
vendorId: BuiltValueNullFieldError.checkNotNull(vendorId, 'TransactionEntity', 'vendorId'),
|
vendorId: BuiltValueNullFieldError.checkNotNull(vendorId, 'TransactionEntity', 'vendorId'),
|
||||||
transactionId: BuiltValueNullFieldError.checkNotNull(transactionId, 'TransactionEntity', 'transactionId'),
|
transactionId: BuiltValueNullFieldError.checkNotNull(transactionId, 'TransactionEntity', 'transactionId'),
|
||||||
|
pendingVendorId: pendingVendorId,
|
||||||
|
pendingCategoryId: pendingCategoryId,
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'TransactionEntity', 'createdAt'),
|
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'TransactionEntity', 'createdAt'),
|
||||||
updatedAt: BuiltValueNullFieldError.checkNotNull(updatedAt, 'TransactionEntity', 'updatedAt'),
|
updatedAt: BuiltValueNullFieldError.checkNotNull(updatedAt, 'TransactionEntity', 'updatedAt'),
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,17 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
|
||||||
final state = widget.viewModel.state;
|
final state = widget.viewModel.state;
|
||||||
if (transactions.isNotEmpty) {
|
if (transactions.isNotEmpty) {
|
||||||
final transaction = transactions.first;
|
final transaction = transactions.first;
|
||||||
if ((transaction.categoryId ?? '').isNotEmpty) {
|
if ((transaction.pendingCategoryId ?? '').isNotEmpty) {
|
||||||
|
_selectedCategory =
|
||||||
|
state.expenseCategoryState.get(transaction.pendingCategoryId);
|
||||||
|
} else if ((transaction.categoryId ?? '').isNotEmpty) {
|
||||||
_selectedCategory =
|
_selectedCategory =
|
||||||
state.expenseCategoryState.get(transaction.categoryId);
|
state.expenseCategoryState.get(transaction.categoryId);
|
||||||
}
|
}
|
||||||
if ((transaction.vendorId ?? '').isNotEmpty) {
|
|
||||||
|
if ((transaction.pendingVendorId ?? '').isNotEmpty) {
|
||||||
|
_selectedVendor = state.vendorState.get(transaction.pendingVendorId);
|
||||||
|
} else if ((transaction.vendorId ?? '').isNotEmpty) {
|
||||||
_selectedVendor = state.vendorState.get(transaction.vendorId);
|
_selectedVendor = state.vendorState.get(transaction.vendorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -623,8 +629,8 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
|
||||||
UpdateCurrentRoute(TransactionScreen.route));
|
UpdateCurrentRoute(TransactionScreen.route));
|
||||||
}));
|
}));
|
||||||
completer.future.then((SelectableEntity vendor) {
|
completer.future.then((SelectableEntity vendor) {
|
||||||
store.dispatch(SaveTransactionSuccess(
|
store.dispatch(SaveTransactionSuccess(transaction
|
||||||
transaction.rebuild((b) => b..vendorId = vendor.id)));
|
.rebuild((b) => b..pendingVendorId = vendor.id)));
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
UpdateCurrentRoute(TransactionScreen.route));
|
UpdateCurrentRoute(TransactionScreen.route));
|
||||||
});
|
});
|
||||||
|
|
@ -703,8 +709,9 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
|
||||||
UpdateCurrentRoute(TransactionScreen.route));
|
UpdateCurrentRoute(TransactionScreen.route));
|
||||||
}));
|
}));
|
||||||
completer.future.then((SelectableEntity category) {
|
completer.future.then((SelectableEntity category) {
|
||||||
store.dispatch(SaveTransactionSuccess(transaction
|
store.dispatch(SaveTransactionSuccess(
|
||||||
.rebuild((b) => b..categoryId = category.id)));
|
transaction.rebuild(
|
||||||
|
(b) => b..pendingCategoryId = category.id)));
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
UpdateCurrentRoute(TransactionScreen.route));
|
UpdateCurrentRoute(TransactionScreen.route));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue