sgo

package module
v0.0.0-...-5d9960a Latest Latest
Warning

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

Go to latest
Published: May 15, 2015 License: MIT Imports: 8 Imported by: 0

README

sgo

Golang Square Connect API

Install

$ go get github.com/calce/sgo
Example Usage
package main

import (
	"github.com/calce/sgo"
	"github.com/calce/sgo/payments"
)

func main() {

	sgo.Token = "Secret"
	sgo.MerchantId = "me"
	
	payments, _ := payments.List(nil)
	
	for payments.HasNext() {
		payment, _ := payments.Next()
	}

}

Documentation

Overview

forward-only iterator base class, used for requested lists Iter is not threadsafe

Index

Constants

View Source
const (
	GET  = "GET"
	POST = "POST"
	PUT  = "PUT"
	DEL  = "DELETE"
)
View Source
const (
	BankAccountBusinessChecking = "BUSINESS_CHECKING"
	BankAccountChecking         = "CHECKING"
	BankAccountInvestment       = "INVESTMENT"
	BankAccountLoan             = "LOAN"
	BankAccountSavings          = "SAVINGS"
	BankAccountOther            = "OTHER"
)

BankAccount.Type

View Source
const (
	DiscountFixed              = "FIXED"
	DiscountVariablePercentage = "VARIABLE_PERCENTAGE"
	DiscountVariableAmount     = "VARIABLE_AMOUNT"
)

Discount.Type

View Source
const (
	EmployeeStatusActive   = "ACTIVE"
	EmployeeStatusInactive = "INACTIVE"
)

Employee.Status

View Source
const (
	PermissionAccessSalesHistory        = "REGISTER_ACCESS_SALES_HISTORY"
	PermissionAppleRestrictedDiscounts  = "REGISTER_APPLY_RESTRICTED_DISCOUNTS"
	PermissionChangeSettings            = "REGISTER_CHANGE_SETTINGS"
	PermissionEditItem                  = "REGISTER_EDIT_ITEM"
	PermissionIssueRefunds              = "REGISTER_ISSUE_REFUNDS"
	PermissionOpenCashDrawerOutsideSale = "REGISTER_OPEN_CASH_DRAWER_OUTSIDE_SALE"
	PermissionViewSummaryReports        = "REGISTER_VIEW_SUMMARY_REPORTS"
)

EmployeeRole.Permission

View Source
const (
	FeeCalculationPhaseSubtotal = "FEE_SUBTOTAL_PHASE"
	FeeCalculationPhaseTotal    = "FEE_TOTAL_PHASE"
	FeeCalculationPhaseOther    = "OTHER"
)

Fee.CalculationPhase

View Source
const (
	FeeInclusionTypeAdditive  = "ADDITIVE"
	FeeInclusionTypeInclusive = "INCLUSIVE"
)

Fee.InclusionType

View Source
const (
	FeeTypeCAGST            = "CA_GST"
	FeeTypeHST              = "CA_HST"
	FeeTypeCAPEIPST         = "CA_PEI_PST"
	FeeTypeCAPST            = "CA_PST"
	FeeTypeCAQST            = "CA_QST"
	FeeTypeJPConsumptionTax = "JP_CONSUMPTION_TAX"
	FeeTypeUSSalesTax       = "US_SALES_TAX"
	FeeTypeOther            = "OTHER"
)

Fee.Type

View Source
const (
	InventoryAdjustmentTypeSale         = "SALE	"
	InventoryAdjustmentTypeReceiveStock = "RECEIVE_STOCK"
	InventoryAdjustmentTypeManualAdjust = "MANUAL_ADJUST"
)

InventoryAdjustmentType

View Source
const (
	InventoryAlertTypeLowQuantity = "LOW_QUANTITY"
	InventoryAlertTypeNone        = "NONE"
)

InventoryAlertType

View Source
const (
	ItemColorGray       = "9da2a6" //	A gray color.
	ItemColorLightGreen = "4ab200" //	A lighter green color.
	ItemColorDarkGreen  = "0b8000" //	A darker green color.
	ItemColorLightBlue  = "13b1bf" //	A lighter blue color.
	ItemColorDarkBlue   = "2952cc" //	A darker blue color.
	ItemColorPurple     = "a82ee5" //	A purple color.
	ItemColorLightRed   = "e5457a" //	A lighter red color.
	ItemColorDarkRed    = "b21212" //	A dark red color.
	ItemColorGold       = "e5BF00" //	A gold color.
	ItemColorBrown      = "593c00" //	A brown color.
)

