square

package
v0.0.0-...-bae4b07 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amounts

type Amounts struct {
	AppliedMoney                         *Money `json:"applied_money,omitempty"`
	DiscountMoney                        *Money `json:"discount_money,omitempty"`
	GrossSalesMoney                      *Money `json:"gross_sales_money,omitempty"`
	ItemVariationPriceMoney              *Money `json:"item_variation_price_money,omitempty"`
	ItemVariationPriceTimesQuantityMoney *Money `json:"item_variation_price_times_quantity_money,omitempty"`
	TaxMoney                             *Money `json:"tax_money,omitempty"`
	TipMoney                             *Money `json:"tip_money,omitempty"`
	TotalMoney                           *Money `json:"total_money,omitempty"`
	VariableAmountMoney                  *Money `json:"variable_amount_money,omitempty"`
}

type Cart

type Cart struct {
	Amounts   *Amounts   `json:"amounts"`
	LineItems *LineItems `json:"line_items"`
}

type Client

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

func New

func New(user, pass string) (*Client, error)

func (*Client) CancelInvoice

func (c *Client) CancelInvoice(req *InvoiceCancelRequest) (*Invoice, error)

func (*Client) CreateInvoice

func (c *Client) CreateInvoice(req *InvoiceCreateRequest) (*Invoice, error)

func (*Client) GetNavigation

func (c *Client) GetNavigation() (*NavigationResponse, error)

func (*Client) GetSubUnits

func (c *Client) GetSubUnits() (*SubUnitResponse, error)

func (*Client) Invoices

func (c *Client) Invoices() ([]*Invoice, error)

type Configuration

type Configuration struct {
	SelectedOptions         *Options `json:"selected_options"`
	BackingType             string   `json:"backing_type"`
	ItemVariationPriceMoney *Money   `json:"item_variation_price_money"`
}

type Discount

type Discount struct {
	WriteOnlyBackingDetails *WriteOnlyBackingDetails `json:"write_only_backing_details"`
	Amounts                 *Amounts                 `json:"amounts"`
	Configuration           *Amounts                 `json:"configuration"`
	ApplicationScope        string                   `json:"application_scope"` // CART_LEVEL
}

type DiscountDetails

type DiscountDetails struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Amount       *Money `json:"amount"`
	DiscountType string `json:"discount_type"` // VARIABLE_AMOUNT

}

type DueDate

type DueDate struct {
	DayOfMonth  int `json:"day_of_month"`
	MonthOfYear int `json:"month_of_year"`
	Year        int `json:"year"`
}

func (DueDate) FromTime

func (d DueDate) FromTime(t time.Time) *DueDate

type Entity

type Entity struct {
	Email      string `json:"email"`
	Nickname   string `json:"nickname"`
	Token      string `json:"token"`
	UnitActive bool   `json:"unit_active"`
}

type Error

type Error struct {
	Success      *bool  `json:"success"`
	ErrorTitle   string `json:"error_title"`
	ErrorMessage string `json:"error_message"`
}

type Invoice

type Invoice struct {
	BuyerEnteredInstrumentEnabled bool   `json:"buyer_entered_instrument_enabled"`
	CanBeScheduled                bool   `json:"can_be_scheduled"`
	DeliveryStatus                string `json:"delivery_status"`
	Description                   string `json:"description"`
	InvoiceName                   string `json:"invoice_name"`
	LockVersion                   int    `json:"lock_version"`
	MerchantInvoiceNumber         string `json:"merchant_invoice_number"`
	MerchantToken                 string `json:"merchant_token"`
	PayerEmail                    string `json:"payer_email"`
	PayerName                     string `json:"payer_name"`
	State                         string `json:"state"`
	TippingEnabled                bool   `json:"tipping_enabled"`
	Token                         string `json:"token"`
	UnitToken                     string `json:"unit_token"`

	RequestedMoney *Money   `json:"requested_money"`
	Payer          *Payer   `json:"payer"`
	DueOn          *DueDate `json:"due_on"`
	CreatedAt      *Time    `json:"created_at"`
	SentAt         *Time    `json:"sent_at"`
	UpdatedAt      *Time    `json:"updated_at"`

	Cart *Cart `json:"cart"`
}

type InvoiceCancelRequest

type InvoiceCancelRequest struct {
	SendEmailToRecipients bool   `json:"send_email_to_recipients"`
	Token                 string `json:"token"`
}

type InvoiceCreateRequest

type InvoiceCreateRequest struct {
	AdditionalRecipientEmail []struct{} `json:"additional_recipient_email"`
	Cart                     *Cart      `json:"cart"`
	Description              string     `json:"description"`
	DueOn                    *DueDate   `json:"due_on"`
	InvoiceName              string     `json:"invoice_name"`
	MerchantInvoiceNumber    string     `json:"merchant_invoice_number"`
	Payer                    *Payer     `json:"payer"`
	RequestedMoney           *Money     `json:"requested_money"`
	IsDraft                  bool       `json:"is_draft"`
	UnitToken                string     `json:"unit_token"`
}

type InvoiceListRequest

type InvoiceListRequest struct {
	Count     int    `json:"count"`
	UnitToken string `json:"unit_token"`
}

type InvoiceListResponse

type InvoiceListResponse struct {
	NextCursor string     `json:"next_cursor"`
	Invoice    []*Invoice `json:"invoice"`
}

type InvoiceResponse

type InvoiceResponse struct {
	Success bool     `json:"success"`
	Invoice *Invoice `json:"invoice"`
}

type Item

type Item struct {
	Quantity      string         `json:"quantity"`
	CustomNote    string         `json:"custom_note"`
	Configuration *Configuration `json:"configuration"`
	Amounts       *Amounts       `json:"amounts"`
}

type LineItems

type LineItems struct {
	Itemization []*Item     `json:"itemization"`
	Fee         []struct{}  `json:"fee"`
	Discount    []*Discount `json:"discount"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Money

type Money struct {
	Amount       int    `json:"amount"`
	CurrencyCode string `json:"currency_code"`
}
type NavigationResponse struct {
	Merchant string `json:"merchant"`
	Token    string `json:"token"`
}

type Options

type Options struct {
	Discount []*Discount `json:"discount"`
	Fee      []struct{}  `json:"fee"`
}

type Payer

type Payer struct {
	DisplayName string  `json:"display_name"`
	Email       string  `json:"email"`
	Token       *string `json:"token"`
}

type SubUnitResponse

type SubUnitResponse struct {
	Entities []*Entity
}

type Time

type Time struct {
	InstantUsec       uint64   `json:"instant_usec"`
	TimezoneOffsetMin int      `json:"timezone_offset_min"`
	TZName            []string `json:"tz_name"`
}

func (Time) Time

func (t Time) Time() time.Time

type WriteOnlyBackingDetails

type WriteOnlyBackingDetails struct {
	Discount    *DiscountDetails `json:"discount"`
	BackingType string           `json:"backing_type"` // CUSTOM_DISCOUNT
}

Jump to

Keyboard shortcuts

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