types

package
v0.0.0-...-05ebe4c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Value        string `json:"value" gorm:"type:money"`
	CurrencyCode string `json:"currency_code,omitempty" gorm:"-"`
}

type Boat

type Boat struct {
	ID         int    `json:"id" gorm:"primary_key;auto_increment;"`
	Name       string `json:"name"`
	Color      string `json:"color"`
	MerchantID string `json:"-" gorm:"type:varchar;not null;primary_key;"`
}

type Breakdown

type Breakdown struct {
	Amount
	Breakdown struct {
		ItemTotal Amount `json:"item_total" gorm:"embedded;embedded_prefix:item_"`
	} `json:"breakdown" gorm:"embedded"`
}

type CUTime

type CUTime struct {
	UpdateTime time.Time `json:"update_time"`
	CreateTime time.Time `json:"create_time"`
}

type Capture

type Capture struct {
	CUTime
	ID               string `json:"id" gorm:"primary_key"`
	CheckoutID       string `json:"-"`
	Status           string `json:"status"`
	Amount           Amount `json:"amount" gorm:"embedded"`
	FinalCapture     bool   `json:"final_capture" gorm:"-"`
	SellerProtection struct {
		Status            string   `json:"string"`
		DisputeCategories []string `json:"dispute_categories"`
	} `json:"seller_protection" gorm:"-"`
	Receivable struct {
		GrossAmount Amount `json:"gross_amount" gorm:"embedded;embedded_prefix:gross_"`
		PaypalFee   Amount `json:"paypal_fee" gorm:"embedded;embedded_prefix:paypal_fee_"`
		NetAmount   Amount `json:"net_amount" gorm:"embedded;embedded_prefix:net_"`
	} `json:"seller_receivable_breakdown" gorm:"embedded"`
	Links []Link `json:"links"`
}

type CheckoutOrder

type CheckoutOrder struct {
	CUTime
	ID            string         `json:"id" gorm:"primary_key"`
	PurchaseUnits []PurchaseUnit `json:"purchase_units"`
	Links         []Link         `json:"links"`
	Intent        string         `json:"intent"`
	PayerID       string         `json:"-"`
	Payer         *Payer         `json:"payer"`
	Status        string         `json:"status"`
}

func (*CheckoutOrder) AfterCreate

func (c *CheckoutOrder) AfterCreate(tx *gorm.DB) error

type GiftCard

type GiftCard struct {
	ID        string  `json:"id" gorm:"primary_key"`
	Initial   string  `json:"initial" gorm:"type:money"`
	Balance   float64 `json:"balance"`
	PaymentID string  `json:"-"`
	Status    string  `json:"-"`
}

type Item

type Item struct {
	Transaction string `json:"-" gorm:"primary_key"`
	Name        string `json:"name"`
	Sku         string `json:"sku" gorm:"primary_key"`
	Price       string `json:"price" gorm:"type:money"`
	Currency    string `json:"currency"`
	Tax         string `json:"tax" gorm:"type:money"`
	Qty         uint32 `json:"quantity"`
}
type Link struct {
	Href    string `json:"href"`
	Rel     string `json:"rel"`
	Method  string `json:"method"`
	EncType string `json:"encType"`
}

type LogAction

type LogAction struct {
	gorm.Model
	MerchantID string         `gorm:"index" json:"-"`
	UserID     string         `json:"userId"`
	Method     string         `json:"method"`
	Url        string         `json:"path"`
	Payload    postgres.Jsonb `json:"message"`
}

type Manual

type Manual struct {
	ProductID  int    `json:"productId"`
	Timestamp  string `json:"timestamp"`
	EntryType  string `json:"entry"`
	TicketType string `json:"ticket"`
	Quantity   int    `json:"quantity"`
	Desc       string `json:"desc"`
	Name       string `json:"name"`
	Email      string `json:"email"`
	Phone      string `json:"phone"`
}

type MerchantConfig