Item.Color

View Source
const (
	ItemVisibilityPublic  = "PUBLIC"
	ItemVisibilityPrivate = "PRIVATE"
)

Item.Visibility

View Source
const (
	ItemVariationPricingTypeFixed    = "FIXED_PRICING"
	ItemVariationPricingTypeVariable = "VARIABLE_PRICING"
)

ItemVariation.PricingType

View Source
const (
	ListOrderASC  = "ASC"
	ListOrderDESC = "DESC"
)

ListOrder

View Source
const (
	CAD = "CAD"
	JPY = "JPY"
	USD = "USD"
)

Money.CurrencyCode

View Source
const (
	MerchantAccountTypeBusiness = "BUSINESS"
	MerchantAccountTypeLocation = "LOCATION"
)

Merchant.AccountType

View Source
const (
	ModifierListSelectionTypeSingle   = "ModifierListSelectionType"
	ModifierListSelectionTypeMultiple = "ModifierListSelectionType"
)

ModifierList.SelectionType

View Source
const (
	OAuthPermissionMerchantProfileRead = "MERCHANT_PROFILE_READ"
	OAuthPermissionPaymentsRead        = "PAYMENTS_READ"
	OAuthPermissionPaymentsWrite       = "PAYMENTS_WRITE"
	OAuthPermissionSettlementsRead     = "SETTLEMENTS_READ"
	OAuthPermissionBankAccountsRead    = "BANK_ACCOUNTS_READ"
	OAuthPermissionItemsRead           = "ITEMS_READ"
	OAuthPermissionItemsWrite          = "ITEMS_WRITE"
	OAuthPermissionOrdersRead          = "ORDERS_READ"
	OAuthPermissionOrdersWrite         = "ORDERS_WRITE"
	OAuthPermissionEmployeesRead       = "EMPLOYEES_READ"
	OAuthPermissionEmployeesWrite      = "EMPLOYEES_WRITE"
	OAuthPermissionTimeCardsRead       = "TIMECARDS_READ"
	OAuthPermissionTimeCardsWrite      = "TIMECARS_WRITE"
)

OAuth.Permission

View Source
const (
	OrderActionComplete = "COMPLETE"
	OrderActionCancel   = "CANCEL"
	OrderActionRefund   = "REFUND"
)

Order.Action

View Source
const (
	OrderStatePending   = "PENDING"
	OrderStateOpen      = "OPEN"
	OrderStateCompleted = "COMPLETED"
	OrderStateCancelled = "CANCELED"
	OrderStateRefunded  = "REFUNDED"
	OrderStateRejected  = "REJECTED"
)

Order.State

View Source
const (
	OrderHistoryEntryActionTypeOrderPlaced     = "ORDER_PLACED"
	OrderHistoryEntryActionTypeDeclined        = "DECLINED"
	OrderHistoryEntryActionTypePaymentReceived = "PAYMENT_RECEIVED"
	OrderHistoryEntryActionTypeCanceled        = "CANCELED"
	OrderHistoryEntryActionTypeCompleted       = "COMPLETED"
	OrderHistoryEntryActionTypeRefunded        = "REFUNDED"
	OrderHistoryEntryActionTypeExpired         = "EXPIRED"
)

OrderHistoryEntry.ActionType

View Source
const (
	PaymentItemizationTypeItem               = "ITEM"
	PaymentItemizationTypeCustomAmount       = "CUSTOM_AMOUNT"
	PaymentItemizationTypeGiftCardActivation = "GIFT_CARD_ACTIVATION"
	PaymentItemizationTypeGiftCardReloaded   = "GIFT_CARD_RELOAD"
	PaymentItemizationTypeGiftCardUnknown    = "GIFT_CARD_UNKNOWN"
	PaymentItemizationTypeOther              = "OTHER"
)

PaymentItemization.Type

View Source
const (
	RefundTypeFull    = "FULL"
	RefundTypePartial = "PARTIAL"
)

Refund.Type

