Documentation
¶
Index ¶
- type CartContext
- type CartItem
- type CompleteData
- type CompleteDataEnum
- type CompleteResponse
- type CreateCart
- func (c *CreateCart) Create(config *medusa.Config) (*CreateResponse, error)
- func (c *CreateCart) SetContext(context CartContext) *CreateCart
- func (c *CreateCart) SetCountryCode(countryCode string) *CreateCart
- func (c *CreateCart) SetItems(items []*CartItem) *CreateCart
- func (c *CreateCart) SetRegionId(regionId string) *CreateCart
- func (c *CreateCart) SetSalesChannelId(salesChannelId string) *CreateCart
- type CreateData
- type CreatePaymentSessionData
- type CreatePaymentSessionResponse
- type CreateResponse
- type DeleteDiscountData
- type DeleteDiscountResponse
- type DeletePaymentSessionData
- type DeletePaymentSessionResponse
- type Discount
- type GiftCard
- type RefreshPaymentSessionData
- type RefreshPaymentSessionResponse
- type RetrieveData
- type RetrieveResponse
- type SelectPaymentSession
- type SelectPaymentSessionData
- type SelectPaymentSessionResponse
- type ShippingMethod
- type ShippingMethodData
- type ShippingMethodResponse
- type UpdateCart
- func (u *UpdateCart) SetBillingAddress(address any) *UpdateCart
- func (u *UpdateCart) SetContext(context map[string]any) *UpdateCart
- func (u *UpdateCart) SetCountryCode(countryCode string) *UpdateCart
- func (u *UpdateCart) SetCustomerId(customerId string) *UpdateCart
- func (u *UpdateCart) SetDiscounts(discounts []*Discount) *UpdateCart
- func (u *UpdateCart) SetEmail(email string) *UpdateCart
- func (u *UpdateCart) SetGiftCards(giftCards []*GiftCard) *UpdateCart
- func (u *UpdateCart) SetRegionId(regionId string) *UpdateCart
- func (u *UpdateCart) SetSalesChannelId(salesChannelId string) *UpdateCart
- func (u *UpdateCart) SetShippingAddress(address any) *UpdateCart
- func (u *UpdateCart) Update(cartId string, config *medusa.Config) (*UpdateCartResponse, error)
- type UpdateCartData
- type UpdateCartResponse
- type UpdatePaymentSession
- type UpdatePaymentSessionData
- type UpdatePaymentSessionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CartContext ¶
type CompleteData ¶
type CompleteData struct { // The type of the data property. Type CompleteDataEnum `json:"type"` // Data will be one of order, cart and swap Data any `json:"data"` }
type CompleteDataEnum ¶
type CompleteDataEnum string
const ( CompleteOrder CompleteDataEnum = "order" CompleteCart CompleteDataEnum = "cart" CompleteSwap CompleteDataEnum = "swap" )
type CompleteResponse ¶
type CompleteResponse struct { // Success response Data *CompleteData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type CreateCart ¶
type CreateCart struct { RegionId string `json:"region_id,omitempty"` SalesChannelId string `json:"sales_channel_id,omitempty"` CountryCode string `json:"country_code,omitempty"` Items []*CartItem `json:"items,omitempty"` Context CartContext `json:"context,omitempty"` }
func NewCreateCart ¶
func NewCreateCart() *CreateCart
func (*CreateCart) Create ¶
func (c *CreateCart) Create(config *medusa.Config) (*CreateResponse, error)
func (*CreateCart) SetContext ¶
func (c *CreateCart) SetContext(context CartContext) *CreateCart
func (*CreateCart) SetCountryCode ¶
func (c *CreateCart) SetCountryCode(countryCode string) *CreateCart
func (*CreateCart) SetItems ¶
func (c *CreateCart) SetItems(items []*CartItem) *CreateCart
func (*CreateCart) SetRegionId ¶
func (c *CreateCart) SetRegionId(regionId string) *CreateCart
func (*CreateCart) SetSalesChannelId ¶
func (c *CreateCart) SetSalesChannelId(salesChannelId string) *CreateCart
type CreateData ¶
type CreatePaymentSessionResponse ¶
type CreatePaymentSessionResponse struct { // Success response Data *CreatePaymentSessionData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
func CreatePaymentSession ¶
func CreatePaymentSession(cartId string, config *medusa.Config) (*CreatePaymentSessionResponse, error)
type CreateResponse ¶
type CreateResponse struct { // Success response Data *CreateData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type DeleteDiscountData ¶
type DeleteDiscountResponse ¶
type DeleteDiscountResponse struct { // Success response Data *DeleteDiscountData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
func DeleteDiscount ¶
type DeletePaymentSessionResponse ¶
type DeletePaymentSessionResponse struct { // Success response Data *DeletePaymentSessionData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
func DeletePaymentSession ¶
func DeletePaymentSession(cartId, providerId string, config *medusa.Config) (*DeletePaymentSessionResponse, error)
type RefreshPaymentSessionResponse ¶
type RefreshPaymentSessionResponse struct { // Success response Data *RefreshPaymentSessionData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
func RefreshPaymentSession ¶
func RefreshPaymentSession(cartId, providerId string, config *medusa.Config) (*RefreshPaymentSessionResponse, error)
Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary.
type RetrieveData ¶
type RetrieveResponse ¶
type RetrieveResponse struct { // Success response Data *RetrieveData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type SelectPaymentSession ¶
type SelectPaymentSession struct {
ProviderId string `json:"provider_id"`
}
func NewSelectPaymentSession ¶
func NewSelectPaymentSession() *SelectPaymentSession
func (*SelectPaymentSession) Select ¶
func (p *SelectPaymentSession) Select(cartId string, config *medusa.Config) (*SelectPaymentSessionResponse, error)
Selects a Payment Session as the session intended to be used towards the completion of the Cart.
func (*SelectPaymentSession) SetProviderId ¶
func (p *SelectPaymentSession) SetProviderId(providerId string) *SelectPaymentSession
type SelectPaymentSessionResponse ¶
type SelectPaymentSessionResponse struct { // Success response Data *SelectPaymentSessionData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type ShippingMethod ¶
func NewShippingMethod ¶
func NewShippingMethod() *ShippingMethod
func (*ShippingMethod) Add ¶
func (s *ShippingMethod) Add(cartId string, config *medusa.Config) (*ShippingMethodResponse, error)
Adds a Shipping Method to the Cart.
func (*ShippingMethod) SetData ¶
func (s *ShippingMethod) SetData(data map[string]any) *ShippingMethod
func (*ShippingMethod) SetOptionId ¶
func (s *ShippingMethod) SetOptionId(optionId string) *ShippingMethod
type ShippingMethodData ¶
type ShippingMethodResponse ¶
type ShippingMethodResponse struct { // Success response Data *ShippingMethodData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type UpdateCart ¶
type UpdateCart struct { // The id of the Region to create the Cart in. RegionId string `json:"region_id"` // The 2 character ISO country code to create the Cart in. CountryCode string `json:"country_code"` // An email to be used on the Cart. Email string `json:"email"` // The ID of the Sales channel to update the Cart with. SalesChannelId string `json:"sales_channel_id"` // The Address to be used for billing purposes. BillingAddress any `json:"billing_address"` // The Address to be used for shipping. ShippingAddress any `json:"ipping_address"` // An array of Gift Card codes to add to the Cart. GiftCards []*GiftCard `json:"gift_cards"` // An array of Discount codes to add to the Cart. Discounts []*Discount `json:"discounts"` // The ID of the Customer to associate the Cart with. CustomerId string `json:"customer_id"` // An optional object to provide context to the Cart. Context map[string]any `json:"context"` }
func NewUpdateCart ¶
func NewUpdateCart() *UpdateCart
func (*UpdateCart) SetBillingAddress ¶
func (u *UpdateCart) SetBillingAddress(address any) *UpdateCart
func (*UpdateCart) SetContext ¶
func (u *UpdateCart) SetContext(context map[string]any) *UpdateCart
func (*UpdateCart) SetCountryCode ¶
func (u *UpdateCart) SetCountryCode(countryCode string) *UpdateCart
func (*UpdateCart) SetCustomerId ¶
func (u *UpdateCart) SetCustomerId(customerId string) *UpdateCart
func (*UpdateCart) SetDiscounts ¶
func (u *UpdateCart) SetDiscounts(discounts []*Discount) *UpdateCart
func (*UpdateCart) SetEmail ¶
func (u *UpdateCart) SetEmail(email string) *UpdateCart
func (*UpdateCart) SetGiftCards ¶
func (u *UpdateCart) SetGiftCards(giftCards []*GiftCard) *UpdateCart
func (*UpdateCart) SetRegionId ¶
func (u *UpdateCart) SetRegionId(regionId string) *UpdateCart
func (*UpdateCart) SetSalesChannelId ¶
func (u *UpdateCart) SetSalesChannelId(salesChannelId string) *UpdateCart
func (*UpdateCart) SetShippingAddress ¶
func (u *UpdateCart) SetShippingAddress(address any) *UpdateCart
func (*UpdateCart) Update ¶
func (u *UpdateCart) Update(cartId string, config *medusa.Config) (*UpdateCartResponse, error)
Updates a Cart.
type UpdateCartData ¶
type UpdateCartResponse ¶
type UpdateCartResponse struct { // Success response Data *UpdateCartData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
type UpdatePaymentSession ¶
func NewUpdatePaymentSession ¶
func NewUpdatePaymentSession() *UpdatePaymentSession
func (*UpdatePaymentSession) SetData ¶
func (u *UpdatePaymentSession) SetData(data map[string]any) *UpdatePaymentSession
func (*UpdatePaymentSession) Update ¶
func (u *UpdatePaymentSession) Update(cartId, providerId string, config *medusa.Config) (*UpdatePaymentSessionResponse, error)
type UpdatePaymentSessionResponse ¶
type UpdatePaymentSessionResponse struct { // Success response Data *UpdatePaymentSessionData // Error response Error *response.Error // Errors in case of multiple errors Errors *response.Errors }
Click to show internal directories.
Click to hide internal directories.