Documentation
¶
Index ¶
- type DeleteTransactionAllocationEndpoint
- type DeleteTransactionAllocationRequest
- type ListAllocationEntriesEndpoint
- type ListAllocationEntriesRequest
- type ListOpenCreditsEndpoint
- type ListOpenCreditsRequest
- type TransactionAllocationSvc
- type TransactionAllocationSvcConfig
- type UpdateTransactionAllocationEndpoint
- type UpdateTransactionAllocationRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteTransactionAllocationEndpoint ¶
type DeleteTransactionAllocationEndpoint struct{}
Removes the application of a transaction's money to one invoice, leaving both the transaction and the invoice in place.
Payment roll-ups are left alone: the transaction's `is_fully_allocated` flag and the invoice's paid-in-full status keep their previous values, so set `is_fully_allocated` to `false` with Update Transaction to return the freed amount to the open credits list.
func (*DeleteTransactionAllocationEndpoint) Materialize ¶
func (e *DeleteTransactionAllocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteTransactionAllocationRequest, *apiresource.EmptyResource]
type DeleteTransactionAllocationRequest ¶
type DeleteTransactionAllocationRequest struct {
// Transaction allocation ID.
AllocationID string `path:"id" validate:"required"`
}
Request to delete a transaction allocation.
type ListAllocationEntriesEndpoint ¶
type ListAllocationEntriesEndpoint struct{}
Returns a paginated list of the individual applications of transaction money to invoices, newest first.
Each entry pairs one transaction with one invoice and the amount applied. Entries are created by recording a settlement; there is no endpoint that creates one directly. Free-text search matches the invoice number and the transaction number.
func (*ListAllocationEntriesEndpoint) Materialize ¶
func (e *ListAllocationEntriesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListAllocationEntriesRequest, *apiresource.List[apiresource.AllocationEntry]]
type ListAllocationEntriesRequest ¶
type ListAllocationEntriesRequest struct {
apiresource.PaginationRequest
// Filter by the underlying transaction's type code.
TransactionType *constants.TransactionType `query:"transaction_type"`
// Only include allocations created on or after this date (`YYYY-MM-DD`).
StartDate *string `query:"starts_at"`
// Only include allocations created on or before this date (`YYYY-MM-DD`), covering that whole day.
EndDate *string `query:"ends_at"`
}
Request to list transaction allocation entries.
type ListOpenCreditsEndpoint ¶
type ListOpenCreditsEndpoint struct{}
Returns a paginated list of customer transactions that still have money left to apply to invoices, newest first.
Membership is driven by each transaction's `is_fully_allocated` flag rather than by a recomputed balance, so a transaction remains listed until that flag is set. Free-text search matches the transaction ID, transaction number, customer name, and note.
func (*ListOpenCreditsEndpoint) Materialize ¶
func (e *ListOpenCreditsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListOpenCreditsRequest, *apiresource.List[apiresource.OpenCreditEntry]]
type ListOpenCreditsRequest ¶
type ListOpenCreditsRequest struct {
apiresource.PaginationRequest
// 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"`
// Filter by customer account IDs.
CustomerIDs []string `query:"customer_ids"`
}
Request to list open credit transactions.
type TransactionAllocationSvc ¶
type TransactionAllocationSvc interface {
ListAllocationEntries(ctx context.Context, req *ListAllocationEntriesRequest) (*apiresource.List[apiresource.AllocationEntry], *apierror.APIError)
UpdateTransactionAllocation(ctx context.Context, req *UpdateTransactionAllocationRequest) (*apiresource.TransactionAllocation, *apierror.APIError)
DeleteTransactionAllocation(ctx context.Context, req *DeleteTransactionAllocationRequest) (*apiresource.EmptyResource, *apierror.APIError)
ListOpenCredits(ctx context.Context, req *ListOpenCreditsRequest) (*apiresource.List[apiresource.OpenCreditEntry], *apierror.APIError)
}
func NewTransactionAllocationSvc ¶
func NewTransactionAllocationSvc(config *TransactionAllocationSvcConfig) TransactionAllocationSvc
type TransactionAllocationSvcConfig ¶
type TransactionAllocationSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type UpdateTransactionAllocationEndpoint ¶
type UpdateTransactionAllocationEndpoint struct{}
Changes how much of a transaction is applied to the invoice it was allocated to.
Only the amount can be changed; the transaction and invoice the allocation links are fixed. Payment roll-ups are left alone, so the transaction's `is_fully_allocated` flag and the invoice's paid-in-full status keep their previous values.
func (*UpdateTransactionAllocationEndpoint) Materialize ¶
func (e *UpdateTransactionAllocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateTransactionAllocationRequest, *apiresource.TransactionAllocation]
type UpdateTransactionAllocationRequest ¶
type UpdateTransactionAllocationRequest struct {
// Transaction allocation ID.
AllocationID string `path:"id" validate:"required"`
// New amount of the transaction to apply to this invoice, as a decimal string in US dollars.
//
// The new amount is not checked against the transaction's total or the invoice's balance.
Amount field.Optional[string] `json:"amount,omitzero"`
}
Request to update a transaction allocation.
func (*UpdateTransactionAllocationRequest) SchemaExample ¶
func (*UpdateTransactionAllocationRequest) SchemaExample() any