transactionep

package
v1.1.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransactionDetailPresenter

func TransactionDetailPresenter(ctx context.Context, d *pb.TransactionInfo) apiresource.TransactionDetail

TransactionDetailPresenter builds the transaction detail resource and stashes the expandable sub-resource data (customer FK, responsible_user FK, allocations) in the request-scoped LoadMeta so the include resolver can populate them when requested. Expandable fields stay nil here — never fabricated.

Types

type CreateTransactionEndpoint

type CreateTransactionEndpoint struct{}

Records a financial transaction against a customer, such as a payment received, a credit memo, an adjustment, or a rebate.

The transaction number is assigned automatically from the account's transaction sequence. The new transaction starts out unapplied, so it shows up as an open credit until it is applied to invoices by recording a settlement.

type CreateTransactionRequest

type CreateTransactionRequest struct {
	// ID of the customer the transaction is recorded against.
	CustomerID string `json:"customer_id" validate:"required"`
	// Transaction type code.
	//
	// - `payment`: money received from the customer.
	// - `credit_memo`: a credit issued to the customer.
	// - `adjustment`: a manual correction (also provide `adjustment_type`).
	// - `rebate`: a rebate granted to the customer.
	TransactionTypeCode constants.TransactionType `json:"type" validate:"required"`
	// Transaction amount as a decimal string, in US dollars.
	Amount string `json:"amount" validate:"required"`
	// How the money moved.
	//
	// Typically provided for payment transactions.
	TransactionMethodCode field.Optional[constants.TransactionMethod] `json:"method,omitzero" validate:"omitempty"`
	// The kind of correction this transaction represents (see List Adjustment Types for available values).
	//
	// Typically provided when `type` is `adjustment`.
	AdjustmentTypeCode field.Optional[string] `json:"adjustment_type,omitzero" validate:"omitempty,max=255"`
	// ID of the account user responsible for the transaction.
	//
	// When omitted, the account user making the request is recorded as responsible.
	ResponsibleUserID field.Optional[string] `json:"responsible_user_id,omitzero" validate:"omitempty"`
	// Free-form note attached to the transaction.
	Note field.Optional[string] `json:"note,omitzero"`
}

Request to create a transaction.

func (*CreateTransactionRequest) SchemaExample

func (*CreateTransactionRequest) SchemaExample() any

type DeleteTransactionEndpoint

type DeleteTransactionEndpoint struct{}

Deletes a transaction along with every allocation that applied it to an invoice, and returns the deleted transaction.

Invoice payment status is not recomputed, so an invoice this transaction had paid off stays marked paid in full until the next settlement against it recalculates the flag. Deleting a transaction that was already deleted returns an already-deleted error rather than a not-found error.

type DeleteTransactionRequest

type DeleteTransactionRequest struct {
	// Transaction ID.
	TransactionID string `path:"id" validate:"required"`
}

Request to delete a transaction.

type ListAccountTransactionsEndpoint

type ListAccountTransactionsEndpoint struct{}

Returns a paginated list of the transactions recorded against one customer account, newest first.

Transactions recorded against that customer's child accounts are included by default. Free-text search matches the transaction number and note.

type ListAccountTransactionsRequest

type ListAccountTransactionsRequest struct {
	apiresource.PaginationRequest
	// Customer account ID.
	CustomerAccountID string `path:"account_id" validate:"required"`
	// Filter by allocation status: `allocated` (marked fully applied to invoices) or `unallocated` (still counted as an open credit).
	Status *constants.TransactionAllocationStatus `query:"status"`
	// Filter by transaction type code.
	Type *constants.TransactionType `query:"type"`
}

Request to list transactions for a customer account.

type ListAdjustmentTypesEndpoint

type ListAdjustmentTypesEndpoint struct{}

Returns a paginated list of the adjustment categories that can be recorded on an adjustment transaction, such as discounts, fees, and write-offs.

Adjustment types are platform-provided and identical for every account. Free-text search matches the display name.

type ListAdjustmentTypesRequest

type ListAdjustmentTypesRequest struct {
	apiresource.PaginationRequest
}

Request to list adjustment types.

type ListTransactionMethodsEndpoint

type ListTransactionMethodsEndpoint struct{}

Returns the payment methods that can be recorded on a transaction, such as cash, check, and ACH.

The set is fixed by the platform and identical for every account, so the results come back in one page; supplying a pagination cursor returns a validation error. Free-text search matches the display name.

type ListTransactionMethodsRequest

type ListTransactionMethodsRequest struct {
	apiresource.PaginationRequest
}

