Order.fromJson constructor

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

Implementation

factory Order.fromJson(Map<String, Object?> json) => Order(
      canceledAt: json["canceled_at"] == null
          ? null
          : decodeDateTime(json["canceled_at"]),
      checkoutSettings: json["checkout_settings"] == null
          ? null
          : CheckoutSettings.fromJson(
              (json["checkout_settings"] as Map).cast<String, Object?>(),
            ),
      completedAt: json["completed_at"] == null
          ? null
          : decodeDateTime(json["completed_at"]),
      createdFrom: json["created_from"] == null
          ? null
          : CreatedFrom.fromJson(
              (json["created_from"] as Map).cast<String, Object?>(),
            ),
      customData: json["custom_data"] == null
          ? null
          : core.CustomData.fromJson(json["custom_data"]),
      customer: Customer.fromJson(
        (json["customer"] as Map).cast<String, Object?>(),
      ),
      expiresAt: json["expires_at"] == null
          ? null
          : decodeDateTime(json["expires_at"]),
      id: json["id"] as String,
      initiatedAt: decodeDateTime(json["initiated_at"]),
      invoice: json["invoice"] == null
          ? null
          : Invoice.fromJson(
              (json["invoice"] as Map).cast<String, Object?>(),
            ),
      number: json["number"] == null ? null : json["number"] as String,
      receiptNumber: json["receipt_number"] == null
          ? null
          : json["receipt_number"] as String,
      refunds: json["refunds"] == null
          ? null
          : (json["refunds"] as List)
              .map(
                (item) => inttegro_refund.Refund.fromJson(
                    (item as Map).cast<String, Object?>()),
              )
              .toList(),
      invoiceSettings: json["invoice_settings"] == null
          ? null
          : inttegro_checkout.InvoiceSettings.fromJson(
              (json["invoice_settings"] as Map).cast<String, Object?>(),
            ),
      status: Status.fromJson(json["status"]),
      sealedAt: json["sealed_at"] == null
          ? null
          : decodeDateTime(json["sealed_at"]),
      lineItemGroup: json["line_item_group"] == null
          ? null
          : LineItemGroup.fromJson(
              (json["line_item_group"] as Map).cast<String, Object?>(),
            ),
      payment: json["payment"] == null
          ? null
          : inttegro_payment.Payment.fromJson(
              (json["payment"] as Map).cast<String, Object?>()),
      paidAt:
          json["paid_at"] == null ? null : decodeDateTime(json["paid_at"]),
      paymentDueAt: json["payment_due_at"] == null
          ? null
          : decodeDateTime(json["payment_due_at"]),
      reference:
          json["reference"] == null ? null : json["reference"] as String,
    );