View Source
const (
	PageCellTypeItem        = "ITEM"
	PageCellTypeDiscount    = "DISCOUNT"
	PageCellTypeCategory    = "CATEGORY"
	PageCellTypePlaceHolder = "PLACEHOLDER"
)

PageCell.Type

View Source
const (
	PageCellPlaceholderTypeAllItems          = "ALL_ITEMS"
	PageCellPlaceholderTypeDiscountsCategory = "DISCOUNTS_CATEGORY"
	PageCellPlaceholderTypeRewardsFinder     = "REWARDS_FINDER"
)

PageCell.PlaceholderType

View Source
const (
	RequestMethodDelete = "DELETE"
	RequestMethodGet    = "GET"
	RequestMethodPost   = "POST"
	RequestMethodPut    = "PUT"
)

RequestMethod

View Source
const (
	SettlementEntryTypeAdjustment                   = "ADJUSTMENT"
	SettlementEntryTypeBalanceCharge                = "BALANCE_CHARGE"
	SettlementEntryTypeCharge                       = "CHARGE"
	SettlementEntryTypeFreeProcessing               = "FREE_PROCESSING"
	SettlementEntryTypeHoldAdjustment               = "HOLD_ADJUSTMENT"
	SettlementEntryTypeRedeptionCode                = "REDEMPTION_CODE"
	SettlementEntryTypeRefund                       = "REFUND"
	SettlementEntryTypeReturnedPayout               = "RETURNED_PAYOUT"
	SettlementEntryTypeSquareCapitalAdvance         = "SQUARE_CAPITAL_ADVANCE"
	SettlementEntryTypeSquareCapitalPayment         = "SQUARE_CAPITAL_PAYMENT"
	SettlementEntryTypeSquareCapitalReversedPayment = "SQUARE_CAPITAL_REVERSED_PAYMENT"
	SettlementEntryTypeOther                        = "OTHER"
	SettlementEntryTypeIncentedPayment              = "INCENTED_PAYMENT"
	SettlementEntryTypeReturnedACHEntry             = "RETURNED_ACH_ENTRY"
	SettlementEntryTypeReturnedSquare275            = "RETURNED_SQUARE_275"
	SettlementEntryTypeSquare275                    = "SQUARE_275"
)

SettlementEntry.Type

View Source
const (
	SettlementStatusFailed = "FAILED"
	SettlementStatusSent   = "SENT"
)

Settlement.Status

View Source
const (
	SubscriptionPaymentMethodCard             = "CARD"
	SubscriptionPaymentMethodPayoutAdjustment = "PAYOUT_ADJUSTMENT"
	SubscriptionPaymentMethodOther            = "OTHER"
)

Subscription.PaymentMethod

View Source
const (
	SubscriptionStatusActive     = "ACTIVE"
	SubscriptionStatusInGrade    = "IN_GRACE"
	SubscriptionStatusDelinquent = "DELINQUENT"
	SubscriptionStatusCanceled   = "CANCELED"
	SubscriptionStatusTerminated = "TERMINATED"
	SubscriptionStatusOther      = "OTHER"
)

Subscription.Status

View Source
const (
	SubscriptionFeeStatusPending       = "PENDING"
	SubscriptionFeeStatusPaymentFailed = "PAYMENT_FAILED"
	SubscriptionFeeStatusPaid          = "PAID"
	SubscriptionFeeStatusCanceled      = "CANCELED"
	SubscriptionFeeStatusOther         = "OTHER"
)

SubscriptionFee.Status

View Source
const (
	TenderCardBrandUnknown         = "UNKNOWN"
	TenderCardBrandVisa            = "VISA"
	TenderCardBrandMasterCard      = "MASTER_CARD"
	TenderCardBrandAmericanExpress = "AMERICAN_EXPRESS"
	TenderCardBrandDiscover        = "DISCOVER"
	TenderCardBrandDiscoverDiners  = "DISCOVER_DINERS"
	TenderCardBrandJCB             = "JCB"
)

Tender.CardBrand

View Source
const (
	TenderEntryMethodManual       = "MANUAL"
	TenderEntryMethodScanned      = "SCANNED"
	TenderEntryMethodSquareCash   = "SQUARE_CASH"
	TenderEntryMethodSquareWallet = "SQUARE_WALLET"
	TenderEntryMethodSwiped       = "SWIPED"
	TenderEntryMethodWebForm      = "WEB_FORM"
	TenderEntryMethodOther        = "OTHER"
)

