Files
Kifi/kifi-app/lib/features/vendor/domain/purchase_payment.dart
2026-08-24 18:38:46 +05:30

63 lines
1.5 KiB
Dart

class PurchasePayment {
final int? id;
final int? poId;
final int? transactionId;
final double amount;
final String? paymentMethod;
final DateTime? paymentDate;
final String? notes;
PurchasePayment({
this.id,
this.poId,
this.transactionId,
required this.amount,
this.paymentMethod,
this.paymentDate,
this.notes,
});
factory PurchasePayment.fromJson(Map<String, dynamic> json) {
return PurchasePayment(
id: json['id'],
poId: json['poId'],
transactionId: json['transactionId'],
amount: (json['amount'] ?? 0.0).toDouble(),
paymentMethod: json['paymentMethod'],
paymentDate: json['paymentDate'] != null ? DateTime.parse(json['paymentDate']) : null,
notes: json['notes'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'poId': poId,
'transactionId': transactionId,
'amount': amount,
'paymentMethod': paymentMethod,
'notes': notes,
};
}
PurchasePayment copyWith({
int? id,
int? poId,
int? transactionId,
double? amount,
String? paymentMethod,
DateTime? paymentDate,
String? notes,
}) {
return PurchasePayment(
id: id ?? this.id,
poId: poId ?? this.poId,
transactionId: transactionId ?? this.transactionId,
amount: amount ?? this.amount,
paymentMethod: paymentMethod ?? this.paymentMethod,
paymentDate: paymentDate ?? this.paymentDate,
notes: notes ?? this.notes,
);
}
}