Bank accounts

This commit is contained in:
Hillel Coren 2022-09-08 21:17:08 +03:00
parent f8494658bb
commit 96f96bfff0
4 changed files with 60 additions and 7 deletions

View File

@ -112,6 +112,8 @@ abstract class AccountEntity
return Version.parse(currentVersion) < Version.parse(latestVersion); return Version.parse(currentVersion) < Version.parse(latestVersion);
} }
bool get isOld => id.isNotEmpty;
bool get isTrial => trialDaysLeft > 0; bool get isTrial => trialDaysLeft > 0;
bool get isEligibleForTrial => trialStarted.isEmpty && plan == kPlanFree; bool get isEligibleForTrial => trialStarted.isEmpty && plan == kPlanFree;

View File

@ -66,6 +66,8 @@ abstract class BankAccountEntity extends Object
status: '', status: '',
type: '', type: '',
provider: '', provider: '',
balance: 0,
currency: '',
); );
} }
@ -87,6 +89,10 @@ abstract class BankAccountEntity extends Object
@BuiltValueField(wireName: 'provider_name') @BuiltValueField(wireName: 'provider_name')
String get provider; String get provider;
double get balance;
String get currency;
@override @override
EntityType get entityType => EntityType.bankAccount; EntityType get entityType => EntityType.bankAccount;

View File

