settlementep

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSettlementAllocationRequest

type CreateSettlementAllocationRequest struct {
	// ID of the transaction (payment, rebate, adjustment, or credit memo) to allocate from.
	TransactionID string `json:"transaction_id" validate:"required"`
	// ID of the invoice the amount is applied to.
	InvoiceID string `json:"invoice_id" validate:"required"`
	// The part of the transaction's amount to apply to this invoice, as a decimal string in US dollars.
	//
	// This is not checked against the transaction's unallocated balance or the invoice's outstanding total; applying more than an invoice owes leaves that invoice `overpaid`.
	Amount string `json:"amount" validate:"required"`
	// Free-form note about this allocation.
	Note field.Optional[string] `json:"note,omitzero"`
}

A single allocation applying part of a transaction's amount to an invoice.

type CreateSettlementEndpoint

type CreateSettlementEndpoint struct{}

Creates a settlement that applies transaction amounts to invoices.

The settlement number is generated automatically from a per-account sequence.

Once the settlement is recorded, every transaction it drew from is marked fully allocated even if only part of its amount was applied, which drops it out of List Open Credits. Each invoice it touched has its paid-in-full and overpaid flags — and therefore its `payment_status` — recomputed from every allocation recorded against that invoice, including allocations made by other settlements.

func (*CreateSettlementEndpoint) Materialize

type CreateSettlementRequest

type CreateSettlementRequest struct {
	// ID of the user responsible for this settlement.
	//
	// Accepts either an account user ID or a user ID; the value is resolved to an account user in the current account.
	ResponsibleUserID string `json:"responsible_user_id" validate:"required"`
	// Allocations to record in this settlement.
	Allocations []CreateSettlementAllocationRequest `json:"allocations" validate:"required,min=1"`
}

Request to create a settlement.

func (*CreateSettlementRequest) SchemaExample

func (*CreateSettlementRequest) SchemaExample() any

type DeleteSettlementEndpoint

type DeleteSettlementEndpoint struct{}

Deletes a settlement and all of its allocations.

Every transaction the settlement drew from is marked not fully allocated, so it reappears in List Open Credits even when allocations from other settlements already cover its full amount.

Every invoice the settlement touched has its paid-in-full and overpaid flags cleared rather than recomputed, so its `payment_status` returns to `unpaid` even when other settlements still pay it off; those flags are only recomputed the next time a settlement allocates to that invoice.

Adjustment transactions referenced only by this settlement are deleted along with it.

func (*DeleteSettlementEndpoint) Materialize

type DeleteSettlementRequest

type DeleteSettlementRequest struct {
	// Settlement ID.
	SettlementID string `path:"id" validate:"required"`
}

Request to delete a settlement.

type ListSettlementsEndpoint

type ListSettlementsEndpoint struct{}

Returns a paginated list of settlements, newest first.

Each entry is a condensed view that summarizes the settlement's allocations as totals per transaction type instead of listing them; retrieve a settlement to see its individual allocations. Filtering by `transaction_ids` or `invoice_ids` also narrows each entry's aggregates to just the matching allocations, and when both are supplied a settlement matches only if one of its allocations satisfies both.

type ListSettlementsRequest

type ListSettlementsRequest struct {
	apiresource.PaginationRequest
	// Only return settlements that allocate at least one of these transactions.
	TransactionIDs []string `query:"transaction_ids"`
	// Only return settlements that allocate to at least one of these invoices.
	InvoiceIDs []string `query:"invoice_ids"`
	// Only return settlements created on or after the start of this date (`YYYY-MM-DD`, UTC).
	StartDate *string `query:"starts_at"`
	// Only return settlements created on or before this date (`YYYY-MM-DD`, UTC), covering that whole day.
	EndDate *string `query:"ends_at"`
}

Request to list settlements.

type RetrieveSettlementEndpoint

type RetrieveSettlementEndpoint struct{}

Returns a settlement by ID.

func (*RetrieveSettlementEndpoint) Materialize

type RetrieveSettlementRequest

type RetrieveSettlementRequest struct {
	// Settlement ID.
	SettlementID string `path:"id" validate:"required"`
	// Sub-resources to include in the response.
	Includes []string `include:"true"`
}

Request to retrieve a settlement.

type SettlementSvcConfig

type SettlementSvcConfig struct {
	// CoreClient (required) is the core-service gRPC client.
	CoreClient pb.CoreServiceClient
}

type UpdateSettlementEndpoint

type UpdateSettlementEndpoint struct{}

Partially updates a settlement's number, note, or responsible user.

The allocations a settlement contains cannot be changed here; use the transaction allocation endpoints to amend or remove an individual allocation.

func (*UpdateSettlementEndpoint) Materialize

type UpdateSettlementRequest

type UpdateSettlementRequest struct {
	// Settlement ID.
	SettlementID string `path:"id" validate:"required"`
	// New settlement number.
	//
	// Must be unique within the account.
	Number field.Optional[string] `json:"number,omitzero" validate:"omitempty,max=255"`
	// Note for this settlement.
	Note field.Optional[string] `json:"note,omitzero"`
	// ID of the user responsible for this settlement.
	//
	// Accepts either an account user ID or a user ID; the value is resolved to an account user in the current account.
	ResponsibleUserID field.Optional[string] `json:"responsible_user_id,omitzero" validate:"omitempty"`
}

Request to partially update a settlement.

func (*UpdateSettlementRequest) SchemaExample

func (*UpdateSettlementRequest) SchemaExample() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL