first commit
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// File: bank_account_model.dart
|
||||
|
||||
class BankListModel {
|
||||
BankListModel({this.message, this.data});
|
||||
|
||||
BankListModel.fromJson(dynamic json) {
|
||||
message = json['message'];
|
||||
if (json['data'] != null) {
|
||||
data = [];
|
||||
json['data'].forEach((v) {
|
||||
data?.add(BankData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
String? message;
|
||||
List<BankData>? data;
|
||||
}
|
||||
|
||||
class BankData {
|
||||
BankData({
|
||||
this.id,
|
||||
this.name, // Account Display Name
|
||||
this.meta,
|
||||
this.showInInvoice,
|
||||
this.openingDate,
|
||||
this.openingBalance,
|
||||
this.balance,
|
||||
this.status,
|
||||
});
|
||||
|
||||
BankData.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
meta = json['meta'] != null ? BankMeta.fromJson(json['meta']) : null;
|
||||
showInInvoice = json['show_in_invoice'];
|
||||
openingDate = json['opening_date'];
|
||||
openingBalance = json['opening_balance'];
|
||||
balance = json['balance'];
|
||||
status = json['status'];
|
||||
}
|
||||
num? id;
|
||||
String? name;
|
||||
BankMeta? meta;
|
||||
num? showInInvoice;
|
||||
String? openingDate;
|
||||
num? openingBalance;
|
||||
num? balance;
|
||||
num? status;
|
||||
}
|
||||
|
||||
class BankMeta {
|
||||
BankMeta({
|
||||
this.accountNumber,
|
||||
this.ifscCode,
|
||||
this.upiId,
|
||||
this.bankName,
|
||||
this.accountHolder,
|
||||
});
|
||||
|
||||
BankMeta.fromJson(dynamic json) {
|
||||
accountNumber = json['account_number'];
|
||||
ifscCode = json['ifsc_code'];
|
||||
upiId = json['upi_id'];
|
||||
bankName = json['bank_name'];
|
||||
accountHolder = json['account_holder'];
|
||||
}
|
||||
String? accountNumber;
|
||||
String? ifscCode;
|
||||
String? upiId;
|
||||
String? bankName;
|
||||
String? accountHolder;
|
||||
|
||||
// Helper method to convert back to API format (meta fields are sent as separate inputs)
|
||||
Map<String, dynamic> toApiMetaJson() {
|
||||
return {
|
||||
'account_number': accountNumber,
|
||||
'ifsc_code': ifscCode,
|
||||
'upi_id': upiId,
|
||||
'bank_name': bankName,
|
||||
'account_holder': accountHolder,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// File: bank_transaction_history_model.dart (Updated to full structure)
|
||||
|
||||
class TransactionHistoryListModel {
|
||||
TransactionHistoryListModel({this.message, this.data});
|
||||
|
||||
TransactionHistoryListModel.fromJson(dynamic json) {
|
||||
message = json['message'];
|
||||
if (json['data'] != null) {
|
||||
data = [];
|
||||
json['data'].forEach((v) {
|
||||
data?.add(TransactionData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
String? message;
|
||||
List<TransactionData>? data;
|
||||
}
|
||||
|
||||
class TransactionData {
|
||||
TransactionData({
|
||||
this.id,
|
||||
this.platform,
|
||||
this.transactionType,
|
||||
this.type, // credit / debit / transfer
|
||||
this.amount,
|
||||
this.date,
|
||||
this.fromBankId,
|
||||
this.toBankId,
|
||||
this.invoiceNo,
|
||||
this.image,
|
||||
this.note,
|
||||
this.user,
|
||||
// Add nested bank models if API provides bank objects, otherwise we only use IDs
|
||||
});
|
||||
|
||||
TransactionData.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
platform = json['platform'];
|
||||
transactionType = json['transaction_type'];
|
||||
type = json['type'];
|
||||
amount = json['amount'];
|
||||
date = json['date'];
|
||||
fromBankId = json['from_bank'];
|
||||
toBankId = json['to_bank'];
|
||||
invoiceNo = json['invoice_no'];
|
||||
image = json['image'];
|
||||
note = json['note'];
|
||||
user = json['user'] != null ? TransactionUser.fromJson(json['user']) : null;
|
||||
}
|
||||
num? id;
|
||||
String? platform;
|
||||
String? transactionType;
|
||||
String? type;
|
||||
num? amount;
|
||||
String? date;
|
||||
num? fromBankId;
|
||||
num? toBankId;
|
||||
String? invoiceNo;
|
||||
String? image;
|
||||
String? note;
|
||||
TransactionUser? user;
|
||||
}
|
||||
|
||||
class TransactionUser {
|
||||
TransactionUser({this.id, this.name});
|
||||
TransactionUser.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
num? id;
|
||||
String? name;
|
||||
}
|
||||
Reference in New Issue
Block a user