Tender.EntryMethod

View Source
const (
	TenderTypeCreditCard     = "CREDIT_CARD"
	TenderTypeCash           = "CASH"
	TenderTypeThirdPartyCard = "THIRD_PARTY_CARD"
	TenderTypeNoSale         = "NO_SALE"
	TenderTypeSquareWallet   = "SQUARE_WALLET"
	TenderTypeSquareGiftCard = "SQUARE_GIFT_CARD"
	TenderTypeUnknown        = "UNKNOWN"
	TenderTypeOther          = "OTHER"
)

Tender.Type

View Source
const (
	TimecardEventTypeCreate          = "API_CREATE"
	TimecardEventTypeApiEdit         = "API_EDIT"
	TimecardEventTypeClockIn         = "CLOCKIN"
	TimecardEventTypeClockOut        = "CLOCKOUT"
	TimecardEventTypeSupervisorClose = "SUPERVISOR_CLOSE"
	TimecardEventTypeEdit            = "EDIT"
)

TimecardEvent.Type

View Source
const (
	WebhookEventTypePaymentUpdated  = "PAYMENT_UPDATED"
	WebhookEventTypeTimeCardUpdated = "TIMECARD_UPDATED"
)

WebhookEventType

View Source
const (
	ErrorParse = "JSON Parse Error"
	ErrorApi   = "Square API Error"
)
View Source
const (
	FeeAdjustmentTypeTax = "TAX"
)

Fee.AdjustmentType

View Source
const (
	MerchantAccountCapabilityCreditCardProcessing = "CREDIT_CARD_PROCESSING"
)

Merchant.AccountCapability

Variables

View Source
var AutoLoadNextPage bool = false
View Source
var MerchantId string = ""
View Source
var Token string = ""

Functions

func SetDefaultBackend

func SetDefaultBackend(backend *Backend)

Types

type ApiError

type ApiError struct {
	ErrorCode int
	ErrorType string `json:"type"`
	Message   string `json:"message"`
}

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func GetDefaultBackend

func GetDefaultBackend() *Backend

func NewBackend

func NewBackend(token string, baseURL string, merchantId string, timeout time.Duration, client *http.Client) *Backend

Creates a backend with an optional http client

func (*Backend) Call

func (this *Backend) Call(query *Query) (interface{}, *Error)

Calling a Square API endpoint

func (*Backend) GetBaseURL

func (this *Backend) GetBaseURL() string

type BankAccount

type BankAccount struct {
	Id              string `json:"id"`
	MerchantId      string `json:"merchant_id"`
	BankName        string `json:"bank_name"`
	Name            string `json:"name"`
	BankAccountType string `json:"type"`
	RoutingNumber   string `json:"routing_number"`
	AccountNumber   string `json:"account_number_suffix"`
	CurrencyCode    string `json:"currency_code"`
}

type BatchRequest

type BatchRequest struct {
	Method       string `json:"method"`
	RelativePath string `json:"relative_path"`
	AccessToken  string `json:"access_token"`
	RequestId    string `json:"request_id"`
}

type BatchResponse

type BatchResponse struct {
	StatusCode float64     `json:"status_code"`
	Headers    interface{} `json:"headers"`
	Body       interface{} `json:"body"`
	RequestId  string      `json:"request_id"`
}

type Category

type Category struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Device

type Device struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

type Discount

type Discount struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	Rate         string `json:"rate"`
	AmountMoney  Money  `json:"amount_money"`
	DiscountType string `json:"discount_type"`
	PinRequired  bool   `json:"pin_required"`
	Color        string `json:"color"`
}

type Employee

type Employee struct {
	Id         string   `json:"id"`
	FirstName  string   `json:"first_name"`
	LastName   string   `json:"last_name"`
	RoleIds    []string `json:"role_ids"`
	Status     string   `json:"status"`
	ExternalId string   `json:"external_id"`
	CreatedAt  string   `json:"created_at"`
	UpdatedAt  string   `json:"updated_at"`
}

type EmployeeRole

type EmployeeRole struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
	IsOwner     bool     `json:"is_owner"`
	CreatedAt   string   `json:"created_at"`
	UpdatedAt   string   `json:"updated_at"`
}

