models

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v0.1.3

type Address struct {
	AddressLine1                 string `json:"address_line_1,omitempty"`
	AddressLine2                 string `json:"address_line_2,omitempty"`
	AddressLine3                 string `json:"address_line_3,omitempty"`
	Locality                     string `json:"locality,omitempty"`
	Sublocality                  string `json:"sublocality,omitempty"`
	Sublocality2                 string `json:"sublocality_2,omitempty"`
	Sublocality3                 string `json:"sublocality_3,omitempty"`
	AdministrativeDistrictLevel1 string `json:"administrative_district_level_1,omitempty"`
	AdministrativeDistrictLevel2 string `json:"administrative_district_level_2,omitempty"`
	AdministrativeDistrictLevel3 string `json:"administrative_district_level_3,omitempty"`
	PostalCode                   string `json:"postal_code,omitempty"`
	Country                      string `json:"country,omitempty"`
	FirstName                    string `json:"first_name,omitempty"`
	LastName                     string `json:"last_name,omitempty"`
}

Address represents a postal address in a country.

type CancelSubscriptionResponse added in v0.1.11

type CancelSubscriptionResponse struct {
	Subscription       Subscription       `json:"subscription,omitempty"`
	SubscriptionAction SubscriptionAction `json:"subscription_action,omitempty"`
	Errors             []Error            `json:"errors,omitempty"`
}

type Card added in v0.1.3

type Card struct {
	ID             string  `json:"id,omitempty"`
	CardBrand      string  `json:"card_brand,omitempty"`
	Last4          string  `json:"last_4,omitempty"`
	ExpMonth       int64   `json:"exp_month,omitempty"`
	ExpYear        int64   `json:"exp_year,omitempty"`
	CardholderName string  `json:"cardholder_name,omitempty"`
	BillingAddress Address `json:"billing_address,omitempty"`
	Fingerprint    string  `json:"fingerprint,omitempty"`
	CustomerId     string  `json:"customer_id,omitempty"`
	MerchantId     string  `json:"merchant_id,omitempty"`
	ReferenceId    string  `json:"reference_id,omitempty"`
	Enabled        bool    `json:"enabled,omitempty"`
	CardType       string  `json:"card_type,omitempty"`
	PrepaidType    string  `json:"prepaid_type,omitempty"`
	Bin            string  `json:"bin,omitempty"`
	Version        int64   `json:"version,omitempty"`
	CardCoBrand    string  `json:"card_co_brand,omitempty"`
}

Card represents the payment details of a card to be used for payments.

type CatalogObject added in v0.1.4

type CatalogObject struct {
	Type                  string `json:"type"` // Correctly matches "SUBSCRIPTION_PLAN" or other types as per the JSON
	ID                    string `json:"id"`
	UpdatedAt             string `json:"updated_at"`
	CreatedAt             string `json:"created_at"`
	Version               int64  `json:"version"`
	IsDeleted             bool   `json:"is_deleted"`
	PresentAtAllLocations bool   `json:"present_at_all_locations"`
	// SubscriptionPlanData shows only if the type is SUBSCRIPTION_PLAN
	SubscriptionPlanData SubscriptionPlanData `json:"subscription_plan_data,omitempty"`
	// SubscriptionPlanVariationData shows only if the type is SUBSCRIPTION_PLAN_VARIATION
	SubscriptionPlanVariationData SubscriptionPlanVariationData `json:"subscription_plan_variation_data,omitempty"`
}

type CatalogResponse added in v0.1.15

type CatalogResponse struct {
	Errors []Error       `json:"errors,omitempty"`
	Cursor string        `json:"cursor,omitempty"`
	Object CatalogObject `json:"object,omitempty"`
}

type CreateCardRequest added in v0.1.4

type CreateCardRequest struct {
	IdempotencyKey    string `json:"idempotency_key"`
	SourceId          string `json:"source_id"`
	VerificationToken string `json:"verification_token,omitempty"`
	Card              Card   `json:"card"`
}