@ -130,6 +130,12 @@ class _$BankAccountEntitySerializer
'provider_name', 'provider_name',
serializers.serialize(object.provider, serializers.serialize(object.provider,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'balance',
serializers.serialize(object.balance,
specifiedType: const FullType(double)),
'currency',
serializers.serialize(object.currency,
specifiedType: const FullType(String)),
'created_at', 'created_at',
serializers.serialize(object.createdAt, serializers.serialize(object.createdAt,
specifiedType: const FullType(int)), specifiedType: const FullType(int)),
@ -202,6 +208,14 @@ class _$BankAccountEntitySerializer
result.provider = serializers.deserialize(value, result.provider = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'balance':
result.balance = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'currency':
result.currency = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'isChanged': case 'isChanged':
result.isChanged = serializers.deserialize(value, result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool; specifiedType: const FullType(bool)) as bool;
@ -441,6 +455,10 @@ class _$BankAccountEntity extends BankAccountEntity {
@override @override
final String provider; final String provider;
@override @override
final double balance;
@override
final String currency;
@override
final bool isChanged; final bool isChanged;
@override @override
final int createdAt; final int createdAt;
@ -466,6 +484,8 @@ class _$BankAccountEntity extends BankAccountEntity {
this.status, this.status,
this.type, this.type,
this.provider, this.provider,
this.balance,
this.currency,
this.isChanged, this.isChanged,
this.createdAt, this.createdAt,
this.updatedAt, this.updatedAt,
@ -481,6 +501,10 @@ class _$BankAccountEntity extends BankAccountEntity {
BuiltValueNullFieldError.checkNotNull(type, 'BankAccountEntity', 'type'); BuiltValueNullFieldError.checkNotNull(type, 'BankAccountEntity', 'type');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
provider, 'BankAccountEntity', 'provider'); provider, 'BankAccountEntity', 'provider');
BuiltValueNullFieldError.checkNotNull(
balance, 'BankAccountEntity', 'balance');
BuiltValueNullFieldError.checkNotNull(
currency, 'BankAccountEntity', 'currency');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
createdAt, 'BankAccountEntity', 'createdAt'); createdAt, 'BankAccountEntity', 'createdAt');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
@ -506,6 +530,8 @@ class _$BankAccountEntity extends BankAccountEntity {
status == other.status && status == other.status &&
type == other.type && type == other.type &&
provider == other.provider && provider == other.provider &&
balance == other.balance &&
currency == other.currency &&
isChanged == other.isChanged && isChanged == other.isChanged &&
createdAt == other.createdAt && createdAt == other.createdAt &&
updatedAt == other.updatedAt && updatedAt == other.updatedAt &&
@ -526,6 +552,8 @@ class _$BankAccountEntity extends BankAccountEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc(
$jc(
$jc( $jc(
$jc( $jc(
$jc( $jc(
@ -533,6 +561,8 @@ class _$BankAccountEntity extends BankAccountEntity {
status.hashCode), status.hashCode),
type.hashCode), type.hashCode),
provider.hashCode), provider.hashCode),
balance.hashCode),
currency.hashCode),
isChanged.hashCode), isChanged.hashCode),
createdAt.hashCode), createdAt.hashCode),
updatedAt.hashCode), updatedAt.hashCode),
@ -550,6 +580,8 @@ class _$BankAccountEntity extends BankAccountEntity {
..add('status', status) ..add('status', status)
..add('type', type) ..add('type', type)
..add('provider', provider) ..add('provider', provider)
..add('balance', balance)
..add('currency', currency)
..add('isChanged', isChanged) ..add('isChanged', isChanged)
..add('createdAt', createdAt) ..add('createdAt', createdAt)
..add('updatedAt', updatedAt) ..add('updatedAt', updatedAt)
@ -582,6 +614,14 @@ class BankAccountEntityBuilder
String get provider => _$this._provider; String get provider => _$this._provider;
set provider(String provider) => _$this._provider = provider; set provider(String provider) => _$this._provider = provider;
double _balance;
double get balance => _$this._balance;
set balance(double balance) => _$this._balance = balance;
String _currency;
String get currency => _$this._currency;
set currency(String currency) => _$this._currency = currency;
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;
@ -625,6 +665,8 @@ class BankAccountEntityBuilder
_status = $v.status; _status = $v.status;
_type = $v.type; _type = $v.type;
_provider = $v.provider; _provider = $v.provider;
_balance = $v.balance;
_currency = $v.currency;
_isChanged = $v.isChanged; _isChanged = $v.isChanged;
_createdAt = $v.createdAt; _createdAt = $v.createdAt;
_updatedAt = $v.updatedAt; _updatedAt = $v.updatedAt;
@ -661,6 +703,10 @@ class BankAccountEntityBuilder
type, 'BankAccountEntity', 'type'), type, 'BankAccountEntity', 'type'),
provider: BuiltValueNullFieldError.checkNotNull( provider: BuiltValueNullFieldError.checkNotNull(
provider, 'BankAccountEntity', 'provider'), provider, 'BankAccountEntity', 'provider'),
balance: BuiltValueNullFieldError.checkNotNull(
balance, 'BankAccountEntity', 'balance'),
currency: BuiltValueNullFieldError.checkNotNull(
currency, 'BankAccountEntity', 'currency'),
isChanged: isChanged, isChanged: isChanged,
createdAt: BuiltValueNullFieldError.checkNotNull( createdAt: BuiltValueNullFieldError.checkNotNull(
createdAt, 'BankAccountEntity', 'createdAt'), createdAt, 'BankAccountEntity', 'createdAt'),
@ -671,8 +717,7 @@ class BankAccountEntityBuilder
isDeleted: isDeleted, isDeleted: isDeleted,
createdUserId: createdUserId, createdUserId: createdUserId,
assignedUserId: assignedUserId, assignedUserId: assignedUserId,
id: BuiltValueNullFieldError.checkNotNull( id: BuiltValueNullFieldError.checkNotNull(id, 'BankAccountEntity', 'id'));
id, 'BankAccountEntity', 'id'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }

View File

@ -933,7 +933,7 @@ class SidebarFooter extends StatelessWidget {
if (state.isMenuCollapsed) ...[ if (state.isMenuCollapsed) ...[
Expanded(child: SizedBox()) Expanded(child: SizedBox())
] else ...[ ] else ...[
if (!Config.DEMO_MODE && !state.isDemo) if (!Config.DEMO_MODE && !state.isDemo && account.isOld)
if (state.isSelfHosted && !account.isSchedulerRunning) if (state.isSelfHosted && !account.isSchedulerRunning)
IconButton( IconButton(
tooltip: prefState.enableTooltips ? localization.error : '', tooltip: prefState.enableTooltips ? localization.error : '',