type Error

type Error struct {
	ErrorType  string
	ApiError   *ApiError
	ParseError error
}

func MakeApiError

func MakeApiError(code int, errType string, message string) *Error

func MakeError

func MakeError(errType string, api *ApiError, parse error) *Error

type Fee

type Fee struct {
	Id                     string `json:"id"`
	Name                   string `json:"name"`
	Rate                   string `json:"rate"`
	CalculationPhase       string `json:"calculation_phase"`
	AdjustmentType         string `json:"adjustment_type"`
	AppliesToCustomAmounts bool   `json:"applies_to_custom_amounts"`
	Enabled                bool   `json:"enabled"`
	InclusionType          string `json:"inclusion_type"`
	FeeType                string `json:"type"`
}

type GetListFunc

type GetListFunc func(l interface{}) *[]interface{}

type GetObjectFunc

type GetObjectFunc func() interface{}

type GlobalAddress

type GlobalAddress struct {
	AddressLine1                 string `json:"address_line_1"`
	AddressLine2                 string `json:"address_line_2"`
	AddressLine3                 string `json:"address_line_3"`
	AddressLine4                 string `json:"address_line_4"`
	AddressLine5                 string `json:"address_line_5"`
	Locality                     string `json:"locality"`
	Sublocality                  string `json:"sublocality"`
	Sublocality1                 string `json:"sublocality1"`
	Sublocality2                 string `json:"sublocality2"`
	Sublocality3                 string `json:"sublocality3"`
	Sublocality4                 string `json:"sublocality4"`
	Sublocality5                 string `json:"sublocality5"`
	AdministrativeDistrictLevel1 string `json:"administrative_district_level_1"`
	AdministrativeDistrictLevel2 string `json:"administrative_district_level_2"`
	AdministrativeDistrictLevel3 string `json:"administrative_district_level_3"`
	PostalCode                   string `json:"postal_code"`
	CountryCode                  string `json:"country_code"`
	AddressCoordinates           string `json:"address_coordinates"`
}

type InventoryEntry

type InventoryEntry struct {
	VariationId    string `json:"variation_id"`
	QuantityOnHand string `json:"quantity_on_hand"`
}

type Item

type Item struct {
	Id              string          `json:"id"`
	Name            string          `json:"name"`
	Description     string          `json:"description"`
	Abbreviation    string          `json:"abbreviation"`
	Color           string          `json:"color"`
	Visibility      string          `json:"visibility"`
	AvailableOnline string          `json:"available_online"`
	MasterImage     ItemImage       `json:"master_image"`
	Category        Category        `json:"category"`
	Variations      []ItemVariation `json:"variations"`
	ModifierLists   []ModifierList  `json:"modifier_lists"`
	Fees            []Fee           `json:"fees"`
	Taxable         bool            `json:"taxable"`
}

type ItemImage

type ItemImage struct {
	Id  string `json:"id"`
	Url string `json:"Url"`
}

type ItemVariation

type ItemVariation struct {
	Id                      string  `json:"id"`
	Name                    string  `json:"name"`
	ItemId                  string  `json:"item_id"`
	Ordinal                 string  `json:"ordinal"`
	PricingType             string  `json:"pricing_type"`
	PriceMoney              Money   `json:"price_money"`
	SKU                     string  `json:"sku"`
	TrackInventory          string  `json:"track_inventory"`
	InventoryAlertType      string  `json:"inventory_alert_type"`
	InventoryAlertThreshold float64 `json:"inventory_alert_threshold"`
	UserData                string  `json:"user_data"`
}

type Iter

type Iter struct {
	// contains filtered or unexported fields
}

func (*Iter) GetCurrentPage

func (this *Iter) GetCurrentPage() int

func (*Iter) HasNext

func (this *Iter) HasNext() bool

func (*Iter) HasNextPage

func (this *Iter) HasNextPage() bool

func (*Iter) Next

func (this *Iter) Next() (interface{}, *Error)

Return next item, load next page if there is and when AutoLoadNextPage is true

func (*Iter) SetList

func (this *Iter) SetList(l *[]interface{})

For testing purpose only

func (*Iter) SetNextQuery

func (this *Iter) SetNextQuery(query *Query)

