PaystackBulkChargeBatch.fromJson constructor
Constructs a PaystackBulkChargeBatch from Paystack's response JSON map.
Implementation
factory PaystackBulkChargeBatch.fromJson(Map<String, dynamic> json) {
return PaystackBulkChargeBatch(
batchCode: json['batch_code']?.toString() ?? json['batchCode']?.toString(),
reference: json['reference']?.toString(),
status: json['status']?.toString(),
totalCharges: json['total_charges'] is int
? json['total_charges'] as int
: int.tryParse(json['total_charges']?.toString() ?? ''),
pendingCharges: json['pending_charges'] is int
? json['pending_charges'] as int
: int.tryParse(json['pending_charges']?.toString() ?? ''),
unit: json['unit'] is int
? json['unit'] as int
: int.tryParse(json['unit']?.toString() ?? ''),
id: json['id'] is int
? json['id'] as int
: int.tryParse(json['id']?.toString() ?? ''),
integration: json['integration'] is int
? json['integration'] as int
: int.tryParse(json['integration']?.toString() ?? ''),
createdAt: json['createdAt']?.toString() ?? json['created_at']?.toString(),
updatedAt: json['updatedAt']?.toString() ?? json['updated_at']?.toString(),
rawJson: json,
);
}