OpenPayments.Types.IncomingPaymentWithMethods (open_payments_elixir v1.0.0)

Copy Markdown View Source

Detailed incoming-payment data with the payment methods required by create and authenticated read responses.

Follows incoming-payment-with-access-token: all IncomingPayment detail fields plus required unique methods, decoded as typed ILPPaymentMethod structs. Empty arrays are allowed. Fields remain flat on this struct; detail validation is shared with IncomingPayment. Method uniqueness compares complete protocol objects, preserving entry order.

Optional fields distinguish omission from explicit null, and permitted JSON extensions are retained. authServer is not required by this schema and remains extension data if supplied. URI/timestamp spelling is preserved without asset, amount or chronological comparisons. Operation-level checks are separate.

Inspection omits methods, amounts, metadata and extensions. Explicit map/JSON exports include ILP shared secrets and all protocol data. Errors retain safe field/index paths. This codec makes no requests or STREAM connections. Validate modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes the detailed payment and its required array of typed payment methods.

Converts to protocol fields, including method secrets, without validating.

Revalidates all detail fields, typed methods, uniqueness and extension data.

Types

t()

@type t() :: %OpenPayments.Types.IncomingPaymentWithMethods{
  completed: boolean(),
  created_at: String.t(),
  expires_at: String.t() | nil,
  extensions: %{optional(String.t()) => term()},
  id: String.t(),
  incoming_amount: OpenPayments.Types.Amount.t() | nil,
  metadata: %{optional(String.t()) => term()} | nil,
  methods: [OpenPayments.Types.ILPPaymentMethod.t()],
  received_amount: OpenPayments.Types.Amount.t(),
  wallet_address: String.t()
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes the detailed payment and its required array of typed payment methods.

to_map(payment)

@spec to_map(t()) :: map()

Converts to protocol fields, including method secrets, without validating.

validate(payment)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Revalidates all detail fields, typed methods, uniqueness and extension data.