Request to list transaction methods.

type ListTransactionTypesEndpoint

type ListTransactionTypesEndpoint struct{}

Returns the transaction types that can be recorded against a customer: payments, credit memos, adjustments, and rebates.

The set is fixed by the platform and identical for every account, so the results come back in one page; supplying a pagination cursor returns a validation error. Free-text search matches the display name.

type ListTransactionTypesRequest

type ListTransactionTypesRequest struct {
	apiresource.PaginationRequest
}

Request to list transaction types.

type ListTransactionsEndpoint

type ListTransactionsEndpoint struct{}

Returns a paginated list of transactions for the current account, newest first.

Free-text search matches the transaction number and note.

type ListTransactionsRequest

type ListTransactionsRequest struct {
	apiresource.PaginationRequest
	// Filter by allocation status: `allocated` (marked fully applied to invoices) or `unallocated` (still counted as an open credit).
	Status *constants.TransactionAllocationStatus `query:"status"`
	// Filter by transaction type codes.
	TypeCodes []constants.TransactionType `query:"types"`
	// Filter by adjustment type codes (see List Adjustment Types for available values).
	AdjustmentTypeCodes []string `query:"adjustment_types"`
	// Filter by payment method codes.
	MethodCodes []constants.TransactionMethod `query:"methods"`
	// Filter by customer IDs.
	CustomerIDs []string `query:"customer_ids"`
	// Filter by the account group each customer belongs to.
	CustomerGroupIDs []string `query:"customer_group_ids"`
	// Only include transactions created on or after this date (`YYYY-MM-DD`).
	StartDate *string `query:"starts_at"`
	// Only include transactions created on or before this date (`YYYY-MM-DD`), covering that whole day.
	EndDate *string `query:"ends_at"`
}

Request to list transactions.

type RetrieveTransactionEndpoint

type RetrieveTransactionEndpoint struct{}

Returns a transaction by ID.

type RetrieveTransactionRequest

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

Request to get a transaction.

type TransactionSvcConfig

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

type UpdateTransactionEndpoint

type UpdateTransactionEndpoint struct{}

Updates a transaction, changing only the fields present in the request body.

Changing the amount does not re-apply the transaction to invoices: existing allocations keep their amounts, and neither the transaction's `is_fully_allocated` flag nor the paid-in-full status of any settled invoice is recomputed.

type UpdateTransactionRequest

type UpdateTransactionRequest struct {
	// Transaction ID.
	TransactionID string `path:"id" validate:"required"`
	// New transaction number.
	//
	// Must be unique within the account; the request fails with a conflict error if another transaction already uses it.
	Number field.Optional[string] `json:"number,omitzero" validate:"omitempty,max=255"`
	// Free-form note attached to the transaction.
	Note field.Optional[string] `json:"note,omitzero"`
	// New transaction amount as a decimal string, in US dollars.
	Amount field.Optional[string] `json:"amount,omitzero"`
	// How the money moved.
	TransactionMethodCode field.Optional[constants.TransactionMethod] `json:"method,omitzero" validate:"omitempty"`
	// The kind of correction this transaction represents (see List Adjustment Types for available values).
	AdjustmentTypeCode field.Optional[string] `json:"adjustment_type,omitzero" validate:"omitempty,max=255"`
	// ID of the account user responsible for the transaction.
	//
	// A user ID is also accepted; the value is resolved to an account user in the current account.
	ResponsibleUserID field.Optional[string] `json:"responsible_user_id,omitzero" validate:"omitempty"`
	// Set to true to clear the responsible user.
	//
	// Takes precedence over `responsible_user_id` if both are provided.
	ClearResponsibleUser bool `json:"clear_responsible_user"`
	// Set to true to clear the transaction method.
	//
	// Takes precedence over `method` if both are provided.
	ClearTransactionMethod bool `json:"clear_transaction_method"`
	// Set to true to clear the adjustment type.
	//
	// Takes precedence over `adjustment_type` if both are provided.
	ClearAdjustmentType bool `json:"clear_adjustment_type"`
	// Whether the full transaction amount has been applied to invoices.
	//
	// Set this to correct the flag by hand: editing or deleting individual allocations never recomputes it. While it is `false`, the transaction is returned by List Open Credits.
	IsFullyAllocated field.Optional[bool] `json:"is_fully_allocated,omitzero"`
}

Request to update a transaction.

func (*UpdateTransactionRequest) SchemaExample

func (*UpdateTransactionRequest) SchemaExample() any

Jump to

Keyboard shortcuts

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