type MerchantConfig struct {
	ID                 string        `json:"-" gorm:"primary_key"`
	PassTitle          string        `json:"passTitle"`
	NotifyNumber       string        `json:"notifyNumber"`
	EmailFrom          string        `json:"emailFrom"`
	EmailName          string        `json:"emailName"`
	EmailContent       string        `json:"emailContent"`
	SendSMS            bool          `json:"sendSMS" gorm:"default:false"`
	TermsConds         string        `json:"terms"`
	SandboxID          string        `json:"-"`
	TwilioAcctSID      string        `json:"-"`
	TwilioAcctToken    string        `json:"-"`
	TwilioFromNumber   string        `json:"-"`
	StripeKey          string        `json:"-"`
	StripeSecondary    string        `json:"-"`
	StripeAcctMap      hstore.Hstore `json:"-"`
	PaymentType        string        `json:"-"`
	FeePercent         float64       `json:"-"`
	FuelSurcharge      float64       `json:"-"`
	LogoBytes          []byte        `json:"-"`
	StripeManagedProds bool          `json:"-"`
}

type PassItem

type PassItem interface {
	GetName() string
	GetSku() string
	GetDesc() string
	GetQuantity() uint
	GetID() string
	GetAmount() string
}

type Payer

type Payer struct {
	ID   string `json:"payer_id" gorm:"primary_key"`
	Name struct {
		GivenName string `json:"given_name"`
		Surname   string `json:"surname"`
	} `json:"name" gorm:"embedded"`
	Email   string `json:"email_address"`
	Address struct {
		CountryCode string `json:"country_code"`
	} `json:"address" gorm:"-"`
	Phone struct {
		PhoneNumber struct {
			NationalNumber string `json:"national_number" gorm:"column:phone_number"`
		} `json:"phone_number" gorm:"embedded"`
	} `json:"phone" gorm:"embedded"`
	AltEmail string `json:"alt_email"`
}

type PayerInfo

type PayerInfo struct {
	ID        string `json:"payer_id" gorm:"primary_key"`
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Phone     string `json:"phone"`
	Country   string `json:"country_code"`
}

type Payment

type Payment struct {
	CUTime
	ID           string        `json:"id" gorm:"primary_key"`
	Links        []Link        `json:"links"`
	State        string        `json:"state"`
	Transactions []Transaction `json:"transactions"`
	Intent       string        `json:"intent"`
	Payer        struct {
		PaymentMethod string    `json:"payment_method"`
		Status        string    `json:"status"`
		PayerInfoID   string    `json:"-"`
		PayerInfo     PayerInfo `json:"payer_info"`
	} `json:"payer" gorm:"embedded"`
	CartID string `json:"cart"`
}

type Product

type Product struct {
	ID           uint       `json:"id" gorm:"primary_key"`
	StripeID     string     `json:"stripeId" gorm:"-"`
	MerchantID   string     `json:"-" gorm:"type:varchar;not null;primary_key;"`
	CreatedAt    time.Time  `json:"-"`
	UpdatedAt    time.Time  `json:"-"`
	DeletedAt    *time.Time `json:"-"`
	Name         string     `json:"name"`
	Desc         string     `json:"desc"`
	Color        string     `json:"color"`
	Publish      bool       `json:"publish"`
	ShowTickets  bool       `json:"showTickets"`
	Schedules    []Schedule `json:"schedList"`
	Fish         string     `json:"fish"`
	Boat         *Boat      `json:"-"`
	BoatID       uint       `json:"boatId" gorm:"default:1"`
	Type         string     `json:"type" gorm:"default:'trip'"`
	BoatOverride bool       `json:"boatOverride" gorm:"default:false"`
}

Product represents a specific Type of tickets sold

type PurchaseItem