CreateCardRequest creates a card from the source (nonce, payment id, etc).t

type CreateCardResponse added in v0.1.4

type CreateCardResponse struct {
	Errors []Error `json:"errors,omitempty"`
	Card   Card    `json:"card,omitempty"`
}

CreateCardResponse Defines the fields that are included in the response body of a request to the [CreateCard]($e/Cards/CreateCard) endpoint. Note: if there are errors processing the request, the card field will not be present.

type CreateCustomerRequest

type CreateCustomerRequest struct {
	IdempotencyKey string         `json:"idempotency_key"`
	GivenName      string         `json:"given_name,omitempty"`
	FamilyName     string         `json:"family_name,omitempty"`
	CompanyName    string         `json:"company_name,omitempty"`
	Nickname       string         `json:"nickname,omitempty"`
	EmailAddress   string         `json:"email_address,omitempty"`
	Address        Address        `json:"address,omitempty"`
	PhoneNumber    string         `json:"phone_number,omitempty"`
	ReferenceId    string         `json:"reference_id"`
	Note           string         `json:"note,omitempty"`
	Birthday       string         `json:"birthday,omitempty"`
	TaxIds         CustomerTaxIds `json:"tax_ids,omitempty"`
}

CreateCustomerRequest defines the body parameters that can be included in a request to the `CreateCustomer` endpoint.

type CreateCustomerResponse

type CreateCustomerResponse struct {
	Customer Customer `json:"customer"`
	Errors   []Error  `json:"errors"`
}

CreateCustomerResponse defines the fields that are included in the response body of a request to the `CreateCustomer` endpoint. Either `errors` or `customer` is present in a given response (never both).

type CreateSubscriptionRequest added in v0.1.4

type CreateSubscriptionRequest struct {
	CustomerId         string             `json:"customer_id"`
	LocationId         string             `json:"location_id"`
	PlanId             string             `json:"plan_id"`
	PlanVariationId    string             `json:"plan_variation_id"`
	IdempotencyKey     string             `json:"idempotency_key"`
	StartDate          string             `json:"start_date,omitempty"`
	CanceledDate       string             `json:"canceled_date,omitempty"`
	TaxPercentage      string             `json:"tax_percentage,omitempty"`
	PriceOverrideMoney Money              `json:"price_override_money,omitempty"`
	CardId             string             `json:"card_id,omitempty"`
	Timezone           string             `json:"timezone,omitempty"`
	Source             SubscriptionSource `json:"source,omitempty"`
}

CreateSubscriptionRequest Defines input parameters in a request to the [CreateSubscription]($e/Subscriptions/CreateSubscription) endpoint.

type CreateSubscriptionResponse added in v0.1.4

type CreateSubscriptionResponse struct {
	Errors       []Error      `json:"errors,omitempty"`
	Subscription Subscription `json:"subscription,omitempty"`
}

type Customer added in v0.1.3

type Customer struct {
	ID             string              `json:"id"`
	CreatedAt      string              `json:"created_at"`
	UpdatedAt      string              `json:"updated_at"`
	Cards          []Card              `json:"cards"`
	GivenName      string              `json:"given_name"`
	FamilyName     string              `json:"family_name"`
	Nickname       string              `json:"nickname"`
	CompanyName    string              `json:"company_name"`
	EmailAddress   string              `json:"email_address"`
	Address        Address             `json:"address"`
	PhoneNumber    string              `json:"phone_number"`
	Birthday       string              `json:"birthday"`
	ReferenceId    string              `json:"reference_id"`
	Note           string              `json:"note"`
	Preferences    CustomerPreferences `json:"preferences"`
	CreationSource string              `json:"creation_source"`
	GroupIds       []string            `json:"group_ids"`
	SegmentIds     []string            `json:"segment_ids"`
	Version        int64               `json:"version"`
	TaxIds         CustomerTaxIds      `json:"tax_ids"`
}

