Documentation
¶
Index ¶
- type AccountIntegrationSvc
- type AccountIntegrationSvcConfig
- type CreateAccountIntegrationEndpoint
- type CreateAccountIntegrationRequest
- type DeleteAccountIntegrationEndpoint
- type DeleteAccountIntegrationRequest
- type GetStripePublishableKeyEndpoint
- type GetStripePublishableKeyRequest
- type GetStripeStatusEndpoint
- type GetStripeStatusRequest
- type ListAccountIntegrationsEndpoint
- type ListAccountIntegrationsRequest
- type UpdateAccountIntegrationEndpoint
- type UpdateAccountIntegrationRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountIntegrationSvc ¶
type AccountIntegrationSvc interface {
ListAccountIntegrations(ctx context.Context, req *ListAccountIntegrationsRequest) (*apiresource.List[apiresource.AccountIntegration], *apierror.APIError)
CreateAccountIntegration(ctx context.Context, req *CreateAccountIntegrationRequest) (*apiresource.AccountIntegration, *apierror.APIError)
UpdateAccountIntegration(ctx context.Context, req *UpdateAccountIntegrationRequest) (*apiresource.AccountIntegration, *apierror.APIError)
DeleteAccountIntegration(ctx context.Context, req *DeleteAccountIntegrationRequest) (*apiresource.AccountIntegration, *apierror.APIError)
GetStripePublishableKey(ctx context.Context, req *GetStripePublishableKeyRequest) (*apiresource.StripePublishableKey, *apierror.APIError)
GetStripeStatus(ctx context.Context, req *GetStripeStatusRequest) (*apiresource.StripeStatus, *apierror.APIError)
}
func NewAccountIntegrationSvc ¶
func NewAccountIntegrationSvc(config *AccountIntegrationSvcConfig) AccountIntegrationSvc
type AccountIntegrationSvcConfig ¶
type AccountIntegrationSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type CreateAccountIntegrationEndpoint ¶
type CreateAccountIntegrationEndpoint struct{}
Connects a third-party provider to the account, or replaces the name and credentials of the provider's existing connection.
An account can have at most one integration per `provider`, so calling this again for a provider that is already connected rotates its credentials in place and returns the same integration rather than creating a second one. Credentials are checked for the provider's expected key format, encrypted at rest, and never returned in API responses.
func (*CreateAccountIntegrationEndpoint) Materialize ¶
func (e *CreateAccountIntegrationEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateAccountIntegrationRequest, *apiresource.AccountIntegration]
type CreateAccountIntegrationRequest ¶
type CreateAccountIntegrationRequest struct {
// Display name of the integration.
Name string `json:"name" validate:"required,max=255"`
// Integration provider code.
//
// - `stripe`: Stripe payment processing.
// - `shippo`: Shippo shipping and label generation.
// - `hubspot`: HubSpot CRM.
IntegrationCode constants.IntegrationCode `json:"provider" validate:"required"`
// JSON string containing the provider's credentials.
//
// Required keys depend on the provider:
//
// - `stripe`: `private_key` (`sk_...`), `publishable_key` (`pk_...`), and `webhook_secret` (`whsec_...`).
// - `shippo`: `api_key` (`shippo_live_...` or `shippo_test_...`).
// - `hubspot`: `access_token` (`pat-...`).
//
// For Stripe and Shippo, sandbox accounts must supply test keys and production accounts must supply live keys; credentials that do not match are rejected. HubSpot tokens make no such distinction.
Credentials string `json:"credentials" validate:"required" sensitive:"true"`
}
Request to create or upsert an account integration.
func (*CreateAccountIntegrationRequest) SchemaExample ¶
func (*CreateAccountIntegrationRequest) SchemaExample() any
type DeleteAccountIntegrationEndpoint ¶
type DeleteAccountIntegrationEndpoint struct{}
Disconnects a third-party provider from the account and returns the deleted integration.
The stored credentials go with it, so any feature that relies on the provider stops working until the integration is created again. Deleting an integration that is already deleted returns an error rather than succeeding silently. To pause a provider without discarding its credentials, set the integration's status to `inactive` instead.
func (*DeleteAccountIntegrationEndpoint) Materialize ¶
func (e *DeleteAccountIntegrationEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteAccountIntegrationRequest, *apiresource.AccountIntegration]
type DeleteAccountIntegrationRequest ¶
type DeleteAccountIntegrationRequest struct {
// Account integration ID.
AccountIntegrationID string `path:"id" validate:"required"`
}
Request to delete an account integration.
type GetStripePublishableKeyEndpoint ¶
type GetStripePublishableKeyEndpoint struct{}
Returns the Stripe publishable key for the target account, for initializing Stripe in a client-side checkout.
Only the publishable key is exposed; the account's secret key and webhook secret never leave the platform. Fails if the account has no Stripe integration or the Stripe integration is inactive.
func (*GetStripePublishableKeyEndpoint) Materialize ¶
func (e *GetStripePublishableKeyEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetStripePublishableKeyRequest, *apiresource.StripePublishableKey]
type GetStripePublishableKeyRequest ¶
type GetStripePublishableKeyRequest struct{}
Request to retrieve the Stripe publishable key.
type GetStripeStatusEndpoint ¶
type GetStripeStatusEndpoint struct{}
Reports whether the target account has a Stripe integration configured, so a checkout flow can tell up front whether card payments are available.
The account is reported as connected whenever Stripe credentials are on file, even if the integration has been deactivated, and the stored keys are not verified against Stripe.
func (*GetStripeStatusEndpoint) Materialize ¶
func (e *GetStripeStatusEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetStripeStatusRequest, *apiresource.StripeStatus]
type GetStripeStatusRequest ¶
type GetStripeStatusRequest struct{}
Request to check Stripe integration status.
type ListAccountIntegrationsEndpoint ¶
type ListAccountIntegrationsEndpoint struct{}
Returns a paginated list of the third-party providers connected to the target account.
Stored credentials are never included in the response.
func (*ListAccountIntegrationsEndpoint) Materialize ¶
func (e *ListAccountIntegrationsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListAccountIntegrationsRequest, *apiresource.List[apiresource.AccountIntegration]]
type ListAccountIntegrationsRequest ¶
type ListAccountIntegrationsRequest struct {
apiresource.PaginationRequest
}
Request to list account integrations.
type UpdateAccountIntegrationEndpoint ¶
type UpdateAccountIntegrationEndpoint struct{}
Renames an account integration, or activates or deactivates it.
Omitted fields are left unchanged. Credentials cannot be changed here; to rotate them, call Create Account Integration again with the same `provider`.
func (*UpdateAccountIntegrationEndpoint) Materialize ¶
func (e *UpdateAccountIntegrationEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateAccountIntegrationRequest, *apiresource.AccountIntegration]
type UpdateAccountIntegrationRequest ¶
type UpdateAccountIntegrationRequest struct {
// Account integration ID.
AccountIntegrationID string `path:"id" validate:"required"`
// Display name of the integration.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Lifecycle status of the integration.
//
// Set to `inactive` to stop the provider being used while keeping its stored credentials, and back to `active` to resume without re-entering them.
Status field.Optional[constants.AccountIntegrationStatus] `json:"status,omitzero"`
}
Request to update an account integration.
func (*UpdateAccountIntegrationRequest) SchemaExample ¶
func (*UpdateAccountIntegrationRequest) SchemaExample() any