type PurchaseItem struct {
	CheckoutID  string `json:"coid" gorm:"primary_key"`
	Sku         string `json:"sku" gorm:"primary_key"`
	Name        string `json:"name"`
	Amount      Amount `json:"unit_amount" gorm:"embedded"`
	Quantity    uint   `json:"quantity,string"`
	Description string `json:"description"`
}

func (*PurchaseItem) GetAmount

func (p *PurchaseItem) GetAmount() string

func (*PurchaseItem) GetDesc

func (p *PurchaseItem) GetDesc() string

func (*PurchaseItem) GetID

func (p *PurchaseItem) GetID() string

func (*PurchaseItem) GetName

func (p *PurchaseItem) GetName() string

func (*PurchaseItem) GetQuantity

func (p *PurchaseItem) GetQuantity() uint

func (*PurchaseItem) GetSku

func (p *PurchaseItem) GetSku() string

type PurchaseUnit

type PurchaseUnit struct {
	CheckoutID string    `json:"-" gorm:"primary_key"`
	RefID      string    `json:"reference_id"`
	Amount     Breakdown `json:"amount" gorm:"embedded"`
	Payee      struct {
		MerchantID string `json:"merchant_id"`
		Email      string `json:"email_address"`
	} `json:"payee" gorm:"embedded;embedded_prefix:payee_"`
	Description string         `json:"description"`
	Items       []PurchaseItem `json:"items" gorm:"foriegnkey:CheckoutID;association_foreignkey:CheckoutID"`
	Payments    struct {
		Captures []*Capture `json:"captures" gorm:"foreignkey:CheckoutID;association_foreignkey:CheckoutID"`
	} `json:"payments" gorm:"embedded"`
}

func (*PurchaseUnit) AfterCreate

func (pu *PurchaseUnit) AfterCreate(tx *gorm.DB) error

type Refund

type Refund struct {
	CUTime
	ID        string `json:"id" gorm:"primary_key"`
	Links     []Link `json:"links"`
	Amount    Amount `json:"amount" gorm:"embedded"`
	Status    string `json:"status"`
	Breakdown struct {
		Net       Amount `json:"net_amount" gorm:"embedded;embedded_prefix:net_"`
		PayPalFee Amount `json:"paypal_fee" gorm:"embedded;embedded_prefix:fee_"`
		Gross     Amount `json:"gross_amount" gorm:"embedded;embedded_prefix:gross_"`
		Total     Amount `json:"total_refunded_amount" gorm:"embedded"`
	} `json:"seller_payable_breakdown" gorm:"embedded;embedded_prefix:refund_"`
}

type Sale

type Sale struct {
	CUTime
	ID             string `json:"id" gorm:"primary_key"`
	Amount         amount `json:"amount" gorm:"embedded"`
	PaymentMode    string `json:"payment_mode"`
	TransactionFee struct {
		Value    string `json:"value" gorm:"column:transaction_fee;type:money"`
		Currency string `json:"currency" gorm:"-"`
	} `json:"transaction_fee" gorm:"embedded"`
	ParentPayment   string         `json:"parent_payment"`
	SoftDesc        string         `json:"soft_descriptor"`
	ProtectEligible string         `json:"protection_eligibility"`
	Links           []Link         `json:"links"`
	State           string         `json:"state"`
	InvoiceNum      string         `json:"invoice_number"`
	RelatedTrans    []*Transaction `json:"-" gorm:"many2many:transaction_related"`
}

type SandboxInfo

type SandboxInfo struct {
	ID         string         `gorm:"primary_key"`
	SandboxIDs pq.StringArray `gorm:"type:text[]"`
}

type Schedule

type Schedule struct {
	ProductID    uint           `json:"-"`
	ID           uint           `json:"id" gorm:"primary_key"`
	TicketsAvail uint           `json:"ticketsAvail"`
	Start        time.Time      `json:"-"`
	End          time.Time      `json:"-"`
	TimeArray    []ScheduleTime `json:"timeArray"`
	Days         pq.Int64Array  `json:"selectedDays" gorm:"type:integer[]"`
	NotAvail     pq.StringArray `json:"notAvailArray,nilasempty" gorm:"type:text[]"`
	ShowAllCal   bool           `json:"showAll" gorm:"default:false"`
}