Customer represents a Square customer profile in the Customer Directory of a Square seller

type CustomerPreferences added in v0.1.3

type CustomerPreferences struct {
	EmailUnsubscribed bool `json:"email_unsubscribed"`
}

CustomerPreferences represents communication preferences for the customer profile.

type CustomerTaxIds added in v0.1.3

type CustomerTaxIds struct {
	EuVat string `json:"eu_vat"`
}

Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.

type DeleteCustomerRequest added in v0.1.11

type DeleteCustomerRequest struct {
	CustomerId string `json:"customer_id"`
	Version    int64  `json:"version"`
}

DeleteCustomerRequest represents the request body for DeleteCustomer API

type DeleteCustomerResponse added in v0.1.11

type DeleteCustomerResponse struct {
	Errors []Error `json:"errors"`
}

DeleteCustomerResponse defines the fields that are included in the response body of a request to the `DeleteCustomer` endpoint.

type DisableCardResponse added in v0.1.11

type DisableCardResponse struct {
	Card   Card    `json:"card"`
	Errors []Error `json:"errors"`
}

type Error added in v0.1.3

type Error struct {
	Category string `json:"category"`
	Code     string `json:"code"`
	Detail   string `json:"detail"`
	Field    string `json:"field"`
}

Error represents an error encountered during a request to the Connect API.

func (*Error) Error added in v0.1.3

func (e *Error) Error() string

type ListCardsRequest added in v0.1.11

type ListCardsRequest struct {
	Cursor          string `json:"cursor,omitempty"`
	CustomerId      string `json:"customer_id,omitempty"`
	IncludeDisabled bool   `json:"include_disabled,omitempty"`
	ReferenceId     string `json:"reference_id,omitempty"`
	SortOrder       string `json:"sort_order,omitempty"`
}

type ListCardsResponse added in v0.1.11

type ListCardsResponse struct {
	Cards  []Card  `json:"cards,omitempty"`
	Errors []Error `json:"errors,omitempty"`
	Cursor string  `json:"cursor,omitempty"`
}

type ListCatalogRequest added in v0.1.4

type ListCatalogRequest struct {
	Cursor         string `json:"cursor,omitempty"`
	Types          string `json:"types,omitempty"`
	CatalogVersion int64  `json:"catalog_version,omitempty"`
}

type ListCatalogResponse added in v0.1.4

type ListCatalogResponse struct {
	Errors  []Error         `json:"errors,omitempty"`
	Cursor  string          `json:"cursor,omitempty"`
	Objects []CatalogObject `json:"objects,omitempty"`
}

type Money added in v0.1.4

type Money struct {
	Amount   int64  `json:"amount,omitempty"`
	Currency string `json:"currency,omitempty"`
}

type Phase added in v0.1.15

type Phase struct {
	UID     string  `json:"uid"`
	Cadence string  `json:"cadence"`
	Ordinal int     `json:"ordinal"`
	Pricing Pricing `json:"pricing"`
}

type Price added in v0.1.18

type Price struct {
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
}

type Pricing added in v0.1.15

type Pricing struct {
	Type  string `json:"type"`
	Price Price  `json:"price"`
}

type RetrieveCardResponse added in v0.1.11

type RetrieveCardResponse struct {
	Card   Card    `json:"card"`
	Errors []Error `json:"errors"`
}

type RetrieveCustomerResponse added in v0.1.11

type RetrieveCustomerResponse struct {
	Customer Customer `json:"customer,omitempty"`
	Errors   []Error  `json:"errors,omitempty"`
}

type SearchSubscriptionsQuery added in v0.1.20

type SearchSubscriptionsQuery struct {
	// Define the fields as per the Square API documentation
	FilterConditions map[string]interface{} `json:"filter,omitempty"`
}

SearchSubscriptionsQuery represents the query conditions for searching subscriptions

type SearchSubscriptionsRequest added in v0.1.20

