Documentation
¶
Index ¶
- type CreateRegistrationFlowEndpoint
- type CreateRegistrationFlowRequest
- type DeleteRegistrationFlowEndpoint
- type DeleteRegistrationFlowRequest
- type ListRegistrationFlowsEndpoint
- type ListRegistrationFlowsRequest
- type RegisterCustomerEndpoint
- type RegisterCustomerRequest
- type RegistrationFlowSvc
- type RegistrationFlowSvcConfig
- type RetrieveRegistrationFlowBySlugEndpoint
- type RetrieveRegistrationFlowBySlugRequest
- type RetrieveRegistrationFlowEndpoint
- type RetrieveRegistrationFlowRequest
- type UpdateRegistrationFlowEndpoint
- type UpdateRegistrationFlowRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRegistrationFlowEndpoint ¶
type CreateRegistrationFlowEndpoint struct{}
Creates a registration flow defining the customer group, payment term, and shipping term options offered during customer self-registration.
func (*CreateRegistrationFlowEndpoint) Materialize ¶
func (e *CreateRegistrationFlowEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateRegistrationFlowRequest, *apiresource.RegistrationFlow]
type CreateRegistrationFlowRequest ¶
type CreateRegistrationFlowRequest struct {
// Display name of the registration flow.
Name string `json:"name" validate:"required,max=255"`
// IDs of the customer groups offered as options in this flow.
CustomerGroupIDs []string `json:"customer_group_ids,omitzero"`
// IDs of the payment terms offered as options in this flow.
PaymentTermIDs []string `json:"payment_term_ids,omitzero"`
// IDs of the shipping terms offered as options in this flow.
ShippingTermIDs []string `json:"shipping_term_ids,omitzero"`
}
Request to create a registration flow.
func (*CreateRegistrationFlowRequest) SchemaExample ¶
func (*CreateRegistrationFlowRequest) SchemaExample() any
type DeleteRegistrationFlowEndpoint ¶
type DeleteRegistrationFlowEndpoint struct{}
Deletes a registration flow.
func (*DeleteRegistrationFlowEndpoint) Materialize ¶
func (e *DeleteRegistrationFlowEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteRegistrationFlowRequest, *apiresource.EmptyResource]
type DeleteRegistrationFlowRequest ¶
type DeleteRegistrationFlowRequest struct {
// Registration flow ID.
RegistrationFlowID string `path:"id" validate:"required"`
}
Request to delete a registration flow.
type ListRegistrationFlowsEndpoint ¶
type ListRegistrationFlowsEndpoint struct{}
Returns a paginated list of registration flows for the current account.
func (*ListRegistrationFlowsEndpoint) Materialize ¶
func (e *ListRegistrationFlowsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListRegistrationFlowsRequest, *apiresource.List[apiresource.RegistrationFlow]]
type ListRegistrationFlowsRequest ¶
type ListRegistrationFlowsRequest struct {
apiresource.PaginationRequest
}
Request to list registration flows.
type RegisterCustomerEndpoint ¶
type RegisterCustomerEndpoint struct{}
Registers the authenticated user as a customer of a seller account.
Either links the user to an existing customer account by customer number, or creates a new customer account with the provided details and links the user to it. A new customer account takes the authenticated user's email address as its contact email, and either way the seller's customer-service contacts are notified that a buyer has registered.
func (*RegisterCustomerEndpoint) Materialize ¶
func (e *RegisterCustomerEndpoint) Materialize() *apiendpoint.APIEndpoint[*RegisterCustomerRequest, *apiresource.EmptyResource]
type RegisterCustomerRequest ¶
type RegisterCustomerRequest struct {
// Slug of the seller account the customer is registering with.
AccountSlug string `json:"account_slug" validate:"required"`
// Whether the registrant is an existing customer of the seller account.
//
// When `true`, the registering user is linked to the customer account matching `customer_number`. When `false`, a new customer account is created and `customer_name`, `customer_group_id`, `address`, `shipping_term_id`, and `payment_term_id` are required.
IsExistingCustomer bool `json:"is_existing_customer"`
// Customer number identifying the existing customer account.
//
// Required when `is_existing_customer` is `true`; ignored otherwise. New customers are assigned the seller's next customer number automatically.
CustomerNumber field.Optional[string] `json:"customer_number,omitzero"`
// Name for the new customer account.
//
// Required when registering as a new customer.
CustomerName field.Optional[string] `json:"customer_name,omitzero"`
// ID of the customer group to place the new customer in.
//
// Required when registering as a new customer.
CustomerGroupID field.Optional[string] `json:"customer_group_id,omitzero"`
// Contact phone number for the new customer.
Phone field.Optional[string] `json:"phone,omitzero"`
// Address for the new customer account.
//
// Required when registering as a new customer.
Address field.Optional[apirequest.AddressInput] `json:"address,omitzero"`
// ID of the shipping term assigned to the new customer.
//
// Required when registering as a new customer.
ShippingTermID field.Optional[string] `json:"shipping_term_id,omitzero"`
// ID of the payment term assigned to the new customer.
//
// Required when registering as a new customer.
PaymentTermID field.Optional[string] `json:"payment_term_id,omitzero"`
}
Request to register a new or existing customer.
func (*RegisterCustomerRequest) SchemaExample ¶
func (*RegisterCustomerRequest) SchemaExample() any
type RegistrationFlowSvc ¶
type RegistrationFlowSvc interface {
ListRegistrationFlows(ctx context.Context, req *ListRegistrationFlowsRequest) (*apiresource.List[apiresource.RegistrationFlow], *apierror.APIError)
GetRegistrationFlow(ctx context.Context, req *RetrieveRegistrationFlowRequest) (*apiresource.RegistrationFlow, *apierror.APIError)
CreateRegistrationFlow(ctx context.Context, req *CreateRegistrationFlowRequest) (*apiresource.RegistrationFlow, *apierror.APIError)
UpdateRegistrationFlow(ctx context.Context, req *UpdateRegistrationFlowRequest) (*apiresource.RegistrationFlow, *apierror.APIError)
DeleteRegistrationFlow(ctx context.Context, req *DeleteRegistrationFlowRequest) (*apiresource.EmptyResource, *apierror.APIError)
GetRegistrationFlowBySlug(ctx context.Context, req *RetrieveRegistrationFlowBySlugRequest) (*apiresource.RegistrationFlow, *apierror.APIError)
RegisterCustomer(ctx context.Context, req *RegisterCustomerRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewRegistrationFlowSvc ¶
func NewRegistrationFlowSvc(config *RegistrationFlowSvcConfig) RegistrationFlowSvc
type RegistrationFlowSvcConfig ¶
type RegistrationFlowSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type RetrieveRegistrationFlowBySlugEndpoint ¶
type RetrieveRegistrationFlowBySlugEndpoint struct{}
Returns the registration flow of the account with the given slug.
This is how a customer-facing registration page discovers which customer groups, payment terms, and shipping terms a seller offers, without needing the seller's registration flow ID. If the account has several flows only one of them is returned, and an account with no flow is reported as not found.
func (*RetrieveRegistrationFlowBySlugEndpoint) Materialize ¶
func (e *RetrieveRegistrationFlowBySlugEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveRegistrationFlowBySlugRequest, *apiresource.RegistrationFlow]
type RetrieveRegistrationFlowBySlugRequest ¶
type RetrieveRegistrationFlowBySlugRequest struct {
// Slug of the account whose registration flow to retrieve.
Slug string `path:"slug" validate:"required"`
}
Request to retrieve a registration flow by account slug.
type RetrieveRegistrationFlowEndpoint ¶
type RetrieveRegistrationFlowEndpoint struct{}
Returns a registration flow by ID.
func (*RetrieveRegistrationFlowEndpoint) Materialize ¶
func (e *RetrieveRegistrationFlowEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveRegistrationFlowRequest, *apiresource.RegistrationFlow]
type RetrieveRegistrationFlowRequest ¶
type RetrieveRegistrationFlowRequest struct {
// Registration flow ID.
RegistrationFlowID string `path:"id" validate:"required"`
}
Request to retrieve a registration flow.
type UpdateRegistrationFlowEndpoint ¶
type UpdateRegistrationFlowEndpoint struct{}
Partially updates a registration flow.
func (*UpdateRegistrationFlowEndpoint) Materialize ¶
func (e *UpdateRegistrationFlowEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateRegistrationFlowRequest, *apiresource.RegistrationFlow]
type UpdateRegistrationFlowRequest ¶
type UpdateRegistrationFlowRequest struct {
// Registration flow ID.
RegistrationFlowID string `path:"id" validate:"required"`
// Display name of the registration flow.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// IDs of the customer groups to set as this flow's options.
//
// Ignored unless `has_customer_group_ids` is `true`.
CustomerGroupIDs []string `json:"customer_group_ids,omitzero"`
// IDs of the payment terms to set as this flow's options.
//
// Ignored unless `has_payment_term_ids` is `true`.
PaymentTermIDs []string `json:"payment_term_ids,omitzero"`
// IDs of the shipping terms to set as this flow's options.
//
// Ignored unless `has_shipping_term_ids` is `true`.
ShippingTermIDs []string `json:"shipping_term_ids,omitzero"`
// Whether to replace the flow's customer group options with `customer_group_ids`.
//
// When `true`, existing options are cleared and replaced (an empty list removes all options). When `false` or omitted, customer group options are left unchanged.
HasCustomerGroupIDs bool `json:"has_customer_group_ids,omitzero"`
// Whether to replace the flow's payment term options with `payment_term_ids`.
//
// When `true`, existing options are cleared and replaced (an empty list removes all options). When `false` or omitted, payment term options are left unchanged.
HasPaymentTermIDs bool `json:"has_payment_term_ids,omitzero"`
// Whether to replace the flow's shipping term options with `shipping_term_ids`.
//
// When `true`, existing options are cleared and replaced (an empty list removes all options). When `false` or omitted, shipping term options are left unchanged.
HasShippingTermIDs bool `json:"has_shipping_term_ids,omitzero"`
}
Request to partially update a registration flow.
func (*UpdateRegistrationFlowRequest) SchemaExample ¶
func (*UpdateRegistrationFlowRequest) SchemaExample() any