PaymentData.fromJson constructor

PaymentData.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory PaymentData.fromJson(Map<String, dynamic> json) {
  return PaymentData(
    id: json['id'] is String ? int.tryParse(json['id']) : json['id'],
    domain: json['domain']?.toString(),
    status: json['status']?.toString(),
    reference: json['reference']?.toString(),
    receiptNumber: json['receipt_number']?.toString(),
    amount: json['amount'] is String
        ? int.tryParse(json['amount'])
        : json['amount'],
    message: json['message']?.toString(),
    gatewayResponse: json['gateway_response']?.toString(),
    paidAt: json['paid_at']?.toString(),
    createdAt: json['created_at']?.toString(),
    channel: json['channel']?.toString(),
    currency: json['currency']?.toString(),
    ipAddress: json['ip_address']?.toString(),
    fees: json['fees'] is String ? int.tryParse(json['fees']) : json['fees'],
    feesSplit: json['fees_split'],
    authorization: json['authorization'] != null
        ? Authorization.fromJson(json['authorization'])
        : null,
    customer:
        json['customer'] != null ? Customer.fromJson(json['customer']) : null,
  );
}