Payment.fromJson constructor

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

Implementation

factory Payment.fromJson(Map<String, Object?> json) => Payment(
      id: json["id"] as String,
      status: Status.fromJson(json["status"]),
      statementDescriptor: json["statement_descriptor"] as String,
      amount: inttegro_money.Amount.fromJson(
          (json["amount"] as Map).cast<String, Object?>()),
      billingDetails: json["billing_details"] == null
          ? null
          : BillingDetails.fromJson(
              (json["billing_details"] as Map).cast<String, Object?>(),
            ),
      balanceTransaction: json["balance_transaction"] == null
          ? null
          : inttegro_balance_transaction.BalanceTransaction.fromJson(
              (json["balance_transaction"] as Map).cast<String, Object?>(),
            ),
      paymentMethod: json["payment_method"] == null
          ? null
          : inttegro_payment_method.Snapshot.fromJson(
              (json["payment_method"] as Map).cast<String, Object?>(),
            ),
      customer: json["customer"] == null
          ? null
          : Customer.fromJson(
              (json["customer"] as Map).cast<String, Object?>(),
            ),
      receipt: json["receipt"] == null
          ? null
          : inttegro_order.Receipt.fromJson(
              (json["receipt"] as Map).cast<String, Object?>(),
            ),
      latestAttempt: json["latest_attempt"] == null
          ? null
          : Attempt.fromJson(
              (json["latest_attempt"] as Map).cast<String, Object?>(),
            ),
      nextAction: json["next_action"] == null
          ? null
          : NextAction.fromJson(
              (json["next_action"] as Map).cast<String, Object?>(),
            ),
      latestError: json["latest_error"] == null
          ? null
          : Error.fromJson(
              (json["latest_error"] as Map).cast<String, Object?>(),
            ),
      initiatedAt: decodeDateTime(json["initiated_at"]),
      executedAt: json["executed_at"] == null
          ? null
          : decodeDateTime(json["executed_at"]),
      paidAt:
          json["paid_at"] == null ? null : decodeDateTime(json["paid_at"]),
      canceledAt: json["canceled_at"] == null
          ? null
          : decodeDateTime(json["canceled_at"]),
      dueAt: json["due_at"] == null ? null : decodeDateTime(json["due_at"]),
      expiredAt: json["expired_at"] == null
          ? null
          : decodeDateTime(json["expired_at"]),
      failedAt: json["failed_at"] == null
          ? null
          : decodeDateTime(json["failed_at"]),
      paidOffline:
          json["paid_offline"] == null ? null : json["paid_offline"] as bool,
      paymentMethodTypes: json["payment_method_types"] == null
          ? null
          : (json["payment_method_types"] as List)
              .map((item) => item as String)
              .toList(),
      payoutConfiguration: json["payout_configuration"] == null
          ? null
          : inttegro_payout.PaymentConfiguration.fromJson(
              (json["payout_configuration"] as Map).cast<String, Object?>(),
            ),
    );