For testing purpose only

type Merchant

type Merchant struct {
	Id                  string                  `json:"id"`
	Name                string                  `json:"name"`
	Email               string                  `json:"email"`
	AccountType         string                  `json:"account_type"`
	AccountCapabilities []string                `json:"account_capabilities"`
	CountryCode         string                  `json:"country_code"`
	LanguageCode        string                  `json:"language_code"`
	CurrencyCode        string                  `json:"currency_code"`
	BusinessName        string                  `json:"business_name"`
	BusinessAddress     GlobalAddress           `json:"business_address"`
	BusinessPhone       PhoneNumber             `json:"business_phone"`
	BusinessType        string                  `json:"business_type"`
	ShippingAddress     GlobalAddress           `json:"shipping_address"`
	LocationDetails     MerchantLocationDetails `json:"location_details"`
	MarketUrl           string                  `json:"market_url"`
}

type MerchantLocationDetails

type MerchantLocationDetails struct {
	Nickname string `json:"nickname"`
}

type ModifierList

type ModifierList struct {
	Id               string           `json:"id"`
	Name             string           `json:"name"`
	SelectionType    string           `json:"selection_type"`
	Modifier_options []ModifierOption `json:"modifier_options"`
}

type ModifierOption

type ModifierOption struct {
	Id             string `json:"id"`
	Name           string `json:"name"`
	PriceMoney     Money  `json:"price_money"`
	OnByDefault    string `json:"on_by_default"`
	Ordinal        string `json:"ordinal"`
	ModifierListId string `json:"modifier_list_id"`
}

type Money

type Money struct {
	Amount       float64 `json:"amount"`
	CurrencyCode string  `json:"currency_code"`
}

type NextPageFunc

type NextPageFunc func() error

type Order

type Order struct {
	Id                   string              `json:"id"`
	State                string              `json:"state"`
	BuyerEmail           string              `json:"buyer_email"`
	RecipientName        string              `json:"recipient_name"`
	RecipientPhoneNumber string              `json:"recipient_phone_number"`
	ShippingAddress      GlobalAddress       `json:"shipping_address"`
	SubtotalMoney        Money               `json:"subtotal_money"`
	TotalShippingMoney   Money               `json:"total_shipping_money"`
	TotalTaxMoney        Money               `json:"total_tax_money"`
	TotalPriceMoney      Money               `json:"total_price_money"`
	TotalDiscountMoney   Money               `json:"total_discount_money"`
	CreatedAt            string              `json:"created_at"`
	UpdatedAt            string              `json:"updated_at"`
	ExpiresAt            string              `json:"expires_at"`
	PaymentId            string              `json:"payment_id"`
	BuyerNote            string              `json:"buyer_note"`
	CompletedNote        string              `json:"completed_note"`
	RefundedNote         string              `json:"refunded_note"`
	CanceledNote         string              `json:"canceled_note"`
	Tender               Tender              `json:"tender"`
	OrderHistory         []OrderHistoryEntry `json:"order_history"`
	PromoCode            string              `json:"promo_code"`
	BtcReceiveAddress    string              `json:"btc_receive_address"`
	BtcPriceSatoshi      float64             `json:"btc_price_satoshi"`
}

type OrderHistoryEntry

type OrderHistoryEntry struct {
	Action    string `json:"action"`
	CreatedAt string `json:"created_at"`
}

type OrderListParams

type OrderListParams struct {
	Limit int    `param:"limit"`
	Order string `param:"order"`
}

type OrderUpdateParams

type OrderUpdateParams struct {
	Action                string `param:"action"`
	ShippedTrackingNumber string `param:"shipped_tracking_number"`
	CompletedNote         string `param:"completed_note"`
	RefundedNote          string `param:"refunded_note"`
	CanceledNote          string `param:"canceled_note"`
}

type Page

type Page struct {
	Id        string     `json:"id"`
	Name      string     `json:"name"`
	PageIndex float64    `json:"page_index"`
	Cells     []PageCell `json:"cells"`
}

type PageCell

type PageCell struct {
	PageId          string  `json:"page_id"`
	Row             float64 `json:"row"`
	Column          float64 `json:"column"`
	ObjectType      string  `json:"object_type"`
	ObjectId        string  `json:"object_id"`
	PlaceHolderType string  `json:"placeholder_type"`
}