Schedule represents a full schedule that a Product can have multiple of

func (*Schedule) AfterUpdate

func (s *Schedule) AfterUpdate(tx *gorm.DB) (err error)

func (*Schedule) MarshalJSON

func (s *Schedule) MarshalJSON() ([]byte, error)

MarshalJSON handles the proper date formatting for schedules

func (*Schedule) UnmarshalJSON

func (s *Schedule) UnmarshalJSON(data []byte) (err error)

type ScheduleTime

type ScheduleTime struct {
	ID         uint   `json:"id"`
	ScheduleID uint   `json:"-"`
	StartTime  string `json:"startTime"`
	EndTime    string `json:"endTime"`
	Price      string `json:"price"`
}

ScheduleTime represents a specific trip time for the schedule

type Show

type Show struct {
	MerchantID string     `json:"-"`
	ID         int        `json:"id" gorm:"primary_key;auto_increment;"`
	CreatedAt  time.Time  `json:"-"`
	UpdatedAt  time.Time  `json:"-"`
	DeletedAt  *time.Time `json:"-"`
	Name       string     `json:"name"`
	Publish    bool       `json:"publish"`
	Desc       string     `json:"desc"`
	Price      string     `json:"price"`
	Dates      string     `json:"dates" gorm:"type:daterange"`
}

func (*Show) GetDates

func (s *Show) GetDates() (start, end time.Time, err error)

type TicketUsage

type TicketUsage struct {
	TicketID string `json:"ticket_id" gorm:"primary_key;type:varchar"`
	Used     bool   `json:"used"`
}

type Transaction

type Transaction struct {
	PaymentID string `json:"-" gorm:"primary_key"`
	Amount    amount `json:"amount" gorm:"embedded"`
	Payee     struct {
		MerchantID string `json:"merchant_id"`
		Email      string `json:"email"`
	} `json:"payee" gorm:"embedded;embedded_prefix:payee_"`
	Desc     string `json:"description"`
	SoftDesc string `json:"soft_descriptor"`
	ItemList struct {
		Items []Item `json:"items"`
	} `json:"item_list" gorm:"-"`

	RelatedResources []interface{} `gorm:"-"`
	Sales            []*Sale       `json:"-" gorm:"many2many:transaction_related;"`
}

func (*Transaction) AfterCreate

func (t *Transaction) AfterCreate(tx *gorm.DB) error

func (*Transaction) BeforeSave

func (t *Transaction) BeforeSave() error

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

type TransferReq

type TransferReq struct {
	LineItemID string `json:"id" gorm:"primary_key"`
	NewSKU     string `json:"newsku" gorm:"primary_key"`
	NewName    string `json:"newname"`
	OldSku     string `json:"oldsku"`
}

type WebHookEvent

type WebHookEvent struct {
	ID            string      `json:"id" gorm:"primary_key"`
	CreateTime    time.Time   `json:"create_time"`
	UpdatedAt     time.Time   `json:"-"`
	ResourceType  string      `json:"resource_type"`
	EventType     string      `json:"event_type"`
	Summary       string      `json:"summary"`
	Resource      interface{} `gorm:"-"`
	Status        string      `json:"status"`
	Transmissions []struct {
		WebhookURL     string `json:"webhook_url"`
		TransmissionID string `json:"transmission_id"`
		Status         string `json:"status"`
	} `json:"transmissions" gorm:"-"`
	Links        []Link         `json:"links" gorm:"-"`
	EventVersion float32        `json:"event_version,string"`
	RawMessage   postgres.Jsonb `json:"-"`
}

func (WebHookEvent) TableName

func (WebHookEvent) TableName() string

func (*WebHookEvent) UnmarshalJSON

func (w *WebHookEvent) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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