# `LatticeStripe.Quote`
[🔗](https://github.com/szTheory/lattice_stripe/blob/v2.2.2/lib/lattice_stripe/quote.ex#L1)

Operations on Stripe Quote objects.

> #### Name shadowing {: .warning}
>
> `alias LatticeStripe.Quote` makes the bare atom `Quote` refer to this module. It does
> not break the `quote/1` special form, which is lowercase, but it does shadow Elixir's
> `Quote`-prefixed references. Prefer fully qualifying, or alias under another name:
>
>     alias LatticeStripe.Quote, as: StripeQuote

Quotes model a proposal before it becomes billable downstream Stripe objects.
LatticeStripe exposes the Stripe-shaped Quote resource surface directly:
create and iterate on a draft, finalize it into an open quote, optionally
inspect or download its PDF, then accept or cancel it with explicit verbs.

## Lifecycle

```
draft --> (finalize) --> open --> (accept) --> accepted
    \                      \
     \                      (cancel) --> canceled
      \
       (cancel) --> canceled
```

Accepting a quote may create downstream billing objects such as an Invoice,
Subscription, or SubscriptionSchedule. This module intentionally stops at the
Stripe resource boundary and does not add application-level orchestration or
prediction helpers.

## Line-item surfaces

Quotes expose three different line-item views:

- `quote.line_items` and `quote.computed.*.line_items` are embedded snapshots
- `list_line_items/4` returns the paginated quoted-input line items
- `list_computed_upfront_line_items/4` returns the paginated upfront-only
  computed line items

## PDF access

`pdf/3` returns raw PDF binary, not a `%Quote{}`. Stripe only generates PDFs
for shareable/finalized states, so `draft` and `canceled` quote PDF requests
may return 404.

# `t`

```elixir
@type t() :: %LatticeStripe.Quote{
  amount_subtotal: integer() | nil,
  amount_total: integer() | nil,
  application: String.t() | nil,
  application_fee_amount: integer() | nil,
  application_fee_percent: float() | integer() | nil,
  automatic_tax: map() | nil,
  collection_method: atom() | String.t() | nil,
  computed: LatticeStripe.Quote.Computed.t() | nil,
  created: integer() | nil,
  currency: String.t() | nil,
  customer: LatticeStripe.Customer.t() | String.t() | nil,
  default_tax_rates: list() | nil,
  description: String.t() | nil,
  discounts: list() | nil,
  expires_at: integer() | nil,
  extra: map(),
  footer: String.t() | nil,
  from_quote: map() | nil,
  header: String.t() | nil,
  id: String.t() | nil,
  invoice: LatticeStripe.Invoice.t() | String.t() | nil,
  invoice_settings: map() | nil,
  line_items: LatticeStripe.List.t() | nil,
  livemode: boolean() | nil,
  metadata: map() | nil,
  number: String.t() | nil,
  object: String.t(),
  on_behalf_of: String.t() | nil,
  status: atom() | String.t() | nil,
  status_transitions: LatticeStripe.Quote.StatusTransitions.t() | nil,
  subscription: LatticeStripe.Subscription.t() | String.t() | nil,
  subscription_data: map() | nil,
  subscription_schedule:
    LatticeStripe.SubscriptionSchedule.t() | String.t() | nil,
  test_clock: String.t() | nil,
  total_details: map() | nil,
  transfer_data: map() | nil
}
```

# `accept`

```elixir
@spec accept(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Accepts an open quote.

Accepting a quote is a terminal lifecycle transition that may generate
downstream Stripe billing objects such as an Invoice, Subscription, or
SubscriptionSchedule.

# `accept!`

```elixir
@spec accept!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()
```

Like `accept/3` but raises on failure.

# `cancel`

```elixir
@spec cancel(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Cancels a draft or open quote.

This is a terminal lifecycle transition. Stripe documents no request params for
this endpoint, so the public API is intentionally parameterless apart from
per-request opts.

# `cancel!`

```elixir
@spec cancel!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()
```

Like `cancel/3` but raises on failure.

# `create`

```elixir
@spec create(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Creates a Quote.

# `create!`

```elixir
@spec create!(LatticeStripe.Client.t(), map(), keyword()) :: t()
```

Like `create/3` but raises on failure.

# `finalize`

```elixir
@spec finalize(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Finalizes a draft quote and transitions it to `open`.

Stripe accepts optional finalize-time params, so this function preserves the
raw request map instead of constraining it locally.

# `finalize!`

```elixir
@spec finalize!(LatticeStripe.Client.t(), String.t(), map(), keyword()) :: t()
```

Like `finalize/4` but raises on failure.

# `from_map`

```elixir
@spec from_map(map() | nil) :: t() | nil
```

# `list`

```elixir
@spec list(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}
```

Lists Quotes with optional filters.

# `list!`

```elixir
@spec list!(LatticeStripe.Client.t(), map(), keyword()) :: LatticeStripe.Response.t()
```

Like `list/3` but raises on failure.

# `list_computed_upfront_line_items`

```elixir
@spec list_computed_upfront_line_items(
  LatticeStripe.Client.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}
```

Lists the computed upfront-only line items for a Quote.

# `list_computed_upfront_line_items!`

```elixir
@spec list_computed_upfront_line_items!(
  LatticeStripe.Client.t(),
  String.t(),
  map(),
  keyword()
) ::
  LatticeStripe.Response.t()
```

Like `list_computed_upfront_line_items/4` but raises on failure.

# `list_line_items`

```elixir
@spec list_line_items(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}
```

Lists the quoted-input line items for a Quote.

# `list_line_items!`

```elixir
@spec list_line_items!(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  LatticeStripe.Response.t()
```

Like `list_line_items/4` but raises on failure.

# `pdf`

```elixir
@spec pdf(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, binary()} | {:error, LatticeStripe.Error.t()}
```

Downloads a Quote PDF as raw binary.

This calls Stripe's binary PDF endpoint and unwraps the transport `%Response{}`
into `{:ok, binary}` at the resource layer.

Stripe may return 404 for `draft` and `canceled` quotes because PDFs are only
available for shareable/finalized states.

# `pdf!`

```elixir
@spec pdf!(LatticeStripe.Client.t(), String.t(), keyword()) :: binary()
```

Like `pdf/3` but raises on failure.

# `retrieve`

```elixir
@spec retrieve(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Retrieves a Quote by ID.

# `retrieve!`

```elixir
@spec retrieve!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()
```

Like `retrieve/3` but raises on failure.

# `stream!`

```elixir
@spec stream!(LatticeStripe.Client.t(), map(), keyword()) :: Enumerable.t()
```

Returns a lazy stream of Quotes matching the given filters.

# `stream_computed_upfront_line_items!`

```elixir
@spec stream_computed_upfront_line_items!(
  LatticeStripe.Client.t(),
  String.t(),
  map(),
  keyword()
) ::
  Enumerable.t()
```

Returns a lazy stream of computed upfront-only line items for a Quote.

# `stream_line_items!`

```elixir
@spec stream_line_items!(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  Enumerable.t()
```

Returns a lazy stream of quoted-input line items for a Quote.

# `update`

```elixir
@spec update(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}
```

Updates a Quote by ID.

# `update!`

```elixir
@spec update!(LatticeStripe.Client.t(), String.t(), map(), keyword()) :: t()
```

Like `update/4` but raises on failure.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