type Payment

type Payment struct {
	Id                  string               `json:"id"`
	MerchantId          string               `json:"merchant_id"`
	CreatedAt           string               `json:"created_at"`
	CreatorId           string               `json:"creator_id"`
	PaymentDevice       Device               `json:"device"`
	PaymentUrl          string               `json:"payment_url"`
	ReceiptUrl          string               `json:"receipt_url"`
	InclusiveTaxMoney   Money                `json:"inclusive_tax_money"`
	AdditiveTaxMoney    Money                `json:"additive_tax_money"`
	TaxMoney            Money                `json:"tax_money"`
	TipMoney            Money                `json:"tip_money"`
	DiscountMoney       Money                `json:"discount_money"`
	TotalCollectedMoney Money                `json:"total_collected_money"`
	ProcessingFeeMoney  Money                `json:"processing_fee_money"`
	NetTotalMoney       Money                `json:"net_total_money"`
	RefundedMoney       Money                `json:"refunded_money"`
	InclusiveTax        []PaymentTax         `json:"inclusive_tax"`
	AdditiveTax         []PaymentTax         `json:"additive_tax"`
	Tender              []Tender             `json:"tender"`
	Refunds             []Refund             `json:"refunds"`
	Itemizations        []PaymentItemization `json:"itemizations"`
}

type PaymentDiscount

type PaymentDiscount struct {
	Name         string `json:"name"`
	AppliedMoney Money  `json:"applied_money"`
	DiscountId   string `json:"discount_id"`
}

type PaymentExtensions

type PaymentExtensions struct {
	Metadata map[string]string `json:"metadata"`
}

type PaymentItemDetail

type PaymentItemDetail struct {
	CategoryName    string    `json:"category_name"`
	SKU             string    `json:"sku"`
	IconColor       RGBAColor `json:"icon_color"`
	ItemId          string    `json:"item_id"`
	ItemVariationId string    `json:"item_variation_id"`
}

type PaymentItemization

type PaymentItemization struct {
	Name                string            `json:"name"`
	Quantity            string            `json:"quantity"`
	ItemizationType     string            `json:"itemization_type"`
	ItemDetail          PaymentItemDetail `json:"item_detail"`
	Notes               string            `json:"notes"`
	ItemVariationName   string            `json:"item_variation_name"`
	TotalMoney          Money             `json:"total_money"`
	SingleQuantityMoney Money             `json:"single_quantity_money"`
	GrossSalesMoney     Money             `json:"gross_sales_money"`
	DiscountMoney       Money             `json:"discount_money"`
	NetSalesMoney       Money             `json:"net_sales_money"`
	Taxes               []PaymentTax      `json:"taxes"`
	Discounts           []PaymentDiscount `json:"discounts"`
	Modifiers           []PaymentModifier `json:"modifiers"`
}

type PaymentListParams

type PaymentListParams struct {
	BeginTime string `param:"begin_time"`
	EndTime   string `param:"end_time"`
	Order     string `param:"order"`
	Limit     int    `param:"limit"`
}

type PaymentModifier

type PaymentModifier struct {
	Name             string `json:"name"`
	AppliedMoney     Money  `json:"applied_money"`
	ModifierOptionId string `json:"modifier_option_id"`
}

type PaymentTax

type PaymentTax struct {
	Name          string `json:"name"`
	AppliedMoney  Money  `json:"applied_money"`
	Rate          string `json:"rate"`
	InclusionType string `json:"inclusion_type"`
	FeeId         string `json:"fee_id"`
}

type PhoneNumber

type PhoneNumber struct {
	CallingCode string `json:"calling_code"`
	Number      string `json:"number"`
}

type Query

type Query struct {
	Method    string
	URL       string
	Params    string
	IsList    bool
	GetObject GetObjectFunc
	GetList   GetListFunc
}

func (*Query) CreateNextPageQuery

func (this *Query) CreateNextPageQuery(URL string) *Query

creates a copy of query with the next page's URL and empty params

type RGBAColor

type RGBAColor struct {
	A float64 `json:"a"`
	R float64 `json:"r"`
	G float64 `json:"g"`
	B float64 `json:"b"`
}

not in docs

type Refund

