disconecting expiry time and savings

This commit is contained in:
José Salazar
2026-01-26 18:39:22 -05:00
parent 57ea214871
commit d67dfd6f2f
14 changed files with 16639 additions and 16551 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.listBusinesses().execute();
ExampleConnector.instance.getBusinessesByUserId(getBusinessesByUserIdVariables).execute();
ExampleConnector.instance.getBusinessById(getBusinessByIdVariables).execute();
ExampleConnector.instance.createInvoice(createInvoiceVariables).execute();
ExampleConnector.instance.updateInvoice(updateInvoiceVariables).execute();
ExampleConnector.instance.deleteInvoice(deleteInvoiceVariables).execute();
ExampleConnector.instance.listRoles().execute();
ExampleConnector.instance.getRoleById(getRoleByIdVariables).execute();
ExampleConnector.instance.listRolesByVendorId(listRolesByVendorIdVariables).execute();
ExampleConnector.instance.listRolesByroleCategoryId(listRolesByroleCategoryIdVariables).execute();
ExampleConnector.instance.createBusiness(createBusinessVariables).execute();
ExampleConnector.instance.updateBusiness(updateBusinessVariables).execute();
ExampleConnector.instance.deleteBusiness(deleteBusinessVariables).execute();
ExampleConnector.instance.listCustomRateCards().execute();
ExampleConnector.instance.getCustomRateCardById(getCustomRateCardByIdVariables).execute();
ExampleConnector.instance.listClientFeedbacks(listClientFeedbacksVariables).execute();
ExampleConnector.instance.getClientFeedbackById(getClientFeedbackByIdVariables).execute();
ExampleConnector.instance.listClientFeedbacksByBusinessId(listClientFeedbacksByBusinessIdVariables).execute();
ExampleConnector.instance.listClientFeedbacksByVendorId(listClientFeedbacksByVendorIdVariables).execute();
ExampleConnector.instance.listClientFeedbacksByBusinessAndVendor(listClientFeedbacksByBusinessAndVendorVariables).execute();
```
@@ -23,8 +23,8 @@ Optional fields can be discovered based on classes that have `Optional` object t
This is an example of a mutation with an optional field:
```dart
await ExampleConnector.instance.UpdateAssignment({ ... })
.title(...)
await ExampleConnector.instance.updateActivityLog({ ... })
.userId(...)
.execute();
```

View File

@@ -8,6 +8,7 @@ class CreateAccountVariablesBuilder {
String ownerId;
Optional<String> _accountNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _routeNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<Timestamp> _expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);
final FirebaseDataConnect _dataConnect; CreateAccountVariablesBuilder isPrimary(bool? t) {
_isPrimary.value = t;
@@ -21,6 +22,10 @@ class CreateAccountVariablesBuilder {
_routeNumber.value = t;
return this;
}
CreateAccountVariablesBuilder expiryTime(Timestamp? t) {
_expiryTime.value = t;
return this;
}
CreateAccountVariablesBuilder(this._dataConnect, {required this.bank,required this.type,required this.last4,required this.ownerId,});
Deserializer<CreateAccountData> dataDeserializer = (dynamic json) => CreateAccountData.fromJson(jsonDecode(json));
@@ -30,7 +35,7 @@ class CreateAccountVariablesBuilder {
}
MutationRef<CreateAccountData, CreateAccountVariables> ref() {
CreateAccountVariables vars= CreateAccountVariables(bank: bank,type: type,last4: last4,isPrimary: _isPrimary,ownerId: ownerId,accountNumber: _accountNumber,routeNumber: _routeNumber,);
CreateAccountVariables vars= CreateAccountVariables(bank: bank,type: type,last4: last4,isPrimary: _isPrimary,ownerId: ownerId,accountNumber: _accountNumber,routeNumber: _routeNumber,expiryTime: _expiryTime,);
return _dataConnect.mutation("createAccount", dataDeserializer, varsSerializer, vars);
}
}
@@ -112,6 +117,7 @@ class CreateAccountVariables {
final String ownerId;
late final Optional<String>accountNumber;
late final Optional<String>routeNumber;
late final Optional<Timestamp>expiryTime;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
CreateAccountVariables.fromJson(Map<String, dynamic> json):
@@ -136,6 +142,10 @@ class CreateAccountVariables {
routeNumber = Optional.optional(nativeFromJson, nativeToJson);
routeNumber.value = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);
expiryTime.value = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']);
}
@override
bool operator ==(Object other) {
@@ -153,11 +163,12 @@ class CreateAccountVariables {
isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber;
routeNumber == otherTyped.routeNumber &&
expiryTime == otherTyped.expiryTime;
}
@override
int get hashCode => Object.hashAll([bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
int get hashCode => Object.hashAll([bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode]);
Map<String, dynamic> toJson() {
@@ -177,6 +188,9 @@ class CreateAccountVariables {
if(routeNumber.state == OptionalState.set) {
json['routeNumber'] = routeNumber.toJson();
}
if(expiryTime.state == OptionalState.set) {
json['expiryTime'] = expiryTime.toJson();
}
return json;
}
@@ -188,6 +202,7 @@ class CreateAccountVariables {
required this.ownerId,
required this.accountNumber,
required this.routeNumber,
required this.expiryTime,
});
}

View File

@@ -46,6 +46,7 @@ class FilterAccountsAccounts {
final bool? isPrimary;
final String ownerId;
final String? accountNumber;
final Timestamp? expiryTime;
final String? routeNumber;
FilterAccountsAccounts.fromJson(dynamic json):
@@ -56,6 +57,7 @@ class FilterAccountsAccounts {
isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
ownerId = nativeFromJson<String>(json['ownerId']),
accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
expiryTime = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']),
routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
@override
bool operator ==(Object other) {
@@ -74,11 +76,12 @@ class FilterAccountsAccounts {
isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
expiryTime == otherTyped.expiryTime &&
routeNumber == otherTyped.routeNumber;
}
@override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, expiryTime.hashCode, routeNumber.hashCode]);
Map<String, dynamic> toJson() {
@@ -96,6 +99,9 @@ class FilterAccountsAccounts {
if (accountNumber != null) {
json['accountNumber'] = nativeToJson<String?>(accountNumber);
}
if (expiryTime != null) {
json['expiryTime'] = expiryTime!.toJson();
}
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
@@ -110,6 +116,7 @@ class FilterAccountsAccounts {
this.isPrimary,
required this.ownerId,
this.accountNumber,
this.expiryTime,
this.routeNumber,
});
}

View File

@@ -27,6 +27,7 @@ class GetAccountByIdAccount {
final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? expiryTime;
final Timestamp? createdAt;
GetAccountByIdAccount.fromJson(dynamic json):
@@ -38,6 +39,7 @@ class GetAccountByIdAccount {
ownerId = nativeFromJson<String>(json['ownerId']),
accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
expiryTime = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override
bool operator ==(Object other) {
@@ -57,11 +59,12 @@ class GetAccountByIdAccount {
ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber &&
expiryTime == otherTyped.expiryTime &&
createdAt == otherTyped.createdAt;
}
@override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() {
@@ -82,6 +85,9 @@ class GetAccountByIdAccount {
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (expiryTime != null) {
json['expiryTime'] = expiryTime!.toJson();
}
if (createdAt != null) {
json['createdAt'] = createdAt!.toJson();
}
@@ -97,6 +103,7 @@ class GetAccountByIdAccount {
required this.ownerId,
this.accountNumber,
this.routeNumber,
this.expiryTime,
this.createdAt,
});
}

View File

@@ -27,6 +27,7 @@ class GetAccountsByOwnerIdAccounts {
final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? expiryTime;
final Timestamp? createdAt;
GetAccountsByOwnerIdAccounts.fromJson(dynamic json):
@@ -38,6 +39,7 @@ class GetAccountsByOwnerIdAccounts {
ownerId = nativeFromJson<String>(json['ownerId']),
accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
expiryTime = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override
bool operator ==(Object other) {
@@ -57,11 +59,12 @@ class GetAccountsByOwnerIdAccounts {
ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber &&
expiryTime == otherTyped.expiryTime &&
createdAt == otherTyped.createdAt;
}
@override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() {
@@ -82,6 +85,9 @@ class GetAccountsByOwnerIdAccounts {
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (expiryTime != null) {
json['expiryTime'] = expiryTime!.toJson();
}
if (createdAt != null) {
json['createdAt'] = createdAt!.toJson();
}
@@ -97,6 +103,7 @@ class GetAccountsByOwnerIdAccounts {
required this.ownerId,
this.accountNumber,
this.routeNumber,
this.expiryTime,
this.createdAt,
});
}

View File

@@ -26,6 +26,7 @@ class ListAccountsAccounts {
final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? expiryTime;
final Timestamp? createdAt;
ListAccountsAccounts.fromJson(dynamic json):
@@ -37,6 +38,7 @@ class ListAccountsAccounts {
ownerId = nativeFromJson<String>(json['ownerId']),
accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
expiryTime = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override
bool operator ==(Object other) {
@@ -56,11 +58,12 @@ class ListAccountsAccounts {
ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber &&
expiryTime == otherTyped.expiryTime &&
createdAt == otherTyped.createdAt;
}
@override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() {
@@ -81,6 +84,9 @@ class ListAccountsAccounts {
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (expiryTime != null) {
json['expiryTime'] = expiryTime!.toJson();
}
if (createdAt != null) {
json['createdAt'] = createdAt!.toJson();
}
@@ -96,6 +102,7 @@ class ListAccountsAccounts {
required this.ownerId,
this.accountNumber,
this.routeNumber,
this.expiryTime,
this.createdAt,
});
}

View File

@@ -8,6 +8,7 @@ class UpdateAccountVariablesBuilder {
Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _accountNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _routeNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<Timestamp> _expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);
final FirebaseDataConnect _dataConnect; UpdateAccountVariablesBuilder bank(String? t) {
_bank.value = t;
@@ -33,6 +34,10 @@ class UpdateAccountVariablesBuilder {
_routeNumber.value = t;
return this;
}
UpdateAccountVariablesBuilder expiryTime(Timestamp? t) {
_expiryTime.value = t;
return this;
}
UpdateAccountVariablesBuilder(this._dataConnect, {required this.id,});
Deserializer<UpdateAccountData> dataDeserializer = (dynamic json) => UpdateAccountData.fromJson(jsonDecode(json));
@@ -42,7 +47,7 @@ class UpdateAccountVariablesBuilder {
}
MutationRef<UpdateAccountData, UpdateAccountVariables> ref() {
UpdateAccountVariables vars= UpdateAccountVariables(id: id,bank: _bank,type: _type,last4: _last4,isPrimary: _isPrimary,accountNumber: _accountNumber,routeNumber: _routeNumber,);
UpdateAccountVariables vars= UpdateAccountVariables(id: id,bank: _bank,type: _type,last4: _last4,isPrimary: _isPrimary,accountNumber: _accountNumber,routeNumber: _routeNumber,expiryTime: _expiryTime,);
return _dataConnect.mutation("updateAccount", dataDeserializer, varsSerializer, vars);
}
}
@@ -126,6 +131,7 @@ class UpdateAccountVariables {
late final Optional<bool>isPrimary;
late final Optional<String>accountNumber;
late final Optional<String>routeNumber;
late final Optional<Timestamp>expiryTime;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
UpdateAccountVariables.fromJson(Map<String, dynamic> json):
@@ -156,6 +162,10 @@ class UpdateAccountVariables {
routeNumber = Optional.optional(nativeFromJson, nativeToJson);
routeNumber.value = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);
expiryTime.value = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']);
}
@override
bool operator ==(Object other) {
@@ -173,11 +183,12 @@ class UpdateAccountVariables {
last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber;
routeNumber == otherTyped.routeNumber &&
expiryTime == otherTyped.expiryTime;
}
@override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode]);
Map<String, dynamic> toJson() {
@@ -201,6 +212,9 @@ class UpdateAccountVariables {
if(routeNumber.state == OptionalState.set) {
json['routeNumber'] = routeNumber.toJson();
}
if(expiryTime.state == OptionalState.set) {
json['expiryTime'] = expiryTime.toJson();
}
return json;
}
@@ -212,6 +226,7 @@ class UpdateAccountVariables {
required this.isPrimary,
required this.accountNumber,
required this.routeNumber,
required this.expiryTime,
});
}

View File

@@ -81,8 +81,8 @@ class BillingRepositoryImpl implements BillingRepository {
@override
Future<double> getSavingsAmount() async {
// Simulating savings calculation (e.g., comparing to market rates).
await Future<void>.delayed(const Duration(milliseconds: 500));
return 320.00;
await Future<void>.delayed(const Duration(milliseconds: 0));
return 0.0;
}
/// Fetches the breakdown of spending.

View File

@@ -48,6 +48,7 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
final String last4 =
account?.last4.isNotEmpty == true ? account!.last4 : '----';
final bool isPrimary = account?.isPrimary ?? false;
final String expiryLabel = _formatExpiry(account?.expiryTime);
return Container(
padding: const EdgeInsets.all(UiConstants.space4),
@@ -127,13 +128,13 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'•••• $last4',
style: UiTypography.body2b.textPrimary,
),
Text(
t.client_billing.expires(date: '12/25'),
style: UiTypography.footnote2r.textSecondary,
),
'•••• $last4',
style: UiTypography.body2b.textPrimary,
),
Text(
t.client_billing.expires(date: expiryLabel),
style: UiTypography.footnote2r.textSecondary,
),
],
),
),
@@ -162,4 +163,14 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
},
);
}
String _formatExpiry(fdc.Timestamp? expiryTime) {
if (expiryTime == null) {
return 'N/A';
}
final DateTime date = expiryTime.toDateTime();
final String month = date.month.toString().padLeft(2, '0');
final String year = (date.year % 100).toString().padLeft(2, '0');
return '$month/$year';
}
}

View File

@@ -6,6 +6,7 @@ mutation createAccount(
$ownerId: UUID!
$accountNumber: String
$routeNumber: String
$expiryTime: Timestamp
) @auth(level: USER) {
account_insert(
data: {
@@ -16,6 +17,7 @@ mutation createAccount(
ownerId: $ownerId
accountNumber: $accountNumber
routeNumber: $routeNumber
expiryTime: $expiryTime
}
)
}
@@ -28,6 +30,7 @@ mutation updateAccount(
$isPrimary: Boolean
$accountNumber: String
$routeNumber: String
$expiryTime: Timestamp
) @auth(level: USER) {
account_update(
id: $id
@@ -38,6 +41,7 @@ mutation updateAccount(
isPrimary: $isPrimary
accountNumber: $accountNumber
routeNumber: $routeNumber
expiryTime: $expiryTime
}
)
}

View File

@@ -8,6 +8,7 @@ query listAccounts @auth(level: USER) {
ownerId
accountNumber
routeNumber
expiryTime
createdAt
}
}
@@ -22,6 +23,7 @@ query getAccountById($id: UUID!) @auth(level: USER) {
ownerId
accountNumber
routeNumber
expiryTime
createdAt
}
}
@@ -36,6 +38,7 @@ query getAccountsByOwnerId($ownerId: UUID!) @auth(level: USER) {
ownerId
accountNumber
routeNumber
expiryTime
createdAt
}
}
@@ -61,6 +64,7 @@ query filterAccounts(
isPrimary
ownerId
accountNumber
expiryTime
routeNumber
}
}

View File

@@ -13,6 +13,7 @@ type Account @table(name: "accounts") {
accountNumber: String
routeNumber: String
ownerId: UUID! #staff/business
expiryTime: Timestamp
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String