Documentation
¶
Overview ¶
forward-only iterator base class, used for requested lists Iter is not threadsafe
Index ¶
- Constants
- Variables
- func SetDefaultBackend(backend *Backend)
- type ApiError
- type Backend
- type BankAccount
- type BatchRequest
- type BatchResponse
- type Category
- type Coordinates
- type Device
- type Discount
- type Employee
- type EmployeeRole
- type Error
- type Fee
- type GetListFunc
- type GetObjectFunc
- type GlobalAddress
- type InventoryEntry
- type Item
- type ItemImage
- type ItemVariation
- type Iter
- type Merchant
- type MerchantLocationDetails
- type ModifierList
- type ModifierOption
- type Money
- type NextPageFunc
- type Order
- type OrderHistoryEntry
- type OrderListParams
- type OrderUpdateParams
- type Page
- type PageCell
- type Payment
- type PaymentDiscount
- type PaymentExtensions
- type PaymentItemDetail
- type PaymentItemization
- type PaymentListParams
- type PaymentModifier
- type PaymentTax
- type PhoneNumber
- type Query
- type RGBAColor
- type Refund
- type RefundCreateParams
- type RefundListParams
- type Settlement
- type SettlementEntry
- type SettlementListParams
- type Subscription
- type SubscriptionFee
- type SubscriptionPlan
- type Tender
- type Timecard
- type TimecardEvent
Constants ¶
const ( GET = "GET" POST = "POST" PUT = "PUT" DEL = "DELETE" )
const ( BankAccountBusinessChecking = "BUSINESS_CHECKING" BankAccountChecking = "CHECKING" BankAccountInvestment = "INVESTMENT" BankAccountLoan = "LOAN" BankAccountSavings = "SAVINGS" BankAccountOther = "OTHER" )
BankAccount.Type
const ( DiscountFixed = "FIXED" DiscountVariablePercentage = "VARIABLE_PERCENTAGE" DiscountVariableAmount = "VARIABLE_AMOUNT" )
Discount.Type
const ( EmployeeStatusActive = "ACTIVE" EmployeeStatusInactive = "INACTIVE" )
Employee.Status
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
const ( FeeCalculationPhaseSubtotal = "FEE_SUBTOTAL_PHASE" FeeCalculationPhaseTotal = "FEE_TOTAL_PHASE" FeeCalculationPhaseOther = "OTHER" )
Fee.CalculationPhase
const ( FeeInclusionTypeAdditive = "ADDITIVE" FeeInclusionTypeInclusive = "INCLUSIVE" )
Fee.InclusionType
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
const ( InventoryAdjustmentTypeSale = "SALE " InventoryAdjustmentTypeReceiveStock = "RECEIVE_STOCK" InventoryAdjustmentTypeManualAdjust = "MANUAL_ADJUST" )
InventoryAdjustmentType
const ( InventoryAlertTypeLowQuantity = "LOW_QUANTITY" InventoryAlertTypeNone = "NONE" )
InventoryAlertType
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
const ( ItemVisibilityPublic = "PUBLIC" ItemVisibilityPrivate = "PRIVATE" )
Item.Visibility
const ( ItemVariationPricingTypeFixed = "FIXED_PRICING" ItemVariationPricingTypeVariable = "VARIABLE_PRICING" )
ItemVariation.PricingType
const ( ListOrderASC = "ASC" ListOrderDESC = "DESC" )
ListOrder
const ( CAD = "CAD" JPY = "JPY" USD = "USD" )
Money.CurrencyCode
const ( MerchantAccountTypeBusiness = "BUSINESS" MerchantAccountTypeLocation = "LOCATION" )
Merchant.AccountType
const ( ModifierListSelectionTypeSingle = "ModifierListSelectionType" ModifierListSelectionTypeMultiple = "ModifierListSelectionType" )
ModifierList.SelectionType
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
const ( OrderActionComplete = "COMPLETE" OrderActionCancel = "CANCEL" OrderActionRefund = "REFUND" )
Order.Action
const ( OrderStatePending = "PENDING" OrderStateOpen = "OPEN" OrderStateCompleted = "COMPLETED" OrderStateCancelled = "CANCELED" OrderStateRefunded = "REFUNDED" OrderStateRejected = "REJECTED" )
Order.State
const ( OrderHistoryEntryActionTypeOrderPlaced = "ORDER_PLACED" OrderHistoryEntryActionTypeDeclined = "DECLINED" OrderHistoryEntryActionTypePaymentReceived = "PAYMENT_RECEIVED" OrderHistoryEntryActionTypeCanceled = "CANCELED" OrderHistoryEntryActionTypeCompleted = "COMPLETED" OrderHistoryEntryActionTypeRefunded = "REFUNDED" OrderHistoryEntryActionTypeExpired = "EXPIRED" )
OrderHistoryEntry.ActionType
const ( PaymentItemizationTypeItem = "ITEM" PaymentItemizationTypeCustomAmount = "CUSTOM_AMOUNT" PaymentItemizationTypeGiftCardActivation = "GIFT_CARD_ACTIVATION" PaymentItemizationTypeGiftCardReloaded = "GIFT_CARD_RELOAD" PaymentItemizationTypeGiftCardUnknown = "GIFT_CARD_UNKNOWN" PaymentItemizationTypeOther = "OTHER" )
PaymentItemization.Type
const ( RefundTypeFull = "FULL" RefundTypePartial = "PARTIAL" )
Refund.Type
const ( PageCellTypeItem = "ITEM" PageCellTypeDiscount = "DISCOUNT" PageCellTypeCategory = "CATEGORY" PageCellTypePlaceHolder = "PLACEHOLDER" )
PageCell.Type
const ( PageCellPlaceholderTypeAllItems = "ALL_ITEMS" PageCellPlaceholderTypeDiscountsCategory = "DISCOUNTS_CATEGORY" PageCellPlaceholderTypeRewardsFinder = "REWARDS_FINDER" )
PageCell.PlaceholderType
const ( RequestMethodDelete = "DELETE" RequestMethodGet = "GET" RequestMethodPost = "POST" RequestMethodPut = "PUT" )
RequestMethod
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
const ( SettlementStatusFailed = "FAILED" SettlementStatusSent = "SENT" )
Settlement.Status
const ( SubscriptionPaymentMethodCard = "CARD" SubscriptionPaymentMethodPayoutAdjustment = "PAYOUT_ADJUSTMENT" SubscriptionPaymentMethodOther = "OTHER" )
Subscription.PaymentMethod
const ( SubscriptionStatusActive = "ACTIVE" SubscriptionStatusInGrade = "IN_GRACE" SubscriptionStatusDelinquent = "DELINQUENT" SubscriptionStatusCanceled = "CANCELED" SubscriptionStatusTerminated = "TERMINATED" SubscriptionStatusOther = "OTHER" )
Subscription.Status
const ( SubscriptionFeeStatusPending = "PENDING" SubscriptionFeeStatusPaymentFailed = "PAYMENT_FAILED" SubscriptionFeeStatusPaid = "PAID" SubscriptionFeeStatusCanceled = "CANCELED" SubscriptionFeeStatusOther = "OTHER" )
SubscriptionFee.Status
const ( TenderCardBrandUnknown = "UNKNOWN" TenderCardBrandVisa = "VISA" TenderCardBrandMasterCard = "MASTER_CARD" TenderCardBrandAmericanExpress = "AMERICAN_EXPRESS" TenderCardBrandDiscover = "DISCOVER" TenderCardBrandDiscoverDiners = "DISCOVER_DINERS" TenderCardBrandJCB = "JCB" )
Tender.CardBrand
const ( TenderEntryMethodManual = "MANUAL" TenderEntryMethodScanned = "SCANNED" TenderEntryMethodSquareCash = "SQUARE_CASH" TenderEntryMethodSquareWallet = "SQUARE_WALLET" TenderEntryMethodSwiped = "SWIPED" TenderEntryMethodWebForm = "WEB_FORM" TenderEntryMethodOther = "OTHER" )
Tender.EntryMethod
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
const ( TimecardEventTypeCreate = "API_CREATE" TimecardEventTypeApiEdit = "API_EDIT" TimecardEventTypeClockIn = "CLOCKIN" TimecardEventTypeClockOut = "CLOCKOUT" TimecardEventTypeSupervisorClose = "SUPERVISOR_CLOSE" TimecardEventTypeEdit = "EDIT" )
TimecardEvent.Type
const ( WebhookEventTypePaymentUpdated = "PAYMENT_UPDATED" WebhookEventTypeTimeCardUpdated = "TIMECARD_UPDATED" )
WebhookEventType
const ( ErrorParse = "JSON Parse Error" ErrorApi = "Square API Error" )
const (
FeeAdjustmentTypeTax = "TAX"
)
Fee.AdjustmentType
const (
MerchantAccountCapabilityCreditCardProcessing = "CREDIT_CARD_PROCESSING"
)
Merchant.AccountCapability
Variables ¶
var AutoLoadNextPage bool = false
var MerchantId string = ""
var Token string = ""
Functions ¶
func SetDefaultBackend ¶
func SetDefaultBackend(backend *Backend)
Types ¶
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) GetBaseURL ¶
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 BatchResponse ¶
type Coordinates ¶
type EmployeeRole ¶
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 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 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 (*Iter) HasNextPage ¶
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 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 OrderListParams ¶
type OrderUpdateParams ¶
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 PaymentExtensions ¶
type PaymentItemDetail ¶
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 PaymentModifier ¶
type PaymentTax ¶
type PhoneNumber ¶
type Query ¶
type Query struct { Method string URL string Params string IsList bool GetObject GetObjectFunc GetList GetListFunc }
func (*Query) CreateNextPageQuery ¶
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 RefundCreateParams ¶
type RefundListParams ¶
type Settlement ¶
type SettlementEntry ¶
type SettlementListParams ¶
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 SubscriptionPlan ¶
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"` }
Source Files
¶
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 |