type Refund struct {
	RefundType    string `json:"type"`
	Reason        string `json:"reason"`
	RefundedMoney Money  `json:"refunded_money"`
	CreatedAt     string `json:"created_at"`
	ProcessedAt   string `json:"processed_at"`
	PaymentId     string `json:"payment_id"`
}

type RefundCreateParams

type RefundCreateParams struct {
	PaymentId             string `param:"payment_id"`
	RefundType            string `param:"type"`
	Reason                string `param:"reason"`
	RefundedMoney         Money  `param:"refunded_money"`
	RequestIdempotenceKey string `param:"request_idempotence_key"`
}

type RefundListParams

type RefundListParams struct {
	BeginTime string `param:"begin_time"`
	EndTime   string `param:"end_time"`
	Order     string `param:"order"`
	Limit     int    `param:"limit"`
}

type Settlement

type Settlement struct {
	Id            string            `json:"id"`
	Status        string            `json:"status"`
	InitiatedAt   string            `json:"initiated_at"`
	BankAccountId string            `json:"bank_account_id"`
	TotalMoney    Money             `json:"total_money"`
	Entries       []SettlementEntry `json:"entries"`
}

type SettlementEntry

type SettlementEntry struct {
	SettlementEntryType string `json:"type"`
	PaymentId           string `json:"payment_id"`
	AmountMoney         Money  `json:"amount_money"`
	FeeMoney            Money  `json:"fee_money"`
}

type SettlementListParams

type SettlementListParams struct {
	BeginTime string `param:"begin_time"`
	EndTime   string `param:"end_time"`
	Order     string `param:"order"`
	Limit     int    `param:"limit"`
	Status    string `param:"status"`
}

type Subscription

type Subscription struct {
	Id               string            `json:"id"`
	MerchantId       string            `json:"merchant_id"`
	PlanId           string            `json:"plan_id"`
	Status           string            `json:"status"`
	PaymentMethod    string            `json:"payment_method"`
	FeeBaseMoney     Money             `json:"fee_base_money"`
	ServiceStartDate string            `json:"service_start_date"`
	Fee              []SubscriptionFee `json:"fees"`
}

type SubscriptionFee

type SubscriptionFee struct {
	FeeDate       string `json:"fee_date"`
	FeeStatus     string `json:"fee_status"`
	FeeBaseMoney  Money  `json:"fee_base_money"`
	FeeTaxMoney   Money  `json:"fee_tax_money"`
	FeeTotalMoney Money  `json:"fee_total_money"`
}

type SubscriptionPlan

type SubscriptionPlan struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	CountryCode  string `json:"name"`
	FeeBaseMoney Money  `json:"fee_base_money"`
}

type Tender

type Tender struct {
	Id              string `json:"id"`
	TenderType      string `json:"type"`
	Name            string `json:"name"`
	ReceiptUrl      string `json:"receipt_url"`
	CardBrand       string `json:"card_brand"`
	PanSuffix       string `json:"pan_suffix"`
	EntryMethod     string `json:"entry_method"`
	PaymentNote     string `json:"payment_note"`
	TotalMoney      Money  `json:"total_money"`
	TenderedMoney   Money  `json:"tendered_money"`
	ChargeBackMoney Money  `json:"change_back_money"`
	RefundedMoney   Money  `json:"refunded_money"`
}

type Timecard

type Timecard struct {
	Id                 string `json:"id"`
	EmployeeId         string `json:"employee_id"`
	ClockInTime        string `json:"clockin_time"`
	ClockOutTime       string `json:"clockout_time"`
	ClockInLocationId  string `json:"clockin_location_id"`
	ClockOutLocationId string `json:"clockout_location_id"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
}

type TimecardEvent

type TimecardEvent struct {
	Id           string `json:"id"`
	EventType    string `json:"event_type"`
	ClockInTime  string `json:"clockin_time"`
	ClockOutTime string `json:"clockout_time"`
	CreatedAt    string `json:"created_at"`
}

Directories

Path Synopsis
Provices mock objects until Square has their own api sandbox
Provices mock objects until Square has their own api sandbox
backend selector for testings
backend selector for testings
Params create url encoded strings from structs using the reflect package Supported field types: string, int, float
Params create url encoded strings from structs using the reflect package Supported field types: string, int, float

Jump to

Keyboard shortcuts

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