PurchaseIntent.fromJson constructor

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

Implementation

factory PurchaseIntent.fromJson(Map<String, Object?> json) => PurchaseIntent(
      allowVariants: json["allow_variants"] as bool,
      createdAt: decodeDateTime(json["created_at"]),
      expiresAt: json["expires_at"] == null
          ? null
          : decodeDateTime(json["expires_at"]),
      id: json["id"] as String,
      inactiveAt: json["inactive_at"] == null
          ? null
          : decodeDateTime(json["inactive_at"]),
      merchant: json["merchant"] == null
          ? null
          : Merchant.fromJson(
              (json["merchant"] as Map).cast<String, Object?>(),
            ),
      price: json["price"] == null
          ? null
          : Price.fromJson(
              (json["price"] as Map).cast<String, Object?>(),
            ),
      presentation: json["presentation"] == null
          ? null
          : Presentation.fromJson(
              (json["presentation"] as Map).cast<String, Object?>(),
            ),
      product: json["product"] == null
          ? null
          : Product.fromJson(
              (json["product"] as Map).cast<String, Object?>(),
            ),
      quantity: Quantity.fromJson(
        (json["quantity"] as Map).cast<String, Object?>(),
      ),
      status: Status.fromJson(json["status"]),
      updatedAt: json["updated_at"] == null
          ? null
          : decodeDateTime(json["updated_at"]),
      usage: Usage.fromJson(
        (json["usage"] as Map).cast<String, Object?>(),
      ),
      variantSet: json["variant_set"] == null
          ? null
          : VariantSet.fromJson(
              (json["variant_set"] as Map).cast<String, Object?>(),
            ),
    );