BalanceTransaction.fromJson constructor

BalanceTransaction.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory BalanceTransaction.fromJson(
  Map<String, Object?> json,
) =>
    BalanceTransaction(
      amount: Amount.fromJson(
        (json["amount"] as Map).cast<String, Object?>(),
      ),
      allocations: json["allocations"] == null
          ? null
          : (json["allocations"] as List)
              .map(
                (item) => Allocation.fromJson(
                  (item as Map).cast<String, Object?>(),
                ),
              )
              .toList(),
      availableAmount: json["available_amount"] == null
          ? null
          : Amount.fromJson(
              (json["available_amount"] as Map).cast<String, Object?>(),
            ),
      pendingAmount: json["pending_amount"] == null
          ? null
          : Amount.fromJson(
              (json["pending_amount"] as Map).cast<String, Object?>(),
            ),
      spentAmount: json["spent_amount"] == null
          ? null
          : Amount.fromJson(
              (json["spent_amount"] as Map).cast<String, Object?>(),
            ),
      availableAt: json["available_at"] == null
          ? null
          : decodeDateTime(json["available_at"]),
      claimedAt: json["claimed_at"] == null
          ? null
          : decodeDateTime(json["claimed_at"]),
      createdAt: decodeDateTime(json["created_at"]),
      id: json["id"] as String,
      orderId: json["order_id"] == null ? null : json["order_id"] as String,
      paidAt:
          json["paid_at"] == null ? null : decodeDateTime(json["paid_at"]),
      paymentId:
          json["payment_id"] == null ? null : json["payment_id"] as String,
      payoutId:
          json["payout_id"] == null ? null : json["payout_id"] as String,
      payoutConfiguration: json["payout_configuration"] == null
          ? null
          : inttegro_payout.PaymentConfiguration.fromJson(
              (json["payout_configuration"] as Map).cast<String, Object?>(),
            ),
      refundId:
          json["refund_id"] == null ? null : json["refund_id"] as String,
      type: Type.fromJson(json["type"]),
    );