type SearchSubscriptionsRequest struct {
	Cursor  string                   `json:"cursor,omitempty"`
	Limit   int                      `json:"limit,omitempty"`
	Query   SearchSubscriptionsQuery `json:"query,omitempty"`
	Include []string                 `json:"include,omitempty"`
}

SearchSubscriptionsRequest represents the request body for searching subscriptions

type SearchSubscriptionsResponse added in v0.1.20

type SearchSubscriptionsResponse struct {
	Errors        []Error        `json:"errors,omitempty"`
	Subscriptions []Subscription `json:"subscriptions,omitempty"`
	Cursor        string         `json:"cursor,omitempty"`
}

SearchSubscriptionsResponse represents the response body for searching subscriptions

type Subscription added in v0.1.4

type Subscription struct {
	ID                 string               `json:"id,omitempty"`
	LocationId         string               `json:"location_id,omitempty"`
	PlanId             string               `json:"plan_id,omitempty"`
	CustomerId         string               `json:"customer_id,omitempty"`
	StartDate          string               `json:"start_date,omitempty"`
	CanceledDate       string               `json:"canceled_date,omitempty"`
	ChargedThroughDate string               `json:"charged_through_date,omitempty"`
	Status             string               `json:"status,omitempty"`
	TaxPercentage      string               `json:"tax_percentage,omitempty"`
	InvoiceIds         []string             `json:"invoice_ids,omitempty"`
	PriceOverrideMoney Money                `json:"price_override_money,omitempty"`
	Version            int64                `json:"version,omitempty"`
	CreatedAt          string               `json:"created_at,omitempty"`
	CardId             string               `json:"card_id,omitempty"`
	Timezone           string               `json:"timezone,omitempty"`
	Source             SubscriptionSource   `json:"source,omitempty"`
	Actions            []SubscriptionAction `json:"actions,omitempty"`
}

type SubscriptionAction added in v0.1.4

type SubscriptionAction struct {
	Id            string `json:"id,omitempty"`
	Type          string `json:"type,omitempty"`
	EffectiveDate string `json:"effective_date,omitempty"`
	NewPlanId     string `json:"new_plan_id,omitempty"`
}

type SubscriptionPlanData added in v0.1.15

type SubscriptionPlanData struct {
	Name                       string                      `json:"name"`
	SubscriptionPlanVariations []SubscriptionPlanVariation `json:"subscription_plan_variations,omitempty"`
	Variations                 []SubscriptionPlanVariation `json:"variations,omitempty"`
	EligibleItemIds            []string                    `json:"eligible_item_ids"`
	AllItems                   bool                        `json:"all_items"`
}

type SubscriptionPlanVariation added in v0.1.15

type SubscriptionPlanVariation struct {
	Type                          string                        `json:"type"` // "SUBSCRIPTION_PLAN_VARIATION"
	ID                            string                        `json:"id"`
	UpdatedAt                     string                        `json:"updated_at"`
	CreatedAt                     string                        `json:"created_at"`
	Version                       int64                         `json:"version"`
	IsDeleted                     bool                          `json:"is_deleted"`
	PresentAtAllLocations         bool                          `json:"present_at_all_locations"`
	SubscriptionPlanVariationData SubscriptionPlanVariationData `json:"subscription_plan_variation_data"`
}

type SubscriptionPlanVariationData added in v0.1.15

type SubscriptionPlanVariationData struct {
	Name               string  `json:"name"`
	Phases             []Phase `json:"phases"`
	SubscriptionPlanID string  `json:"subscription_plan_id"`
}

type SubscriptionSource added in v0.1.4

type SubscriptionSource struct {
	Name string `json:"name,omitempty"`
}

type UpdateSubscriptionRequest added in v0.1.11

type UpdateSubscriptionRequest struct {
	Subscription Subscription `json:"subscription,omitempty"`
}

type UpdateSubscriptionResponse added in v0.1.11

type UpdateSubscriptionResponse struct {
	Subscription Subscription `json:"subscription,omitempty"`
	Errors       []Error      `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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