models

package
v0.0.0-...-993f9dd Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CartDefault     = "default"
	CartSwap        = "swap"
	CartDraftOrder  = "draft_order"
	CartPaymentLink = "payment_link"
	CartClaim       = "claim"
)

Defines values for CartType.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	core.SoftDeletableModel

	Address1    string        `json:"address_1" gorm:"column:address_1"`
	Address2    string        `json:"address_2" gorm:"column:address_2"`
	City        string        `json:"city" gorm:"column:city"`
	Company     string        `json:"company" gorm:"column:company"`
	Country     *Country      `json:"country" gorm:"foreignKey:CountryCode;foreignKey:Iso2"`
	CountryCode string        `json:"country_code" gorm:"column:country_code"`
	Customer    *Customer     `json:"customer" gorm:"foreignKey:CustomerId"`
	CustomerId  uuid.NullUUID `json:"customer_id" gorm:"column:customer_id"`
	FirstName   string        `json:"first_name" gorm:"column:first_name"`
	LastName    string        `json:"last_name" gorm:"column:last_name"`
	Phone       string        `json:"phone" gorm:"column:phone"`
	PostalCode  string        `json:"postal_code" gorm:"column:postal_code"`
	Province    string        `json:"province" gorm:"column:province"`
}

@oas:schema:Address title: "Address" description: "An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity." type: object required:

  • address_1
  • address_2
  • city
  • company
  • country_code
  • created_at
  • customer_id
  • deleted_at
  • first_name
  • id
  • last_name
  • metadata
  • phone
  • postal_code
  • province
  • updated_at

properties:

id:
  type: string
  description: ID of the address
  example: addr_01G8ZC9VS1XVE149MGH2J7QSSH
customer_id:
  description: ID of the customer this address belongs to
  nullable: true
  type: string
  example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
  description: Available if the relation `customer` is expanded.
  nullable: true
  $ref: "#/components/schemas/Customer"
company:
  description: Company name
  nullable: true
  type: string
  example: Acme
first_name:
  description: First name
  nullable: true
  type: string
  example: Arno
last_name:
  description: Last name
  nullable: true
  type: string
  example: Willms
address_1:
  description: Address line 1
  nullable: true
  type: string
  example: 14433 Kemmer Court
address_2:
  description: Address line 2
  nullable: true
  type: string
  example: Suite 369
city:
  description: City
  nullable: true
  type: string
  example: South Geoffreyview
country_code:
  description: The 2 character ISO code of the country in lower case
  nullable: true
  type: string
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
    description: See a list of codes.
  example: st
country:
  description: A country object.
  x-expandable: "country"
  nullable: true
  $ref: "#/components/schemas/Country"
province:
  description: Province
  nullable: true
  type: string
  example: Kentucky
postal_code:
  description: Postal Code
  nullable: true
  type: string
  example: 72093
phone:
  description: Phone Number
  nullable: true
  type: string
  example: 16128234334802
created_at:
  type: string
  description: "The date with timezone at which the resource was created."
  format: date-time
updated_at:
  type: string
  description: "The date with timezone at which the resource was updated."
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type AllocationType

type AllocationType string
const (
	AllocationTotal AllocationType = "total"
	AllocationItem  AllocationType = "item"
)

type AnalyticsConfig

type AnalyticsConfig struct {
	UserId    uuid.NullUUID `json:"user_id" gorm:"column:user_id;uniqueIndex"`
	OptOut    bool          `json:"opt_out" gorm:"column:opt_out;default:false"`
	Anonymize bool          `json:"anonymize" gorm:"column:anonymize;default:false"`
}

type BatchJob

type BatchJob struct {
	core.SoftDeletableModel

	Type           string          `json:"type" gorm:"column:type"`
	Status         BatchJobStatus  `json:"status" gorm:"column:status;default:'created'"`
	CreatedBy      uuid.NullUUID   `json:"created_by" gorm:"column:created_by"`
	CreatedByUser  *User           `json:"created_by_user" gorm:"foreignKey:CreatedBy"`
	Context        core.JSONB      `json:"context" gorm:"column:context"`
	DryRun         bool            `json:"dry_run" gorm:"column:dry_run;default:false"`
	Result         *BatchJobResult `json:"result" gorm:"column:result"`
	PreProcessedAt *time.Time      `json:"pre_processed_at" gorm:"column:pre_processed_at"`
	ProcessingAt   *time.Time      `json:"processing_at" gorm:"column:processing_at"`
	ConfirmedAt    *time.Time      `json:"confirmed_at" gorm:"column:confirmed_at"`
	CompletedAt    *time.Time      `json:"completed_at" gorm:"column:completed_at"`
	CanceledAt     *time.Time      `json:"canceled_at" gorm:"column:canceled_at"`
	FailedAt       *time.Time      `json:"failed_at" gorm:"column:failed_at"`
}

type BatchJobResult

type BatchJobResult struct {
	Count            float64                        `json:"count" gorm:"column:count"`
	AdvancementCount float64                        `json:"advancement_count" gorm:"column:advancement_count"`
	Progress         float64                        `json:"progress" gorm:"column:progress"`
	Errors           *BatchJobResultErrors          `json:"errors" gorm:"column:errors"`
	StatDescriptors  *BatchJobResultStatDescriptors `json:"stat_descriptors" gorm:"column:stat_descriptors"`
	FileKey          string                         `json:"file_key" gorm:"column:file_key"`
	FileSize         float64                        `json:"file_size" gorm:"column:file_size"`
}

BatchJobResult - The result of the batch job.

func (BatchJobResult) GormDataType

func (BatchJobResult) GormDataType() string

func (BatchJobResult) GormValue

func (b BatchJobResult) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (BatchJobResult) Interface

func (b BatchJobResult) Interface() interface{}

func (*BatchJobResult) Scan

func (b *BatchJobResult) Scan(value interface{}) error

type BatchJobResultErrors

type BatchJobResultErrors struct {
	Message string                    `json:"message" gorm:"column:message"`
	Code    *BatchJobResultErrorsCode `json:"code" gorm:"column:code"`
	Err     []string                  `json:"err" gorm:"column:err"`
}

type BatchJobResultErrorsCode

type BatchJobResultErrorsCode struct {
	Message string `json:"message" gorm:"column:message"`
	Code    string `json:"code" gorm:"column:code"`
}

type BatchJobResultStatDescriptors

type BatchJobResultStatDescriptors struct {
	Key     string `json:"key" gorm:"column:key"`
	Name    string `json:"name" gorm:"column:name"`
	Message string `json:"message" gorm:"column:message"`
}

type BatchJobStatus

type BatchJobStatus string

The status of the Price List

const (
	BatchJobStatusCreated      BatchJobStatus = "created"
	BatchJobStatusPreProcessed BatchJobStatus = "pre_processed"
	BatchJobStatusConfirmed    BatchJobStatus = "confirmed"
	BatchJobStatusProcessing   BatchJobStatus = "processing"
	BatchJobStatusCompleted    BatchJobStatus = "completed"
	BatchJobStatusCanceled     BatchJobStatus = "canceled"
	BatchJobStatusFailed       BatchJobStatus = "failed"
)

Defines values for BatchJobStatus.

func (*BatchJobStatus) Scan

func (pl *BatchJobStatus) Scan(value interface{}) error

func (BatchJobStatus) Value

func (pl BatchJobStatus) Value() (driver.Value, error)

type Cart

type Cart struct {
	core.SoftDeletableModel

	Email               string           `json:"email" gorm:"column:email"`
	BillingAddressId    uuid.NullUUID    `json:"billing_address_id" gorm:"column:billing_address_id"`
	BillingAddress      *Address         `json:"billing_address" gorm:"foreignKey:BillingAddressId"`
	ShippingAddressId   uuid.NullUUID    `json:"shipping_address_id" gorm:"column:shipping_address_id"`
	ShippingAddress     *Address         `json:"shipping_address" gorm:"foreignKey:ShippingAddressId"`
	Items               []LineItem       `json:"items" gorm:"foreignKey:Id"`
	RegionId            uuid.NullUUID    `json:"region_id" gorm:"column:region_id"`
	Region              *Region          `json:"region" gorm:"foreignKey:RegionId"`
	Discounts           []Discount       `json:"discounts" gorm:"many2many:cart_discounts"`
	GiftCards           []GiftCard       `json:"gift_cards" gorm:"many2many:cart_gift_cards"`
	CustomerId          uuid.NullUUID    `json:"customer_id" gorm:"column:customer_id"`
	Customer            *Customer        `json:"customer" gorm:"foreignKey:CustomerId"`
	PaymentSession      *PaymentSession  `json:"payment_session" gorm:"foreignKey:Id"`
	PaymentSessions     []PaymentSession `json:"payment_sessions" gorm:"foreignKey:Id"`
	PaymentId           uuid.NullUUID    `json:"payment_id" gorm:"column:payment_id"`
	Payment             *Payment         `json:"payment" gorm:"foreignKey:PaymentId"`
	ShippingMethods     []ShippingMethod `json:"shipping_methods" gorm:"foreignKey:Id"`
	Type                CartType         `json:"type" gorm:"column:type;default:'default'"`
	CompletedAt         *time.Time       `json:"completed_at" gorm:"column:completed_at"`
	PaymentAuthorizedAt *time.Time       `json:"payment_authorized_at" gorm:"column:payment_authorized_at"`
	IdempotencyKey      string           `json:"idempotency_key" gorm:"column:idempotency_key"`
	Context             core.JSONB       `json:"context" gorm:"column:context"`
	SalesChannelId      uuid.NullUUID    `json:"sales_channel_id" gorm:"column:sales_channel_id"`
	SalesChannel        *SalesChannel    `json:"sales_channel" gorm:"foreignKey:SalesChannelId"`
	ShippingTotal       float64          `json:"shipping_total" gorm:"column:shipping_total"`
	ShippingTaxTotal    float64          `json:"shipping_tax_total" gorm:"column:shipping_tax_total"`
	DiscountTotal       float64          `json:"discount_total" gorm:"column:discount_total"`
	RawDiscountTotal    float64          `json:"raw_discount_total" gorm:"column:raw_discount_total"`
	ItemTaxTotal        float64          `json:"item_tax_total" gorm:"column:item_tax_total"`
	TaxTotal            float64          `json:"tax_total" gorm:"column:tax_total"`
	RefundedTotal       float64          `json:"refunded_total" gorm:"column:refunded_total"`
	Total               float64          `json:"total" gorm:"column:total"`
	Subtotal            float64          `json:"subtotal" gorm:"column:subtotal"`
	RefundableAmount    float64          `json:"refundable_amount" gorm:"column:refundable_amount"`
	GiftCardTotal       float64          `json:"gift_card_total" gorm:"column:gift_card_total"`
	GiftCardTaxTotal    float64          `json:"gift_card_tax_total" gorm:"column:gift_card_tax_total"`
}

@oas:schema:Cart title: "Cart" description: "A cart represents a virtual shopping bag. It can be used to complete an order, a swap, or a claim." type: object required:

  • billing_address_id
  • completed_at
  • context
  • created_at
  • customer_id
  • deleted_at
  • email
  • id
  • idempotency_key
  • metadata
  • payment_authorized_at
  • payment_id
  • payment_session
  • region_id
  • shipping_address_id
  • type
  • updated_at

properties:

id:
  description: The cart's ID
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
email:
  description: The email associated with the cart
  nullable: true
  type: string
  format: email
billing_address_id:
  description: The billing address's ID
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
billing_address:
  description: The details of the billing address associated with the cart.
  x-expandable: "billing_address"
  nullable: true
  $ref: "#/components/schemas/Address"
shipping_address_id:
  description: The shipping address's ID
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
  description: The details of the shipping address associated with the cart.
  x-expandable: "shipping_address"
  nullable: true
  $ref: "#/components/schemas/Address"
items:
  description: The line items added to the cart.
  type: array
  x-expandable: "items"
  items:
    $ref: "#/components/schemas/LineItem"
region_id:
  description: The region's ID
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region associated with the cart.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
discounts:
  description: An array of details of all discounts applied to the cart.
  type: array
  x-expandable: "discounts"
  items:
    $ref: "#/components/schemas/Discount"
gift_cards:
  description: An array of details of all gift cards applied to the cart.
  type: array
  x-expandable: "gift_cards"
  items:
    $ref: "#/components/schemas/GiftCard"
customer_id:
  description: The customer's ID
  nullable: true
  type: string
  example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
  description: The details of the customer the cart belongs to.
  x-expandable: "customer"
  nullable: true
  $ref: "#/components/schemas/Customer"
payment_session:
  description: The details of the selected payment session in the cart.
  x-expandable: "payment_session"
  nullable: true
  $ref: "#/components/schemas/PaymentSession"
payment_sessions:
  description: The details of all payment sessions created on the cart.
  type: array
  x-expandable: "payment_sessions"
  items:
    $ref: "#/components/schemas/PaymentSession"
payment_id:
  description: The payment's ID if available
  nullable: true
  type: string
  example: pay_01G8ZCC5W42ZNY842124G7P5R9
payment:
  description: The details of the payment associated with the cart.
  nullable: true
  x-expandable: "payment"
  $ref: "#/components/schemas/Payment"
shipping_methods:
  description: The details of the shipping methods added to the cart.
  type: array
  x-expandable: "shipping_methods"
  items:
    $ref: "#/components/schemas/ShippingMethod"
type:
  description: The cart's type.
  type: string
  enum:
    - default
    - swap
    - draft_order
    - payment_link
    - claim
  default: default
completed_at:
  description: The date with timezone at which the cart was completed.
  nullable: true
  type: string
  format: date-time
payment_authorized_at:
  description: The date with timezone at which the payment was authorized.
  nullable: true
  type: string
  format: date-time
idempotency_key:
  description: Randomly generated key used to continue the completion of a cart in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
context:
  description: "The context of the cart which can include info like IP or user agent."
  nullable: true
  type: object
  example:
    ip: "::1"
    user_agent: "PostmanRuntime/7.29.2"
sales_channel_id:
  description: The sales channel ID the cart is associated with.
  nullable: true
  type: string
  example: null
sales_channel:
  description: The details of the sales channel associated with the cart.
  nullable: true
  x-expandable: "sales_channel"
  $ref: "#/components/schemas/SalesChannel"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
shipping_total:
  description: The total of shipping
  type: integer
  example: 1000
discount_total:
  description: The total of discount rounded
  type: integer
  example: 800
raw_discount_total:
  description: The total of discount
  type: integer
  example: 800
item_tax_total:
  description: The total of items with taxes
  type: integer
  example: 8000
shipping_tax_total:
  description: The total of shipping with taxes
  type: integer
  example: 1000
tax_total:
  description: The total of tax
  type: integer
  example: 0
refunded_total:
  description: The total amount refunded if the order associated with this cart is returned.
  type: integer
  example: 0
total:
  description: The total amount of the cart
  type: integer
  example: 8200
subtotal:
  description: The subtotal of the cart
  type: integer
  example: 8000
refundable_amount:
  description: The amount that can be refunded
  type: integer
  example: 8200
gift_card_total:
  description: The total of gift cards
  type: integer
  example: 0
gift_card_tax_total:
  description: The total of gift cards with taxes
  type: integer
  example: 0
sales_channels:
  description: The associated sales channels.
  type: array
  nullable: true
  x-expandable: "sales_channels"
  items:
    $ref: "#/components/schemas/SalesChannel"

type CartDiscount

type CartDiscount struct {
	CartId     uuid.NullUUID `gorm:"column:cart_id;type:character varying;primaryKey;index:IDX_6680319ebe1f46d18f106191d5,priority:1" json:"cart_id"`
	DiscountId uuid.NullUUID `` /* 126-byte string literal not displayed */
}

type CartGiftCard

type CartGiftCard struct {
	CartId     uuid.NullUUID `gorm:"column:cart_id;type:character varying;primaryKey;index:IDX_d38047a90f3d42f0be7909e8ae,priority:1" json:"cart_id"`
	GiftCardId uuid.NullUUID `` /* 128-byte string literal not displayed */
}

type CartSalesChannel

type CartSalesChannel struct {
	core.SoftDeletableModel

	CartId         uuid.NullUUID `` /* 127-byte string literal not displayed */
	SalesChannelId uuid.NullUUID `gorm:"column:sales_channel_id;type:character varying;primaryKey" json:"sales_channel_id"`
}

type CartType

type CartType string

The status of the Price List

func (*CartType) Scan

func (pl *CartType) Scan(value interface{}) error

func (CartType) Value

func (pl CartType) Value() (driver.Value, error)

type ClaimFulfillmentStatus

type ClaimFulfillmentStatus string
const (
	ClaimFulfillmentStatusNotFulfilled       ClaimFulfillmentStatus = "not_fulfilled"
	ClaimFulfillmentStatusPartiallyFulfilled ClaimFulfillmentStatus = "partially_fulfilled"
	ClaimFulfillmentStatusFulfilled          ClaimFulfillmentStatus = "fulfilled"
	ClaimFulfillmentStatusPartiallyShipped   ClaimFulfillmentStatus = "partially_shipped"
	ClaimFulfillmentStatusShipped            ClaimFulfillmentStatus = "shipped"
	ClaimFulfillmentStatusPartiallyReturned  ClaimFulfillmentStatus = "partially_returned"
	ClaimFulfillmentStatusReturned           ClaimFulfillmentStatus = "returned"
	ClaimFulfillmentStatusCanceled           ClaimFulfillmentStatus = "canceled"
	ClaimFulfillmentStatusRequiresAction     ClaimFulfillmentStatus = "requires_action"
)

func (*ClaimFulfillmentStatus) Scan

func (pl *ClaimFulfillmentStatus) Scan(value interface{}) error

func (ClaimFulfillmentStatus) Value

func (pl ClaimFulfillmentStatus) Value() (driver.Value, error)

type ClaimImage

type ClaimImage struct {
	core.SoftDeletableModel

	ClaimItemId uuid.NullUUID `json:"claim_item_id" gorm:"column:claim_item_id"`
	ClaimItem   *ClaimItem    `json:"claim_item" gorm:"foreignKey:ClaimItemId"`
	Url         string        `json:"url" gorm:"column:url"`
}

type ClaimItem

type ClaimItem struct {
	core.SoftDeletableModel

	Images       []ClaimImage    `json:"images" gorm:"foreignKey:Id"`
	ClaimOrderId uuid.NullUUID   `json:"claim_order_id" gorm:"column:claim_order_id"`
	ClaimOrder   *ClaimOrder     `json:"claim_order" gorm:"foreignKey:ClaimOrderId"`
	ItemId       uuid.NullUUID   `json:"item_id" gorm:"column:item_id"`
	Item         *LineItem       `json:"item" gorm:"foreignKey:ItemId"`
	VariantId    uuid.NullUUID   `json:"variant_id" gorm:"column:variant_id"`
	Variant      *ProductVariant `json:"variant" gorm:"foreignKey:VariantId"`
	Reason       ClaimReasonType `json:"reason" gorm:"column:reason"`
	Note         string          `json:"note" gorm:"column:note"`
	Quantity     int             `json:"quantity" gorm:"column:quantity"`
	Tags         []ClaimTag      `json:"tags" gorm:"many2many:claim_item_tags"`
}

@oas:schema:ClaimItem title: "Claim Item" description: "A claim item is an item created as part of a claim. It references an item in the order that should be exchanged or refunded." type: object required:

  • claim_order_id
  • created_at
  • deleted_at
  • id
  • item_id
  • metadata
  • note
  • quantity
  • reason
  • updated_at
  • variant_id

properties:

id:
  description: The claim item's ID
  type: string
  example: citm_01G8ZH853Y6TFXWPG5EYE81X63
images:
  description: The claim images that are attached to the claim item.
  type: array
  x-expandable: "images"
  items:
    $ref: "#/components/schemas/ClaimImage"
claim_order_id:
  description: The ID of the claim this item is associated with.
  type: string
claim_order:
  description: The details of the claim this item belongs to.
  x-expandable: "claim_order"
  nullable: true
  $ref: "#/components/schemas/ClaimOrder"
item_id:
  description: The ID of the line item that the claim item refers to.
  type: string
  example: item_01G8ZM25TN49YV9EQBE2NC27KC
item:
  description: The details of the line item in the original order that this claim item refers to.
  x-expandable: "item"
  nullable: true
  $ref: "#/components/schemas/LineItem"
variant_id:
  description: The ID of the product variant that is claimed.
  type: string
  example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
  description: The details of the product variant to potentially replace the item in the original order.
  x-expandable: "variant"
  nullable: true
  $ref: "#/components/schemas/ProductVariant"
reason:
  description: The reason for the claim
  type: string
  enum:
    - missing_item
    - wrong_item
    - production_failure
    - other
note:
  description: An optional note about the claim, for additional information
  nullable: true
  type: string
  example: "I don't like it."
quantity:
  description: The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order.
  type: integer
  example: 1
tags:
  description: User defined tags for easy filtering and grouping.
  type: array
  x-expandable: "tags"
  items:
    $ref: "#/components/schemas/ClaimTag"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ClaimItemTag

type ClaimItemTag struct {
	ItemId uuid.NullUUID `gorm:"column:item_id;type:character varying;primaryKey;index:IDX_c2c0f3edf39515bd15432afe6e,priority:1" json:"item_id"`
	TagId  uuid.NullUUID `gorm:"column:tag_id;type:character varying;primaryKey;index:IDX_dc9bbf9fcb9ba458d25d512811,priority:1" json:"tag_id"`
}

type ClaimOrder

type ClaimOrder struct {
	core.SoftDeletableModel

	Type              ClaimStatus            `json:"type" gorm:"column:type;default:'na'"`
	PaymentStatus     ClaimPaymentStatus     `json:"payment_status" gorm:"column:payment_status;default:'not_fulfilled'"`
	FulfillmentStatus ClaimFulfillmentStatus `json:"fulfillment_status" gorm:"column:fulfillment_status"`
	ClaimItems        []ClaimItem            `json:"claim_items" gorm:"foreignKey:Id"`
	AdditionalItems   []LineItem             `json:"additional_items" gorm:"foreignKey:Id"`
	OrderId           uuid.NullUUID          `json:"order_id" gorm:"column:order_id"`
	Order             *Order                 `json:"order" gorm:"foreignKey:OrderId"`
	ReturnOrder       *Return                `json:"return_order" gorm:"foreignKey:Id"`
	ShippingAddressId uuid.NullUUID          `json:"shipping_address_id" gorm:"column:shipping_address_id"`
	ShippingAddress   *Address               `json:"shipping_address" gorm:"foreignKey:ShippingAddressId"`
	ShippingMethods   []ShippingMethod       `json:"shipping_methods" gorm:"foreignKey:Id"`
	Fulfillments      []Fulfillment          `json:"fulfillments" gorm:"foreignKey:Id"`
	RefundAmount      float64                `json:"refund_amount" gorm:"column:refund_amount"`
	CanceledAt        *time.Time             `json:"canceled_at" gorm:"column:canceled_at"`
	NoNotification    bool                   `json:"no_notification" gorm:"column:no_notification"`
	IdempotencyKey    string                 `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:ClaimOrder title: "Claim" description: "A Claim represents a group of faulty or missing items. It consists of claim items that refer to items in the original order that should be replaced or refunded. It also includes details related to shipping and fulfillment." type: object required:

  • canceled_at
  • created_at
  • deleted_at
  • fulfillment_status
  • id
  • idempotency_key
  • metadata
  • no_notification
  • order_id
  • payment_status
  • refund_amount
  • shipping_address_id
  • type
  • updated_at

properties:

id:
  description: The claim's ID
  type: string
  example: claim_01G8ZH853Y6TFXWPG5EYE81X63
type:
  description: The claim's type
  type: string
  enum:
    - refund
    - replace
payment_status:
  description: The status of the claim's payment
  type: string
  enum:
    - na
    - not_refunded
    - refunded
  default: na
fulfillment_status:
  description: The claim's fulfillment status
  type: string
  enum:
    - not_fulfilled
    - partially_fulfilled
    - fulfilled
    - partially_shipped
    - shipped
    - partially_returned
    - returned
    - canceled
    - requires_action
  default: not_fulfilled
claim_items:
  description: The details of the items that should be replaced or refunded.
  type: array
  x-expandable: "claim_items"
  items:
    $ref: "#/components/schemas/ClaimItem"
additional_items:
  description: The details of the new items to be shipped when the claim's type is `replace`
  type: array
  x-expandable: "additional_items"
  items:
    $ref: "#/components/schemas/LineItem"
order_id:
  description: The ID of the order that the claim comes from.
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that this claim was created for.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
return_order:
  description: The details of the return associated with the claim if the claim's type is `replace`.
  x-expandable: "return_order"
  nullable: true
  $ref: "#/components/schemas/Return"
shipping_address_id:
  description: The ID of the address that the new items should be shipped to
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
  description: The details of the address that new items should be shipped to.
  x-expandable: "shipping_address"
  nullable: true
  $ref: "#/components/schemas/Address"
shipping_methods:
  description: The details of the shipping methods that the claim order will be shipped with.
  type: array
  x-expandable: "shipping_methods"
  items:
    $ref: "#/components/schemas/ShippingMethod"
fulfillments:
  description: The fulfillments of the new items to be shipped
  type: array
  x-expandable: "fulfillments"
  items:
    $ref: "#/components/schemas/Fulfillment"
refund_amount:
  description: The amount that will be refunded in conjunction with the claim
  nullable: true
  type: integer
  example: 1000
canceled_at:
  description: The date with timezone at which the claim was canceled.
  nullable: true
  type: string
  format: date-time
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
no_notification:
  description: Flag for describing whether or not notifications related to this should be send.
  nullable: true
  type: boolean
  example: false
idempotency_key:
  description: Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.

type ClaimPaymentStatus

type ClaimPaymentStatus string
const (
	ClaimPaymentStatusNa          ClaimPaymentStatus = "na"
	ClaimPaymentStatusNotRefunded ClaimPaymentStatus = "not_refunded"
	ClaimPaymentStatusRefunded    ClaimPaymentStatus = "refunded"
)

func (*ClaimPaymentStatus) Scan

func (pl *ClaimPaymentStatus) Scan(value interface{}) error

func (ClaimPaymentStatus) Value

func (pl ClaimPaymentStatus) Value() (driver.Value, error)

type ClaimReasonType

type ClaimReasonType string
const (
	ClaimReasonTypeMissingItem       ClaimReasonType = "missing_item"
	ClaimReasonTypeWrongItem         ClaimReasonType = "wrong_item"
	ClaimReasonTypeProductionFailure ClaimReasonType = "production_failure"
	ClaimReasonTypeOther             ClaimReasonType = "other"
)

func (*ClaimReasonType) Scan

func (pl *ClaimReasonType) Scan(value interface{}) error

func (ClaimReasonType) Value

func (pl ClaimReasonType) Value() (driver.Value, error)

type ClaimStatus

type ClaimStatus string

The status of the Price List

const (
	ClaimStatusReplace ClaimStatus = "replace"
	ClaimStatusRefund  ClaimStatus = "refund"
)

Defines values for ClaimStatus.

func (*ClaimStatus) Scan

func (pl *ClaimStatus) Scan(value interface{}) error

func (ClaimStatus) Value

func (pl ClaimStatus) Value() (driver.Value, error)

type ClaimTag

type ClaimTag struct {
	Id    uuid.NullUUID `json:"id" gorm:"column:id;primarykey"`
	Value string        `json:"value" gorm:"column:value"`
}

@oas:schema:ClaimTag title: "Claim Tag" description: "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping." type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • updated_at
  • value

properties:

id:
  description: The claim tag's ID
  type: string
  example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4
value:
  description: The value that the claim tag holds
  type: string
  example: Damaged
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type Country

type Country struct {
	core.SoftDeletableModel

	Iso2        string        `json:"iso_2" gorm:"column:iso_2;uniqueIndex"`
	Iso3        string        `json:"iso_3" gorm:"column:iso_3"`
	NumCode     string        `json:"num_code" gorm:"column:num_code"`
	Name        string        `json:"name" gorm:"column:name"`
	DisplayName string        `json:"display_name" gorm:"column:display_name"`
	RegionId    uuid.NullUUID `json:"region_id" gorm:"column:region_id"`
	Region      *Region       `json:"region" gorm:"foreignKey:RegionId"`
}

type Currency

type Currency struct {
	Code         string `json:"code" gorm:"column:code;primarykey"`
	Symbol       string `json:"symbol" gorm:"column:symbol"`
	SymbolNative string `json:"symbol_native" gorm:"column:symbol_native"`
	Name         string `json:"name" gorm:"column:name"`
	IncludesTax  bool   `json:"includes_tax" gorm:"column:includes_tax"`
}

type CustomShippingOption

type CustomShippingOption struct {
	core.SoftDeletableModel

	Price            float64         `json:"price" gorm:"column:price"`
	ShippingOptionId uuid.NullUUID   `json:"shipping_option_id" gorm:"column:shipping_option_id"`
	ShippingOption   *ShippingOption `json:"shipping_option" gorm:"foreignKey:ShippingOptionId"`
	CartId           uuid.NullUUID   `json:"cart_id" gorm:"column:cart_id"`
	Cart             *Cart           `json:"cart" gorm:"foreignKey:CartId"`
	IncludesTax      bool            `json:"includes_tax" gorm:"column:includes_tax"`
}

@oas:schema:CustomShippingOption title: "Custom Shipping Option" description: "Custom Shipping Options are overridden Shipping Options. Admins can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option." type: object required:

  • cart_id
  • created_at
  • deleted_at
  • id
  • metadata
  • price
  • shipping_option_id
  • updated_at

properties:

id:
  description: The custom shipping option's ID
  type: string
  example: cso_01G8X99XNB77DMFBJFWX6DN9V9
price:
  description: The custom price set that will override the shipping option's original price
  type: integer
  example: 1000
shipping_option_id:
  description: The ID of the Shipping Option that the custom shipping option overrides
  type: string
  example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
  description: The details of the overridden shipping options.
  x-expandable: "shipping_option"
  nullable: true
  $ref: "#/components/schemas/ShippingOption"
cart_id:
  description: The ID of the Cart that the custom shipping option is attached to
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart this shipping option belongs to.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type Customer

type Customer struct {
	core.SoftDeletableModel

	Email             string          `json:"email" gorm:"column:email"`
	FirstName         string          `json:"first_name" gorm:"column:first_name"`
	LastName          string          `json:"last_name" gorm:"column:last_name"`
	BillingAddressId  uuid.NullUUID   `json:"billing_address_id" gorm:"column:billing_address_id"`
	BillingAddress    *Address        `json:"billing_address" gorm:"foreignKey:BillingAddressId"`
	ShippingAddresses []Address       `json:"shipping_addresses" gorm:"foreignKey:Id"`
	PasswordHash      string          `json:"password_hash" gorm:"column:password_hash"`
	Phone             string          `json:"phone" gorm:"column:phone"`
	HasAccount        bool            `json:"has_account" gorm:"column:has_account;default:false"`
	Orders            []Order         `json:"orders" gorm:"foreignKey:Id"`
	Groups            []CustomerGroup `json:"groups" gorm:"many2many:customer_group_customers"`
}

type CustomerGroup

type CustomerGroup struct {
	core.SoftDeletableModel

	Name       string      `json:"name" gorm:"column:name"`
	Customers  []Customer  `json:"customers" gorm:"many2many:customer_group_customers"`
	PriceLists []PriceList `json:"price_lists" gorm:"many2many:price_list_customer_groups"`
}

type CustomerGroupCustomer

type CustomerGroupCustomer struct {
	CustomerGroupId uuid.NullUUID `` /* 138-byte string literal not displayed */
	CustomerId      uuid.NullUUID `` /* 126-byte string literal not displayed */
}

type Discount

type Discount struct {
	core.SoftDeletableModel

	Code             string        `json:"code" gorm:"column:code"`
	IsDynamic        bool          `json:"is_dynamic" gorm:"column:is_dynamic"`
	RuleId           uuid.NullUUID `json:"rule_id" gorm:"column:rule_id"`
	Rule             *DiscountRule `json:"rule" gorm:"foreignKey:RuleId"`
	IsDisabled       bool          `json:"is_disabled" gorm:"column:is_disabled"`
	ParentDiscountId uuid.NullUUID `json:"parent_discount_id" gorm:"column:parent_discount_id"`
	ParentDiscount   *Discount     `json:"parent_discount" gorm:"foreignKey:ParentDiscountId"`
	StartsAt         *time.Time    `json:"starts_at" gorm:"column:starts_at;default:'CURRENT_TIMESTAMP'"`
	EndsAt           *time.Time    `json:"ends_at" gorm:"column:ends_at"`
	ValidDuration    *time.Time    `json:"valid_duration" gorm:"column:valid_duration"`
	Regions          []Region      `json:"regions" gorm:"many2many:discount_regions"`
	UsageLimit       int           `json:"usage_limit" gorm:"column:usage_limit"`
	UsageCount       int           `json:"usage_count" gorm:"column:usage_count;default:0"`
}

@oas:schema:Discount title: "Discount" description: "A discount can be applied to a cart for promotional purposes." type: object required:

  • code
  • created_at
  • deleted_at
  • ends_at
  • id
  • is_disabled
  • is_dynamic
  • metadata
  • parent_discount_id
  • rule_id
  • starts_at
  • updated_at
  • usage_count
  • usage_limit
  • valid_duration

properties:

id:
  description: The discount's ID
  type: string
  example: disc_01F0YESMW10MGHWJKZSDDMN0VN
code:
  description: A unique code for the discount - this will be used by the customer to apply the discount
  type: string
  example: 10DISC
is_dynamic:
  description: A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts
  type: boolean
  example: false
rule_id:
  description: The ID of the discount rule that defines how the discount will be applied to a cart.
  nullable: true
  type: string
  example: dru_01F0YESMVK96HVX7N419E3CJ7C
rule:
  description: The details of the discount rule that defines how the discount will be applied to a cart..
  x-expandable: "rule"
  nullable: true
  $ref: "#/components/schemas/DiscountRule"
is_disabled:
  description: Whether the Discount has been disabled. Disabled discounts cannot be applied to carts
  type: boolean
  example: false
parent_discount_id:
  description: The Discount that the discount was created from. This will always be a dynamic discount
  nullable: true
  type: string
  example: disc_01G8ZH853YPY9B94857DY91YGW
parent_discount:
  description: The details of the parent discount that this discount was created from.
  x-expandable: "parent_discount"
  nullable: true
  $ref: "#/components/schemas/Discount"
starts_at:
  description: The time at which the discount can be used.
  type: string
  format: date-time
ends_at:
  description: The time at which the discount can no longer be used.
  nullable: true
  type: string
  format: date-time
valid_duration:
  description: Duration the discount runs between
  nullable: true
  type: string
  example: P3Y6M4DT12H30M5S
regions:
  description: The details of the regions in which the Discount can be used.
  type: array
  x-expandable: "regions"
  items:
    $ref: "#/components/schemas/Region"
usage_limit:
  description: The maximum number of times that a discount can be used.
  nullable: true
  type: integer
  example: 100
usage_count:
  description: The number of times a discount has been used.
  type: integer
  example: 50
  default: 0
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountCondition

type DiscountCondition struct {
	core.SoftDeletableModel

	Type               DiscountConditionType     `json:"type" gorm:"column:type"`
	Operator           DiscountConditionOperator `json:"operator" gorm:"column:operator"`
	DiscountRuleId     uuid.NullUUID             `json:"discount_rule_id" gorm:"column:discount_rule_id"`
	DiscountRule       *DiscountRule             `json:"discount_rule" gorm:"foreignKey:DiscountRuleId"`
	Products           []Product                 `json:"products" gorm:"many2many:discount_condition_product"`
	ProductTypes       []ProductType             `json:"product_types" gorm:"many2many:discount_condition_product_type"`
	ProductTags        []ProductTag              `json:"product_tags" gorm:"many2many:discount_condition_product_tag"`
	ProductCollections []ProductCollection       `json:"product_collections" gorm:"many2many:discount_condition_product_collection"`
	CustomerGroups     []CustomerGroup           `json:"customer_groups" gorm:"many2many:discount_condition_customer_group"`
}

@oas:schema:DiscountCondition title: "Discount Condition" description: "Holds rule conditions for when a discount is applicable" type: object required:

  • created_at
  • deleted_at
  • discount_rule_id
  • id
  • metadata
  • operator
  • type
  • updated_at

properties:

id:
  description: The discount condition's ID
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
type:
  description: "The type of the condition. The type affects the available resources associated with the condition. For example, if the type is `products`,
   that means the `products` relation will hold the products associated with this condition and other relations will be empty."
  type: string
  enum:
    - products
    - product_types
    - product_collections
    - product_tags
    - customer_groups
operator:
  description: >-
    The operator of the condition. `in` indicates that discountable resources are within the specified resources. `not_in` indicates that
    discountable resources are everything but the specified resources.
  type: string
  enum:
    - in
    - not_in
discount_rule_id:
  description: The ID of the discount rule associated with the condition
  type: string
  example: dru_01F0YESMVK96HVX7N419E3CJ7C
discount_rule:
  description: The details of the discount rule associated with the condition.
  x-expandable: "discount_rule"
  nullable: true
  $ref: "#/components/schemas/DiscountRule"
products:
  description: products associated with this condition if `type` is `products`.
  type: array
  x-expandable: "products"
  items:
    $ref: "#/components/schemas/Product"
product_types:
  description: Product types associated with this condition if `type` is `product_types`.
  type: array
  x-expandable: "product_types"
  items:
    $ref: "#/components/schemas/ProductType"
product_tags:
  description: Product tags associated with this condition if `type` is `product_tags`.
  type: array
  x-expandable: "product_tags"
  items:
    $ref: "#/components/schemas/ProductTag"
product_collections:
  description: Product collections associated with this condition if `type` is `product_collections`.
  type: array
  x-expandable: "product_collections"
  items:
    $ref: "#/components/schemas/ProductCollection"
customer_groups:
  description: Customer groups associated with this condition if `type` is `customer_groups`.
  type: array
  x-expandable: "customer_groups"
  items:
    $ref: "#/components/schemas/CustomerGroup"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionCustomerGroup

type DiscountConditionCustomerGroup struct {
	CustomerGroupId   uuid.NullUUID      `json:"customer_group_id" gorm:"column:customer_group_id;primary_key"`
	ConditionId       uuid.NullUUID      `json:"condition_id" gorm:"column:condition_id;primary_key"`
	CustomerGroup     *CustomerGroup     `json:"customer_group" gorm:"foreignKey:CustomerGroupId"`
	DiscountCondition *DiscountCondition `json:"discount_condition" gorm:"foreignKey:ConditionId"`
	CreatedAt         time.Time          `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt         time.Time          `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata          core.JSONB         `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:DiscountConditionCustomerGroup title: "Product Tag Discount Condition" description: "Associates a discount condition with a customer group" type: object required:

  • condition_id
  • created_at
  • customer_group_id
  • metadata
  • updated_at

properties:

customer_group_id:
  description: The ID of the Product Tag
  type: string
  example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63
condition_id:
  description: The ID of the Discount Condition
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
customer_group:
  description: Available if the relation `customer_group` is expanded.
  nullable: true
  $ref: "#/components/schemas/CustomerGroup"
discount_condition:
  description: Available if the relation `discount_condition` is expanded.
  nullable: true
  $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionOperator

type DiscountConditionOperator string

func (*DiscountConditionOperator) Scan

func (pl *DiscountConditionOperator) Scan(value interface{}) error

func (DiscountConditionOperator) Value

type DiscountConditionProduct

type DiscountConditionProduct struct {
	ProductId         uuid.NullUUID      `json:"product_id" gorm:"column:product_id;primary_key"`
	ConditionId       uuid.NullUUID      `json:"condition_id" gorm:"column:condition_id;primary_key"`
	Product           *Product           `json:"product" gorm:"foreignKey:ProductId"`
	DiscountCondition *DiscountCondition `json:"discount_condition" gorm:"foreignKey:ConditionId"`
	CreatedAt         time.Time          `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt         time.Time          `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata          core.JSONB         `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:DiscountConditionProduct title: "Product Discount Condition" description: "This represents the association between a discount condition and a product" type: object required:

  • condition_id
  • created_at
  • metadata
  • product_id
  • updated_at

properties:

product_id:
  description: The ID of the Product Tag
  type: string
  example: prod_01G1G5V2MBA328390B5AXJ610F
condition_id:
  description: The ID of the Discount Condition
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product:
  description: The details of the product.
  x-expandable: "product"
  nullable: true
  $ref: "#/components/schemas/Product"
discount_condition:
  description: The details of the discount condition.
  x-expandable: "discount_condition"
  nullable: true
  $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionProductCollection

type DiscountConditionProductCollection struct {
	ProductCollectionId uuid.NullUUID      `json:"product_collection_id" gorm:"column:product_collection_id;primary_key"`
	ConditionId         uuid.NullUUID      `json:"condition_id" gorm:"column:condition_id;primary_key"`
	ProductCollection   *ProductCollection `json:"product_collection" gorm:"foreignKey:ProductCollectionId"`
	DiscountCondition   *DiscountCondition `json:"discount_condition" gorm:"foreignKey:ConditionId"`
	CreatedAt           time.Time          `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt           time.Time          `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata            core.JSONB         `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:DiscountConditionProductCollection title: "Product Collection Discount Condition" description: "This represents the association between a discount condition and a product collection" type: object required:

  • condition_id
  • created_at
  • metadata
  • product_collection_id
  • updated_at

properties:

product_collection_id:
  description: The ID of the Product Collection
  type: string
  example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
condition_id:
  description: The ID of the Discount Condition
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_collection:
  description: The details of the product collection.
  x-expandable: "product_collection"
  nullable: true
  $ref: "#/components/schemas/ProductCollection"
discount_condition:
  description: The details of the discount condition.
  x-expandable: "discount_condition"
  nullable: true
  $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionProductTag

type DiscountConditionProductTag struct {
	ProductTagId      uuid.NullUUID      `json:"product_tag_id" gorm:"column:product_tag_id;primary_key"`
	ConditionId       uuid.NullUUID      `json:"condition_id" gorm:"column:condition_id;primary_key"`
	ProductTag        *ProductTag        `json:"product_tag" gorm:"foreignKey:ProductTagId"`
	DiscountCondition *DiscountCondition `json:"discount_condition" gorm:"foreignKey:ConditionId"`
	CreatedAt         time.Time          `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt         time.Time          `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata          core.JSONB         `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:DiscountConditionProductTag title: "Product Tag Discount Condition" description: "This represents the association between a discount condition and a product tag" type: object required:

  • condition_id
  • created_at
  • metadata
  • product_tag_id
  • updated_at

properties:

product_tag_id:
  description: The ID of the Product Tag
  type: string
  example: ptag_01F0YESHPZYY3H4SJ3A5918SBN
condition_id:
  description: The ID of the Discount Condition
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_tag:
  description: The details of the product tag.
  x-expandable: "product_tag"
  nullable: true
  $ref: "#/components/schemas/ProductTag"
discount_condition:
  description: The details of the discount condition.
  x-expandable: "discount_condition"
  nullable: true
  $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionProductType

type DiscountConditionProductType struct {
	ProductTypeId     uuid.NullUUID      `json:"product_type_id" gorm:"column:product_type_id;primaryKey"`
	ConditionId       uuid.NullUUID      `json:"condition_id" gorm:"column:condition_id;primaryKey"`
	ProductType       *ProductType       `json:"product_type" gorm:"foreignKey:ProductTypeId"`
	DiscountCondition *DiscountCondition `json:"discount_condition" gorm:"foreignKey:ConditionId"`
	CreatedAt         time.Time          `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt         time.Time          `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata          core.JSONB         `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:DiscountConditionProductType title: "Product Type Discount Condition" description: "This represents the association between a discount condition and a product type" type: object required:

  • condition_id
  • created_at
  • metadata
  • product_type_id
  • updated_at

properties:

product_type_id:
  description: The ID of the Product Tag
  type: string
  example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
condition_id:
  description: The ID of the Discount Condition
  type: string
  example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_type:
  description: The details of the product type.
  x-expandable: "product_type"
  nullable: true
  $ref: "#/components/schemas/ProductType"
discount_condition:
  description: The details of the discount condition.
  x-expandable: "discount_condition"
  nullable: true
  $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountConditionType

type DiscountConditionType string

The status of the Price List

const (
	DiscountConditionTypeProducts           DiscountConditionType = "products"
	DiscountConditionTypeProductTypes       DiscountConditionType = "product_types"
	DiscountConditionTypeProductCollections DiscountConditionType = "product_collections"
	DiscountConditionTypeProductTags        DiscountConditionType = "product_tags"
	DiscountConditionTypeCustomerGroups     DiscountConditionType = "customer_groups"
)

Defines values for DiscountConditionType.

const (
	DiscountConditionOperatorIn    DiscountConditionType = "in"
	DiscountConditionOperatorNotIn DiscountConditionType = "not_in"
)

Defines values for DiscountConditionType.

func (*DiscountConditionType) Scan

func (pl *DiscountConditionType) Scan(value interface{}) error

func (DiscountConditionType) Value

func (pl DiscountConditionType) Value() (driver.Value, error)

type DiscountRegion

type DiscountRegion struct {
	DiscountId uuid.NullUUID `` /* 126-byte string literal not displayed */
	RegionId   uuid.NullUUID `gorm:"column:region_id;type:character varying;primaryKey;index:IDX_a21a7ffbe420d492eb46c305fe,priority:1" json:"region_id"`
}

type DiscountRule

type DiscountRule struct {
	core.SoftDeletableModel

	Type        DiscountRuleType    `json:"type" gorm:"column:type"`
	Description string              `json:"description" gorm:"column:description"`
	Value       float64             `json:"value" gorm:"column:value"`
	Allocation  AllocationType      `json:"allocation" gorm:"column:allocation"`
	Conditions  []DiscountCondition `json:"conditions" gorm:"foreignKey:Id"`
}

@oas:schema:DiscountRule title: "Discount Rule" description: "A discount rule defines how a Discount is calculated when applied to a Cart." type: object required:

  • allocation
  • created_at
  • deleted_at
  • description
  • id
  • metadata
  • type
  • updated_at
  • value

properties:

id:
  description: The discount rule's ID
  type: string
  example: dru_01F0YESMVK96HVX7N419E3CJ7C
type:
  description: >-
    The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.
  type: string
  enum:
    - fixed
    - percentage
    - free_shipping
  example: percentage
description:
  description: A short description of the discount
  nullable: true
  type: string
  example: 10 Percent
value:
  description: The value that the discount represents; this will depend on the type of the discount
  type: integer
  example: 10
allocation:
  description: The scope that the discount should apply to.
  nullable: true
  type: string
  enum:
    - total
    - item
  example: total
conditions:
  description: The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.
  type: array
  x-expandable: "conditions"
  items:
    $ref: "#/components/schemas/DiscountCondition"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DiscountRuleProduct

type DiscountRuleProduct struct {
	DiscountRuleId uuid.NullUUID `` /* 136-byte string literal not displayed */
	ProductId      uuid.NullUUID `gorm:"column:product_id;type:character varying;primaryKey;index:IDX_be66106a673b88a81c603abe7e,priority:1" json:"product_id"`
}

type DiscountRuleType

type DiscountRuleType string
const (
	DiscountRuleFixed        DiscountRuleType = "fixed"
	DiscountRulePersentage   DiscountRuleType = "percentage"
	DiscountRuleFreeShipping DiscountRuleType = "free_shipping"
)

func (*DiscountRuleType) Scan

func (pl *DiscountRuleType) Scan(value interface{}) error

func (DiscountRuleType) Value

func (pl DiscountRuleType) Value() (driver.Value, error)

type DraftOrder

type DraftOrder struct {
	core.BaseModel

	Status              DraftOrderStatus `json:"status" gorm:"column:status;default:'open'"`
	DisplayId           uuid.NullUUID    `json:"display_id" gorm:"column:display_id"`
	CartId              uuid.NullUUID    `json:"cart_id" gorm:"column:cart_id"`
	Cart                *Cart            `json:"cart" gorm:"foreignKey:CartId"`
	OrderId             uuid.NullUUID    `json:"order_id" gorm:"column:order_id"`
	Order               *Order           `json:"order" gorm:"foreignKey:OrderId"`
	CanceledAt          *time.Time       `json:"canceled_at" gorm:"column:canceled_at"`
	CompletedAt         *time.Time       `json:"completed_at" gorm:"column:completed_at"`
	NoNotificationOrder bool             `json:"no_notification_order" gorm:"column:no_notification_order"`
	IdempotencyKey      string           `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:DraftOrder title: "DraftOrder" description: "A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order." type: object required:

  • canceled_at
  • cart_id
  • completed_at
  • created_at
  • display_id
  • id
  • idempotency_key
  • metadata
  • no_notification_order
  • order_id
  • status
  • updated_at

properties:

id:
  description: The draft order's ID
  type: string
  example: dorder_01G8TJFKBG38YYFQ035MSVG03C
status:
  description: The status of the draft order. It's changed to `completed` when it's transformed to an order.
  type: string
  enum:
    - open
    - completed
  default: open
display_id:
  description: The draft order's display ID
  type: string
  example: 2
cart_id:
  description: The ID of the cart associated with the draft order.
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart associated with the draft order.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
order_id:
  description: The ID of the order created from the draft order when its payment is captured.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order created from the draft order when its payment is captured.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
canceled_at:
  description: The date the draft order was canceled at.
  nullable: true
  type: string
  format: date-time
completed_at:
  description: The date the draft order was completed at.
  nullable: true
  type: string
  format: date-time
no_notification_order:
  description: Whether to send the customer notifications regarding order updates.
  nullable: true
  type: boolean
  example: false
idempotency_key:
  description: Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type DraftOrderStatus

type DraftOrderStatus string

The status of the Price List

const (
	DraftOrderStatusCompleted DraftOrderStatus = "completed"
	DraftOrderStatusOpen      DraftOrderStatus = "open"
)

Defines values for DraftOrderStatus.

func (*DraftOrderStatus) Scan

func (pl *DraftOrderStatus) Scan(value interface{}) error

func (DraftOrderStatus) Value

func (pl DraftOrderStatus) Value() (driver.Value, error)

type Filter

type Filter struct {
	Size   int    `json:"size" gorm:"column:size"`
	Offset int    `json:"offset" gorm:"column:offset"`
	Name   string `json:"client_name" gorm:"column:client_name"`
	Owner  string `json:"owner" gorm:"column:owner"`
}

type Fulfillment

type Fulfillment struct {
	core.BaseModel

	ClaimOrderId uuid.NullUUID        `json:"claim_order_id" gorm:"column:claim_order_id"`
	ClaimOrder   *ClaimOrder          `json:"claim_order" gorm:"foreignKey:ClaimOrderId"`
	SwapId       uuid.NullUUID        `json:"swap_id" gorm:"column:swap_id"`
	Swap         *Swap                `json:"swap" gorm:"foreignKey:SwapId"`
	OrderId      uuid.NullUUID        `json:"order_id" gorm:"column:order_id"`
	Order        *Order               `json:"order" gorm:"foreignKey:OrderId"`
	ProviderId   uuid.NullUUID        `json:"provider_id" gorm:"column:provider_id"`
	Provider     *FulfillmentProvider `json:"provider" gorm:"foreignKey:ProviderId"`
	LocationId   uuid.NullUUID        `json:"location_id" gorm:"column:location_id"`
	//TODO:ADD
	Items         []FulfillmentItem `json:"items" gorm:"foreignKey:FulfillmentId"`
	TrackingLinks []TrackingLink    `json:"tracking_links" gorm:"foreignKey:Id"`

	//TODO: add ;default:[]
	TrackingNumbers pq.StringArray `json:"tracking_numbers" gorm:"column:tracking_numbers;type:text[];default:[]"`
	Data            core.JSONB     `json:"data" gorm:"column:data"`
	ShippedAt       *time.Time     `json:"shipped_at" gorm:"column:shipped_at"`
	NoNotification  bool           `json:"no_notification" gorm:"column:no_notification"`
	CanceledAt      *time.Time     `json:"canceled_at" gorm:"column:canceled_at"`
	IdempotencyKey  string         `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:Fulfillment title: "Fulfillment" description: "A Fulfillment is created once an admin can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a fulfillment provider, which typically integrates a third-party shipping service. Fulfillments can be associated with orders, claims, swaps, and returns." type: object required:

  • canceled_at
  • claim_order_id
  • created_at
  • data
  • id
  • idempotency_key
  • location_id
  • metadata
  • no_notification
  • order_id
  • provider_id
  • shipped_at
  • swap_id
  • tracking_numbers
  • updated_at

properties:

id:
  description: The fulfillment's ID
  type: string
  example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
claim_order_id:
  description: The ID of the Claim that the Fulfillment belongs to.
  nullable: true
  type: string
  example: null
claim_order:
  description: The details of the claim that the fulfillment may belong to.
  x-expandable: "claim_order"
  nullable: true
  $ref: "#/components/schemas/ClaimOrder"
swap_id:
  description: The ID of the Swap that the Fulfillment belongs to.
  nullable: true
  type: string
  example: null
swap:
  description: The details of the swap that the fulfillment may belong to.
  x-expandable: "swap"
  nullable: true
  $ref: "#/components/schemas/Swap"
order_id:
  description: The ID of the Order that the Fulfillment belongs to.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the fulfillment may belong to.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
provider_id:
  description: The ID of the Fulfillment Provider responsible for handling the fulfillment.
  type: string
  example: manual
provider:
  description: The details of the fulfillment provider responsible for handling the fulfillment.
  x-expandable: "provider"
  nullable: true
  $ref: "#/components/schemas/FulfillmentProvider"
location_id:
  description: The ID of the stock location the fulfillment will be shipped from
  nullable: true
  type: string
  example: sloc_01G8TJSYT9M6AVS5N4EMNFS1EK
items:
  description: The Fulfillment Items in the Fulfillment. These hold information about how many of each Line Item has been fulfilled.
  type: array
  x-expandable: "items"
  items:
    $ref: "#/components/schemas/FulfillmentItem"
tracking_links:
  description: The Tracking Links that can be used to track the status of the Fulfillment. These will usually be provided by the Fulfillment Provider.
  type: array
  x-expandable: "tracking_links"
  items:
    $ref: "#/components/schemas/TrackingLink"
tracking_numbers:
  description: The tracking numbers that can be used to track the status of the fulfillment.
  deprecated: true
  type: array
  items:
    type: string
data:
  description: This contains all the data necessary for the Fulfillment provider to handle the fulfillment.
  type: object
  example: {}
shipped_at:
  description: The date with timezone at which the Fulfillment was shipped.
  nullable: true
  type: string
  format: date-time
no_notification:
  description: Flag for describing whether or not notifications related to this should be sent.
  nullable: true
  type: boolean
  example: false
canceled_at:
  description: The date with timezone at which the Fulfillment was canceled.
  nullable: true
  type: string
  format: date-time
idempotency_key:
  description: Randomly generated key used to continue the completion of the fulfillment in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type FulfillmentItem

type FulfillmentItem struct {
	FulfillmentId uuid.NullUUID `json:"fulfillment_id" gorm:"column:fulfillment_id;primarykey"`
	ItemId        uuid.NullUUID `json:"item_id" gorm:"column:item_id;primarykey"`
	Fulfillment   *Fulfillment  `json:"fulfillment" gorm:"foreignKey:FulfillmentId"`
	Item          *LineItem     `json:"item" gorm:"foreignKey:ItemId"`
	Quantity      int           `json:"quantity" gorm:"column:quantity"`
}

@oas:schema:FulfillmentItem title: "Fulfillment Item" description: "This represents the association between a Line Item and a Fulfillment." type: object required:

  • fulfillment_id
  • item_id
  • quantity

properties:

fulfillment_id:
  description: The ID of the Fulfillment that the Fulfillment Item belongs to.
  type: string
  example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
item_id:
  description: The ID of the Line Item that the Fulfillment Item references.
  type: string
  example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
fulfillment:
  description: The details of the fulfillment.
  x-expandable: "fulfillment"
  nullable: true
  $ref: "#/components/schemas/Fulfillment"
item:
  description: The details of the line item.
  x-expandable: "item"
  nullable: true
  $ref: "#/components/schemas/LineItem"
quantity:
  description: The quantity of the Line Item that is included in the Fulfillment.
  type: integer
  example: 1

type FulfillmentProvider

type FulfillmentProvider struct {
	core.SoftDeletableModel

	IsInstalled bool `json:"is_installed" gorm:"column:is_installed;default:true"`
}

@oas:schema:FulfillmentProvider title: "Fulfillment Provider" description: "A fulfillment provider represents a fulfillment service installed in the Medusa backend, either through a plugin or backend customizations.

It holds the fulfillment service's installation status."

type: object required:

  • id
  • is_installed

properties:

id:
  description: The ID of the fulfillment provider as given by the fulfillment service.
  type: string
  example: manual
is_installed:
  description: Whether the fulfillment service is installed in the current version. If a fulfillment service is no longer installed, the `is_installed` attribute is set to `false`.
  type: boolean
  default: true

type FulfillmentStatus

type FulfillmentStatus string
const (
	FulfillmentStatusNotFulfilled       FulfillmentStatus = "not_fulfilled"
	FulfillmentStatusPartiallyFulfilled FulfillmentStatus = "partially_fulfilled"
	FulfillmentStatusFulfilled          FulfillmentStatus = "fulfilled"
	FulfillmentStatusPartiallyShipped   FulfillmentStatus = "partially_shipped"
	FulfillmentStatusShipped            FulfillmentStatus = "shipped"
	FulfillmentStatusPartiallyReturned  FulfillmentStatus = "partially_returned"
	FulfillmentStatusReturned           FulfillmentStatus = "returned"
	FulfillmentStatusCanceled           FulfillmentStatus = "canceled"
	FulfillmentStatusRequiresAction     FulfillmentStatus = "requires_action"
)

func (*FulfillmentStatus) Scan

func (pl *FulfillmentStatus) Scan(value interface{}) error

func (FulfillmentStatus) Value

func (pl FulfillmentStatus) Value() (driver.Value, error)

type GiftCard

type GiftCard struct {
	core.SoftDeletableModel

	Code       string        `json:"code" gorm:"column:code"`
	Value      float64       `json:"value" gorm:"column:value"`
	Balance    float64       `json:"balance" gorm:"column:balance"`
	RegionId   uuid.NullUUID `json:"region_id" gorm:"column:region_id"`
	Region     *Region       `json:"region" gorm:"foreignKey:RegionId"`
	OrderId    uuid.NullUUID `json:"order_id" gorm:"column:order_id"`
	Order      *Order        `json:"order" gorm:"foreignKey:OrderId"`
	IsDisabled bool          `json:"is_disabled" gorm:"column:is_disabled;default:false"`
	TaxRate    float64       `json:"tax_rate" gorm:"column:tax_rate"`
	EndsAt     *time.Time    `json:"ends_at" gorm:"column:ends_at"`
}

@oas:schema:GiftCard title: "Gift Card" description: "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order." type: object required:

  • balance
  • code
  • created_at
  • deleted_at
  • ends_at
  • id
  • is_disabled
  • metadata
  • order_id
  • region_id
  • tax_rate
  • updated_at
  • value

properties:

id:
  description: The gift card's ID
  type: string
  example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ
code:
  description: The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card.
  type: string
  example: 3RFT-MH2C-Y4YZ-XMN4
value:
  description: The value that the Gift Card represents.
  type: integer
  example: 10
balance:
  description: The remaining value on the Gift Card.
  type: integer
  example: 10
region_id:
  description: The ID of the region this gift card is available in.
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region this gift card is available in.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
order_id:
  description: The ID of the order that the gift card was purchased in.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the gift card was purchased in.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Order"
is_disabled:
  description: Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.
  type: boolean
  default: false
ends_at:
  description: The time at which the Gift Card can no longer be used.
  nullable: true
  type: string
  format: date-time
tax_rate:
  description: The gift card's tax rate that will be applied on calculating totals
  nullable: true
  type: number
  example: 0
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type GiftCardTransaction

type GiftCardTransaction struct {
	core.SoftDeletableModel

	GiftCardId uuid.NullUUID `json:"gift_card_id" gorm:"column:gift_card_id"`
	GiftCard   *GiftCard     `json:"gift_card" gorm:"foreignKey:GiftCardId"`
	OrderId    uuid.NullUUID `json:"order_id" gorm:"column:order_id"`
	Order      *Order        `json:"order" gorm:"foreignKey:OrderId"`
	Amount     float64       `json:"amount" gorm:"column:amount"`
	IsTaxable  bool          `json:"is_taxable" gorm:"column:is_taxable"`
	TaxRate    float64       `json:"tax_rate" gorm:"column:tax_rate"`
}

@oas:schema:GiftCardTransaction title: "Gift Card Transaction" description: "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order." type: object required:

  • amount
  • created_at
  • gift_card_id
  • id
  • is_taxable
  • order_id
  • tax_rate

properties:

id:
  description: The gift card transaction's ID
  type: string
  example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A
gift_card_id:
  description: The ID of the Gift Card that was used in the transaction.
  type: string
  example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ
gift_card:
  description: The details of the gift card associated used in this transaction.
  x-expandable: "gift_card"
  nullable: true
  $ref: "#/components/schemas/GiftCard"
order_id:
  description: The ID of the order that the gift card was used for payment.
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the gift card was used for payment.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
amount:
  description: The amount that was used from the Gift Card.
  type: integer
  example: 10
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
is_taxable:
  description: Whether the transaction is taxable or not.
  nullable: true
  type: boolean
  example: false
tax_rate:
  description: The tax rate of the transaction
  nullable: true
  type: number
  example: 0

type IdempotencyKey

type IdempotencyKey struct {
	core.SoftDeletableModel

	IdempotencyKey string     `json:"idempotency_key" gorm:"column:idempotency_key"`
	LockedAt       *time.Time `json:"locked_at" gorm:"column:locked_at"`
	RequestMethod  string     `json:"request_method" gorm:"column:request_method"`
	RequestParams  core.JSONB `json:"request_params" gorm:"column:request_params"`
	RequestPath    string     `json:"request_path" gorm:"column:request_path"`
	ResponseCode   int        `json:"response_code" gorm:"column:response_code"`
	ResponseBody   core.JSONB `json:"response_body" gorm:"column:response_body"`
	RecoveryPoint  string     `json:"recovery_point" gorm:"column:recovery_point;default:'started'"`
}

@oas:schema:IdempotencyKey title: "Idempotency Key" description: "Idempotency Key is used to continue a process in case of any failure that might occur." type: object required:

  • created_at
  • id
  • idempotency_key
  • locked_at
  • recovery_point
  • response_code
  • response_body
  • request_method
  • request_params
  • request_path

properties:

id:
  description: The idempotency key's ID
  type: string
  example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A
idempotency_key:
  description: The unique randomly generated key used to determine the state of a process.
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: Date which the idempotency key was locked.
  type: string
  format: date-time
locked_at:
  description: Date which the idempotency key was locked.
  nullable: true
  type: string
  format: date-time
request_method:
  description: The method of the request
  nullable: true
  type: string
  example: POST
request_params:
  description: The parameters passed to the request
  nullable: true
  type: object
  example:
    id: cart_01G8ZH853Y6TFXWPG5EYE81X63
request_path:
  description: The request's path
  nullable: true
  type: string
  example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete
response_code:
  description: The response's code.
  nullable: true
  type: string
  example: 200
response_body:
  description: The response's body
  nullable: true
  type: object
  example:
    id: cart_01G8ZH853Y6TFXWPG5EYE81X63
recovery_point:
  description: Where to continue from.
  type: string
  default: started

type Image

type Image struct {
	core.SoftDeletableModel

	Url string `json:"url" gorm:"column:url"`
}

@oas:schema:Image title: "Image" description: "An Image is used to store details about uploaded images. Images are uploaded by the File Service, and the URL is provided by the File Service." type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • updated_at
  • url

properties:

id:
  type: string
  description: The image's ID
  example: img_01G749BFYR6T8JTVW6SGW3K3E6
url:
  description: The URL at which the image file can be found.
  type: string
  format: uri
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type Invite

type Invite struct {
	core.SoftDeletableModel

	UserEmail string     `json:"user_email" gorm:"column:user_email"`
	Role      UserRole   `json:"role" gorm:"column:role;default:'member'"`
	Accepted  bool       `json:"accepted" gorm:"column:accepted;default:false"`
	Token     string     `json:"token" gorm:"column:token"`
	ExpiresAt *time.Time `json:"expores_at" gorm:"column:expores_at"`
}

@oas:schema:Invite title: "Invite" description: "An invite is created when an admin user invites a new user to join the store's team. Once the invite is accepted, it's deleted." type: object required:

  • accepted
  • created_at
  • deleted_at
  • expires_at
  • id
  • metadata
  • role
  • token
  • updated_at
  • user_email

properties:

id:
  type: string
  description: The invite's ID
  example: invite_01G8TKE4XYCTHSCK2GDEP47RE1
user_email:
  description: The email of the user being invited.
  type: string
  format: email
role:
  description: The user's role. These roles don't change the privileges of the user.
  nullable: true
  type: string
  enum:
    - admin
    - member
    - developer
  default: member
accepted:
  description: Whether the invite was accepted or not.
  type: boolean
  default: false
token:
  description: The token used to accept the invite.
  type: string
expires_at:
  description: The date the invite expires at.
  type: string
  format: date-time
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type LineItem

type LineItem struct {
	core.BaseModel

	CartId            uuid.NullUUID        `json:"cart_id" gorm:"column:cart_id"`
	Cart              *Cart                `json:"cart" gorm:"foreignKey:CartId"`
	OrderId           uuid.NullUUID        `json:"order_id" gorm:"column:order_id"`
	Order             *Order               `json:"order" gorm:"foreignKey:OrderId"`
	SwapId            uuid.NullUUID        `json:"swap_id" gorm:"column:swap_id"`
	Swap              *Swap                `json:"swap" gorm:"foreignKey:SwapId"`
	ClaimOrderId      uuid.NullUUID        `json:"claim_order_id" gorm:"column:claim_order_id"`
	ClaimOrder        *ClaimOrder          `json:"claim_order" gorm:"foreignKey:ClaimOrderId"`
	TaxLines          []LineItemTaxLine    `json:"tax_lines" gorm:"foreignKey:Id"`
	Adjustments       []LineItemAdjustment `json:"adjustments" gorm:"foreignKey:Id"`
	OriginalItemId    uuid.NullUUID        `json:"original_item_id" gorm:"column:original_item_id"`
	OrderEditId       uuid.NullUUID        `json:"order_edit_id" gorm:"column:order_edit_id"`
	OrderEdit         *OrderEdit           `json:"order_edit" gorm:"foreignKey:OrderEditId"`
	Title             string               `json:"title" gorm:"column:title"`
	Description       string               `json:"description" gorm:"column:description"`
	Thumbnail         string               `json:"thumbnail" gorm:"column:thumbnail"`
	IsReturn          bool                 `json:"is_return" gorm:"column:is_return;default:false"`
	IsGiftcard        bool                 `json:"is_giftcard" gorm:"column:is_giftcard;default:false"`
	ShouldMerge       bool                 `json:"should_merge" gorm:"column:should_merge;default:false"`
	AllowDiscounts    bool                 `json:"allow_discounts" gorm:"column:allow_discounts;default:false"`
	HasShipping       bool                 `json:"has_shipping" gorm:"column:has_shipping"`
	UnitPrice         float64              `json:"unit_price" gorm:"column:unit_price"`
	ProductId         uuid.NullUUID        `json:"product_id" gorm:"column:product_id"`
	VariantId         uuid.NullUUID        `json:"variant_id" gorm:"column:variant_id"`
	Variant           *ProductVariant      `json:"variant" gorm:"foreignKey:VariantId"`
	Quantity          int                  `json:"quantity" gorm:"column:quantity"`
	FulfilledQuantity int                  `json:"fulfilled_quantity" gorm:"column:fulfilled_quantity"`
	ReturnedQuantity  int                  `json:"returned_quantity" gorm:"column:returned_quantity"`
	ShippedQuantity   int                  `json:"shipped_quantity" gorm:"column:shipped_quantity"`
	Refundable        float64              `json:"refundable" gorm:"column:refundable"`
	Subtotal          float64              `json:"subtotal" gorm:"column:subtotal"`
	TaxTotal          float64              `json:"tax_total" gorm:"column:tax_total"`
	Total             float64              `json:"total" gorm:"column:total"`
	OriginalTotal     float64              `json:"original_total" gorm:"column:original_total"`
	OriginalTaxTotal  float64              `json:"original_tax_total" gorm:"column:original_tax_total"`
	DiscountTotal     float64              `json:"discount_total" gorm:"column:discount_total"`
	GiftCardTotal     float64              `json:"gift_card_total" gorm:"column:gift_card_total"`
	RawDiscountTotal  float64              `json:"raw_discount_total" gorm:"column:raw_discount_total"`
	IncludesTax       bool                 `json:"includes_tax" gorm:"column:includes_tax"`
}

@oas:schema:LineItem title: "Line Item" description: "Line Items are created when a product is added to a Cart. When Line Items are purchased they will get copied to the resulting order, swap, or claim, and can eventually be referenced in Fulfillments and Returns. Line items may also be used for order edits." type: object required:

  • allow_discounts
  • cart_id
  • claim_order_id
  • created_at
  • description
  • fulfilled_quantity
  • has_shipping
  • id
  • is_giftcard
  • is_return
  • metadata
  • order_edit_id
  • order_id
  • original_item_id
  • quantity
  • returned_quantity
  • shipped_quantity
  • should_merge
  • swap_id
  • thumbnail
  • title
  • unit_price
  • updated_at
  • variant_id

properties:

id:
  description: The line item's ID
  type: string
  example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
cart_id:
  description: The ID of the cart that the line item may belongs to.
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart that the line item may belongs to.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
order_id:
  description: The ID of the order that the line item may belongs to.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the line item may belongs to.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
swap_id:
  description: The ID of the swap that the line item may belong to.
  nullable: true
  type: string
  example: null
swap:
  description: The details of the swap that the line item may belong to.
  x-expandable: "swap"
  nullable: true
  $ref: "#/components/schemas/Swap"
claim_order_id:
  description: The ID of the claim that the line item may belong to.
  nullable: true
  type: string
  example: null
claim_order:
  description: The details of the claim that the line item may belong to.
  x-expandable: "claim_order"
  nullable: true
  $ref: "#/components/schemas/ClaimOrder"
tax_lines:
  description: The details of the item's tax lines.
  x-expandable: "tax_lines"
  type: array
  items:
    $ref: "#/components/schemas/LineItemTaxLine"
adjustments:
  description: The details of the item's adjustments, which are available when a discount is applied on the item.
  x-expandable: "adjustments"
  type: array
  items:
    $ref: "#/components/schemas/LineItemAdjustment"
original_item_id:
  description: The ID of the original line item. This is useful if the line item belongs to a resource that references an order, such as a return or an order edit.
  nullable: true
  type: string
order_edit_id:
  description: The ID of the order edit that the item may belong to.
  nullable: true
  type: string
order_edit:
  description: The details of the order edit.
  x-expandable: "order_edit"
  nullable: true
  $ref: "#/components/schemas/OrderEdit"
title:
  description: The title of the Line Item.
  type: string
  example: Medusa Coffee Mug
description:
  description: A more detailed description of the contents of the Line Item.
  nullable: true
  type: string
  example: One Size
thumbnail:
  description: A URL string to a small image of the contents of the Line Item.
  nullable: true
  type: string
  format: uri
  example: https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png
is_return:
  description: Is the item being returned
  type: boolean
  default: false
is_giftcard:
  description: Flag to indicate if the Line Item is a Gift Card.
  type: boolean
  default: false
should_merge:
  description: Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item.
  type: boolean
  default: true
allow_discounts:
  description: Flag to indicate if the Line Item should be included when doing discount calculations.
  type: boolean
  default: true
has_shipping:
  description: Flag to indicate if the Line Item has fulfillment associated with it.
  nullable: true
  type: boolean
  example: false
unit_price:
  description: The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to.
  type: integer
  example: 8000
variant_id:
  description: The id of the Product Variant contained in the Line Item.
  nullable: true
  type: string
  example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
  description: The details of the product variant that this item was created from.
  x-expandable: "variant"
  nullable: true
  $ref: "#/components/schemas/ProductVariant"
quantity:
  description: The quantity of the content in the Line Item.
  type: integer
  example: 1
fulfilled_quantity:
  description: The quantity of the Line Item that has been fulfilled.
  nullable: true
  type: integer
  example: 0
returned_quantity:
  description: The quantity of the Line Item that has been returned.
  nullable: true
  type: integer
  example: 0
shipped_quantity:
  description: The quantity of the Line Item that has been shipped.
  nullable: true
  type: integer
  example: 0
refundable:
  description: The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.
  type: integer
  example: 0
subtotal:
  description: The subtotal of the line item
  type: integer
  example: 8000
tax_total:
  description: The total of tax of the line item
  type: integer
  example: 0
total:
  description: The total amount of the line item
  type: integer
  example: 8000
original_total:
  description: The original total amount of the line item
  type: integer
  example: 8000
original_tax_total:
  description: The original tax total amount of the line item
  type: integer
  example: 0
discount_total:
  description: The total of discount of the line item rounded
  type: integer
  example: 0
raw_discount_total:
  description: The total of discount of the line item
  type: integer
  example: 0
gift_card_total:
  description: The total of the gift card of the line item
  type: integer
  example: 0
includes_tax:
  description: "Indicates if the line item unit_price include tax"
  x-featureFlag: "tax_inclusive_pricing"
  type: boolean
  default: false
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type LineItemAdjustment

type LineItemAdjustment struct {
	core.SoftDeletableModel

	ItemId      uuid.NullUUID `json:"item_id" gorm:"column:item_id"`
	Item        *LineItem     `json:"item" gorm:"foreignKey:ItemId"`
	Description string        `json:"description" gorm:"column:description"`
	DiscountId  uuid.NullUUID `json:"discount_id" gorm:"column:discount_id"`
	Discount    *Discount     `json:"discount" gorm:"foreignKey:DiscountId"`
	Amount      float64       `json:"amount" gorm:"column:amount"`
}

@oas:schema:LineItemAdjustment title: "Line Item Adjustment" description: "A Line Item Adjustment includes details on discounts applied on a line item." type: object required:

  • amount
  • description
  • discount_id
  • id
  • item_id
  • metadata

properties:

id:
  description: The Line Item Adjustment's ID
  type: string
  example: lia_01G8TKE4XYCTHSCK2GDEP47RE1
item_id:
  description: The ID of the line item
  type: string
  example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
item:
  description: The details of the line item.
  x-expandable: "item"
  nullable: true
  $ref: "#/components/schemas/LineItem"
description:
  description: The line item's adjustment description
  type: string
  example: Adjusted item's price.
discount_id:
  description: The ID of the discount associated with the adjustment
  nullable: true
  type: string
  example: disc_01F0YESMW10MGHWJKZSDDMN0VN
discount:
  description: The details of the discount associated with the adjustment.
  x-expandable: "discount"
  nullable: true
  $ref: "#/components/schemas/Discount"
amount:
  description: The adjustment amount
  type: number
  example: 1000
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type LineItemTaxLine

type LineItemTaxLine struct {
	core.SoftDeletableModel

	ItemId uuid.NullUUID `json:"item_id" gorm:"column:item_id"`
	Item   *LineItem     `json:"item" gorm:"foreignKey:ItemId"`
	Code   string        `json:"code" gorm:"column:code"`
	Name   string        `json:"name" gorm:"column:name"`
	Rate   float64       `json:"rate" gorm:"column:rate"`
}

@oas:schema:LineItemTaxLine title: "Line Item Tax Line" description: "A Line Item Tax Line represents the taxes applied on a line item." type: object required:

  • code
  • created_at
  • id
  • item_id
  • metadata
  • name
  • rate
  • updated_at

properties:

id:
  description: The line item tax line's ID
  type: string
  example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8
code:
  description: A code to identify the tax type by
  nullable: true
  type: string
  example: tax01
name:
  description: A human friendly name for the tax
  type: string
  example: Tax Example
rate:
  description: The numeric rate to charge tax by
  type: number
  example: 10
item_id:
  description: The ID of the line item
  type: string
  example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
item:
  description: The details of the line item.
  x-expandable: "item"
  nullable: true
  $ref: "#/components/schemas/LineItem"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type Migration

type Migration struct {
	Id        int32  `gorm:"column:id;type:integer;primaryKey;autoIncrement:true" json:"id"`
	Timestamp int64  `gorm:"column:timestamp;type:bigint;not null" json:"timestamp"`
	Name      string `gorm:"column:name;type:character varying;not null" json:"name"`
}

func (*Migration) TableName

func (*Migration) TableName() string

type MoneyAmount

type MoneyAmount struct {
	core.SoftDeletableModel

	Amount       float64          `json:"amount" gorm:"column:amount"`
	Currency     *Currency        `json:"currency" gorm:"foreignKey:CurrencyCode;foreignKey:Code"`
	CurrencyCode string           `json:"currency_code" gorm:"column:currency_code"`
	MaxQuantity  int              `json:"max_quantity" gorm:"column:max_quantity"`
	MinQuantity  int              `json:"min_quantity" gorm:"column:min_quantity"`
	PriceList    *PriceList       `json:"price_list" gorm:"foreignKey:PriceListId"`
	PriceListId  uuid.NullUUID    `json:"price_list_id" gorm:"column:price_list_id"`
	Region       *Region          `json:"region" gorm:"foreignKey:RegionId"`
	RegionId     uuid.NullUUID    `json:"region_id" gorm:"column:region_id"`
	Variant      *ProductVariant  `json:"variant" gorm:"foreignKey:VariantId"`
	VariantId    uuid.NullUUID    `json:"variant_id" gorm:"column:variant_id"`
	Variants     []ProductVariant `json:"variants" gorm:"many2many:product_variant_money_amount"`
}

@oas:schema:MoneyAmount title: "Money Amount" description: "A Money Amount represent a price amount, for example, a product variant's price or a price in a price list. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used, the amount will be in the currency defined for the Region." type: object required:

  • amount
  • created_at
  • currency_code
  • deleted_at
  • id
  • max_quantity
  • min_quantity
  • price_list_id
  • region_id
  • updated_at
  • variant_id

properties:

id:
  description: The money amount's ID
  type: string
  example: ma_01F0YESHRFQNH5S8Q0PK84YYZN
currency_code:
  description: The 3 character currency code that the money amount may belong to.
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
currency:
  description: The details of the currency that the money amount may belong to.
  x-expandable: "currency"
  nullable: true
  $ref: "#/components/schemas/Currency"
amount:
  description: The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost.
  type: integer
  example: 100
min_quantity:
  description: The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.
  nullable: true
  type: integer
  example: 1
max_quantity:
  description: The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.
  nullable: true
  type: integer
  example: 1
price_list_id:
  description: The ID of the price list that the money amount may belong to.
  nullable: true
  type: string
  example: pl_01G8X3CKJXCG5VXVZ87H9KC09W
price_list:
  description: The details of the price list that the money amount may belong to.
  x-expandable: "price_list"
  nullable: true
  $ref: "#/components/schemas/PriceList"
variant_id:
  description: The ID of the Product Variant contained in the Line Item.
  nullable: true
  type: string
  example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
  description: The details of the product variant that the money amount may belong to.
  x-expandable: "variant"
  nullable: true
  $ref: "#/components/schemas/ProductVariant"
region_id:
  description: The region's ID
  nullable: true
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region that the money amount may belong to.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type Note

type Note struct {
	core.SoftDeletableModel

	ResourceType string        `json:"resource_type" gorm:"column:resource_type"`
	ResourceId   uuid.NullUUID `json:"resource_id" gorm:"column:resource_id"`
	Value        string        `json:"value" gorm:"column:value"`
	AuthorId     uuid.NullUUID `json:"author_id" gorm:"column:author_id"`
	Author       *User         `json:"author" gorm:"foreignKey:AuthorId"`
}

@oas:schema:Note title: "Note" description: "A Note is an element that can be used in association with different resources to allow admin users to describe additional information. For example, they can be used to add additional information about orders." type: object required:

  • author_id
  • created_at
  • deleted_at
  • id
  • metadata
  • resource_id
  • resource_type
  • updated_at
  • value

properties:

id:
  description: The note's ID
  type: string
  example: note_01G8TM8ENBMC7R90XRR1G6H26Q
resource_type:
  description: The type of resource that the Note refers to.
  type: string
  example: order
resource_id:
  description: The ID of the resource that the Note refers to.
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
value:
  description: The contents of the note.
  type: string
  example: This order must be fulfilled on Monday
author_id:
  description: The ID of the user that created the note.
  nullable: true
  type: string
  example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
author:
  description: The details of the user that created the note.
  x-expandable: "author"
  nullable: true
  $ref: "#/components/schemas/User"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}

type Notification

type Notification struct {
	core.BaseModel

	EventName          string                `json:"event_name" gorm:"column:event_name"`
	ResourceType       string                `json:"resource_type" gorm:"column:resource_type"`
	ResourceId         uuid.NullUUID         `json:"resource_id" gorm:"column:resource_id"`
	CustomerId         uuid.NullUUID         `json:"customer_id" gorm:"column:customer_id"`
	Customer           *Customer             `json:"customer" gorm:"foreignKey:CustomerId"`
	To                 string                `json:"to" gorm:"column:to"`
	Data               core.JSONB            `json:"data" gorm:"column:data"`
	ParentId           uuid.NullUUID         `json:"parent_id" gorm:"column:parent_id"`
	ParentNotification *NotificationProvider `json:"parent_notification" gorm:"foreignKey:ParentId"`
	Resends            []Notification        `json:"resends" gorm:"foreignKey:Id"`
	ProviderId         uuid.NullUUID         `json:"provider_id" gorm:"column:provider_id"`
	Provider           *NotificationProvider `json:"provider" gorm:"foreignKey:ProviderId"`
}

@oas:schema:Notification title: "Notification" description: "A notification is an alert sent, typically to customers, using the installed Notification Provider as a reaction to internal events such as `order.placed`. Notifications can be resent." type: object required:

  • created_at
  • customer_id
  • data
  • event_name
  • id
  • parent_id
  • provider_id
  • resource_type
  • resource_id
  • to
  • updated_at

properties:

id:
  description: The notification's ID
  type: string
  example: noti_01G53V9Y6CKMCGBM1P0X7C28RX
event_name:
  description: The name of the event that the notification was sent for.
  nullable: true
  type: string
  example: order.placed
resource_type:
  description: The type of resource that the Notification refers to.
  type: string
  example: order
resource_id:
  description: The ID of the resource that the Notification refers to.
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
customer_id:
  description: The ID of the customer that this notification was sent to.
  nullable: true
  type: string
  example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
  description: The details of the customer that this notification was sent to.
  x-expandable: "customer"
  nullable: true
  $ref: "#/components/schemas/Customer"
to:
  description: The address that the Notification was sent to. This will usually be an email address, but can represent other addresses such as a chat bot user ID.
  type: string
  example: user@example.com
data:
  description: The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.
  type: object
  example: {}
parent_id:
  description: The notification's parent ID
  nullable: true
  type: string
  example: noti_01G53V9Y6CKMCGBM1P0X7C28RX
parent_notification:
  description: The details of the parent notification.
  x-expandable: "parent_notification"
  nullable: true
  $ref: "#/components/schemas/Notification"
resends:
  description: The details of all resends of the notification.
  type: array
  x-expandable: "resends"
  items:
    $ref: "#/components/schemas/Notification"
provider_id:
  description: The ID of the notification provider used to send the notification.
  nullable: true
  type: string
  example: sengrid
provider:
  description: The notification provider used to send the notification.
  x-expandable: "provider"
  nullable: true
  $ref: "#/components/schemas/NotificationProvider"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time

type NotificationProvider

type NotificationProvider struct {
	Id          uuid.NullUUID `json:"id" gorm:"column:id;primarykey"`
	IsInstalled bool          `json:"is_installed" gorm:"column:is_installed;default:true"`
}

@oas:schema:NotificationProvider title: "Notification Provider" description: "A notification provider represents a notification service installed in the Medusa backend, either through a plugin or backend customizations.

It holds the notification service's installation status."

type: object required:

  • id
  • is_installed

properties:

id:
  description: The ID of the notification provider as given by the notification service.
  type: string
  example: sendgrid
is_installed:
  description: Whether the notification service is installed in the current version. If a notification service is no longer installed, the `is_installed` attribute is set to `false`.
  type: boolean
  default: true

type OAuth

type OAuth struct {
	core.SoftDeletableModel

	DisplayName     string     `json:"display_name" gorm:"column:display_name"`
	ApplicationName string     `json:"application_name" gorm:"column:application_name"`
	InstallUrl      string     `json:"install_url" gorm:"column:install_url"`
	UninstallUrl    string     `json:"uninstall_url" gorm:"column:uninstall_url"`
	Data            core.JSONB `json:"data" gorm:"column:data"`
}

type Order

type Order struct {
	core.BaseModel

	Status               OrderStatus           `json:"status" gorm:"column:status;default:'pending'"`
	FulfillmentStatus    FulfillmentStatus     `json:"fulfillment_status" gorm:"column:fulfillment_status;default:'not_fulfilled'"`
	PaymentStatus        PaymentStatus         `json:"payment_status" gorm:"column:payment_status;default:'not_paid'"`
	DisplayId            int                   `json:"display_id" gorm:"column:display_id"`
	CartId               uuid.NullUUID         `json:"cart_id" gorm:"column:cart_id"`
	Cart                 *Cart                 `json:"cart" gorm:"foreignKey:CartId"`
	CustomerId           uuid.NullUUID         `json:"customer_id" gorm:"column:customer_id"`
	Customer             *Customer             `json:"customer" gorm:"foreignKey:CustomerId"`
	Email                string                `json:"email" gorm:"column:email"`
	BillingAddressId     uuid.NullUUID         `json:"billing_address_id" gorm:"column:billing_address_id"`
	BillingAddress       *Address              `json:"billing_address" gorm:"foreignKey:BillingAddressId"`
	ShippingAddressId    uuid.NullUUID         `json:"shipping_address_id" gorm:"column:shipping_address_id"`
	ShippingAddress      *Address              `json:"shipping_address" gorm:"foreignKey:ShippingAddressId"`
	RegionId             uuid.NullUUID         `json:"region_id" gorm:"column:region_id"`
	Region               *Region               `json:"region" gorm:"foreignKey:RegionId"`
	CurrencyCode         string                `json:"currency_code" gorm:"column:currency_code"`
	Currency             *Currency             `json:"currency" gorm:"foreignKey:CurrencyCode;foreignKey:Code"`
	TaxRate              float64               `json:"tax_rate" gorm:"column:tax_rate"`
	Discounts            []Discount            `json:"discounts" gorm:"many2many:order_discounts"`
	GiftCards            []GiftCard            `json:"gift_cards" gorm:"many2many:order_gift_cards"`
	ShippingMethods      []ShippingMethod      `json:"shipping_methods" gorm:"foreignKey:Id"`
	Payments             []Payment             `json:"payments" gorm:"foreignKey:Id"`
	Fulfillments         []Fulfillment         `json:"fulfillments" gorm:"foreignKey:Id"`
	Returns              []Return              `json:"returns" gorm:"foreignKey:Id"`
	Claims               []ClaimOrder          `json:"claims" gorm:"foreignKey:Id"`
	Refunds              []Refund              `json:"refunds" gorm:"foreignKey:Id"`
	Swaps                []Swap                `json:"swaps" gorm:"foreignKey:Id"`
	DraftOrderId         uuid.NullUUID         `json:"draft_order_id" gorm:"column:draft_order_id"`
	DraftOrder           *DraftOrder           `json:"draft_order" gorm:"foreignKey:DraftOrderId"`
	Items                []LineItem            `json:"items" gorm:"foreignKey:Id"`
	ReturnableItems      []LineItem            `json:"returnable_items" gorm:"foreignKey:Id"`
	Edits                []OrderEdit           `json:"edits" gorm:"foreignKey:Id"`
	GiftCardTransactions []GiftCardTransaction `json:"gift_card_transactions" gorm:"foreignKey:Id"`
	CanceledAt           *time.Time            `json:"canceled_at" gorm:"column:canceled_at"`
	NoNotification       bool                  `json:"no_notification" gorm:"column:no_notification"`
	IdempotencyKey       string                `json:"idempotency_key" gorm:"column:idempotency_key"`
	ExternalId           uuid.NullUUID         `json:"external_id" gorm:"column:external_id"`
	SalesChannelId       uuid.NullUUID         `json:"sales_channel_id" gorm:"column:sales_channel_id"`
	SalesChannel         *SalesChannel         `json:"sales_channel" gorm:"foreignKey:SalesChannelId"`
	ShippingTotal        float64               `json:"shipping_total" gorm:"column:shipping_total"`
	ShippingTaxTotal     float64               `json:"shipping_tax_total" gorm:"column:shipping_tax_total"`
	DiscountTotal        float64               `json:"discount_total" gorm:"column:discount_total"`
	RawDiscountTotal     float64               `json:"raw_discount_total" gorm:"column:raw_discount_total"`
	ItemTaxTotal         float64               `json:"item_tax_total" gorm:"column:item_tax_total"`
	TaxTotal             float64               `json:"tax_total" gorm:"column:tax_total"`
	RefundedTotal        float64               `json:"refunded_total" gorm:"column:refunded_total"`
	Total                float64               `json:"total" gorm:"column:total"`
	Subtotal             float64               `json:"subtotal" gorm:"column:subtotal"`
	PaidTotal            float64               `json:"paid_total" gorm:"column:paid_total"`
	RefundableAmount     float64               `json:"refundable_amount" gorm:"column:refundable_amount"`
	GiftCardTotal        float64               `json:"gift_card_total" gorm:"column:gift_card_total"`
	GiftCardTaxTotal     float64               `json:"gift_card_tax_total" gorm:"column:gift_card_tax_total"`
}

@oas:schema:Order title: "Order" description: "An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user." type: object required:

  • billing_address_id
  • canceled_at
  • cart_id
  • created_at
  • currency_code
  • customer_id
  • draft_order_id
  • display_id
  • email
  • external_id
  • fulfillment_status
  • id
  • idempotency_key
  • metadata
  • no_notification
  • object
  • payment_status
  • region_id
  • shipping_address_id
  • status
  • tax_rate
  • updated_at

properties:

id:
  description: The order's ID
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
status:
  description: The order's status
  type: string
  enum:
    - pending
    - completed
    - archived
    - canceled
    - requires_action
  default: pending
fulfillment_status:
  description: The order's fulfillment status
  type: string
  enum:
    - not_fulfilled
    - partially_fulfilled
    - fulfilled
    - partially_shipped
    - shipped
    - partially_returned
    - returned
    - canceled
    - requires_action
  default: not_fulfilled
payment_status:
  description: The order's payment status
  type: string
  enum:
    - not_paid
    - awaiting
    - captured
    - partially_refunded
    - refunded
    - canceled
    - requires_action
  default: not_paid
display_id:
  description: The order's display ID
  type: integer
  example: 2
cart_id:
  description: The ID of the cart associated with the order
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart associated with the order.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
customer_id:
  description: The ID of the customer associated with the order
  type: string
  example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
  description: The details of the customer associated with the order.
  x-expandable: "customer"
  nullable: true
  $ref: "#/components/schemas/Customer"
email:
  description: The email associated with the order
  type: string
  format: email
billing_address_id:
  description: The ID of the billing address associated with the order
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
billing_address:
  description: The details of the billing address associated with the order.
  x-expandable: "billing_address"
  nullable: true
  $ref: "#/components/schemas/Address"
shipping_address_id:
  description: The ID of the shipping address associated with the order
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
  description: The details of the shipping address associated with the order.
  x-expandable: "shipping_address"
  nullable: true
  $ref: "#/components/schemas/Address"
region_id:
  description: The ID of the region this order was created in.
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region this order was created in.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
currency_code:
  description: The 3 character currency code that is used in the order
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
currency:
  description: The details of the currency used in the order.
  x-expandable: "currency"
  nullable: true
  $ref: "#/components/schemas/Currency"
tax_rate:
  description: The order's tax rate
  nullable: true
  type: number
  example: 0
discounts:
  description: The details of the discounts applied on the order.
  type: array
  x-expandable: "discounts"
  items:
    $ref: "#/components/schemas/Discount"
gift_cards:
  description: The details of the gift card used in the order.
  type: array
  x-expandable: "gift_cards"
  items:
    $ref: "#/components/schemas/GiftCard"
shipping_methods:
  description: The details of the shipping methods used in the order.
  type: array
  x-expandable: "shipping_methods"
  items:
    $ref: "#/components/schemas/ShippingMethod"
payments:
  description: The details of the payments used in the order.
  type: array
  x-expandable: "payments"
  items:
    $ref: "#/components/schemas/Payment"
fulfillments:
  description: The details of the fulfillments created for the order.
  type: array
  x-expandable: "fulfillments"
  items:
    $ref: "#/components/schemas/Fulfillment"
returns:
  description: The details of the returns created for the order.
  type: array
  x-expandable: "returns"
  items:
    $ref: "#/components/schemas/Return"
claims:
  description: The details of the claims created for the order.
  type: array
  x-expandable: "claims"
  items:
    $ref: "#/components/schemas/ClaimOrder"
refunds:
  description: The details of the refunds created for the order.
  type: array
  x-expandable: "refunds"
  items:
    $ref: "#/components/schemas/Refund"
swaps:
  description: The details of the swaps created for the order.
  type: array
  x-expandable: "swaps"
  items:
    $ref: "#/components/schemas/Swap"
draft_order_id:
  description: The ID of the draft order this order was created from.
  nullable: true
  type: string
  example: null
draft_order:
  description: The details of the draft order this order was created from.
  x-expandable: "draft_order"
  nullable: true
  $ref: "#/components/schemas/DraftOrder"
items:
  description: The details of the line items that belong to the order.
  x-expandable: "items"
  type: array
  items:
    $ref: "#/components/schemas/LineItem"
edits:
  description: The details of the order edits done on the order.
  type: array
  x-expandable: "edits"
  items:
    $ref: "#/components/schemas/OrderEdit"
gift_card_transactions:
  description: The gift card transactions made in the order.
  type: array
  x-expandable: "gift_card_transactions"
  items:
    $ref: "#/components/schemas/GiftCardTransaction"
canceled_at:
  description: The date the order was canceled on.
  nullable: true
  type: string
  format: date-time
no_notification:
  description: Flag for describing whether or not notifications related to this should be send.
  nullable: true
  type: boolean
  example: false
idempotency_key:
  description: Randomly generated key used to continue the processing of the order in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
external_id:
  description: The ID of an external order.
  nullable: true
  type: string
  example: null
sales_channel_id:
  description: The ID of the sales channel this order belongs to.
  nullable: true
  type: string
  example: null
sales_channel:
  description: The details of the sales channel this order belongs to.
  x-expandable: "sales_channel"
  nullable: true
  $ref: "#/components/schemas/SalesChannel"
shipping_total:
  type: integer
  description: The total of shipping
  example: 1000
  nullable: true
shipping_tax_total:
  type: integer
  description: The tax total applied on shipping
  example: 1000
raw_discount_total:
  description: The total of discount
  type: integer
  example: 800
discount_total:
  description: The total of discount rounded
  type: integer
  example: 800
tax_total:
  description: The total of tax
  type: integer
  example: 0
item_tax_total:
  description: The tax total applied on items
  type: integer
  example: 0
  nullable: true
refunded_total:
  description: The total amount refunded if the order is returned.
  type: integer
  example: 0
total:
  description: The total amount of the order
  type: integer
  example: 8200
subtotal:
  description: The subtotal of the order
  type: integer
  example: 8000
paid_total:
  description: The total amount paid
  type: integer
  example: 8000
refundable_amount:
  description: The amount that can be refunded
  type: integer
  example: 8200
gift_card_total:
  description: The total of gift cards
  type: integer
  example: 0
gift_card_tax_total:
  description: The total of gift cards with taxes
  type: integer
  example: 0
returnable_items:
  description: The details of the line items that are returnable as part of the order, swaps, or claims
  type: array
  x-expandable: "returnable_items"
  items:
    $ref: "#/components/schemas/LineItem"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
sales_channels:
  description: The associated sales channels.
  type: array
  nullable: true
  x-expandable: "sales_channels"
  x-featureFlag: "medusa_v2"
  items:
    $ref: "#/components/schemas/SalesChannel"

type OrderDiscount

type OrderDiscount struct {
	OrderId    uuid.NullUUID `gorm:"column:order_id;type:character varying;primaryKey;index:IDX_e7b488cebe333f449398769b2c,priority:1" json:"order_id"`
	DiscountId uuid.NullUUID `` /* 126-byte string literal not displayed */
}

type OrderEdit

type OrderEdit struct {
	core.BaseModel

	Status              OrderEditStatus    `json:"status" gorm:"column:status"`
	OrderId             uuid.NullUUID      `json:"order_id" gorm:"column:order_id"`
	Order               *Order             `json:"order" gorm:"foreignKey:OrderId"`
	Changes             []OrderItemChange  `json:"changes" gorm:"foreignKey:Id"`
	InternalNote        string             `json:"internal_note" gorm:"column:internal_note"`
	CreatedBy           uuid.NullUUID      `json:"created_by" gorm:"column:created_by"`
	RequestedBy         uuid.NullUUID      `json:"requested_by" gorm:"column:requested_by"`
	RequestedAt         *time.Time         `json:"requested_at" gorm:"column:requested_at"`
	ConfirmedBy         uuid.NullUUID      `json:"confirmed_by" gorm:"column:confirmed_by"`
	ConfirmedAt         *time.Time         `json:"confirmed_at" gorm:"column:confirmed_at"`
	DeclinedBy          uuid.NullUUID      `json:"declined_by" gorm:"column:declined_by"`
	CanceledBy          uuid.NullUUID      `json:"canceled_by" gorm:"column:canceled_by"`
	DeclinedAt          *time.Time         `json:"declined_at" gorm:"column:declined_at"`
	DeclinedReason      string             `json:"declined_reason" gorm:"column:declined_reason"`
	CanceledAt          *time.Time         `json:"canceled_at" gorm:"column:canceled_at"`
	ShippingTotal       float64            `json:"shipping_total" gorm:"column:shipping_total"`
	Subtotal            float64            `json:"subtotal" gorm:"column:subtotal"`
	DiscountTotal       float64            `json:"discount_total" gorm:"column:discount_total"`
	TaxTotal            float64            `json:"tax_total" gorm:"column:tax_total"`
	Total               float64            `json:"total" gorm:"column:total"`
	DifferenceDue       float64            `json:"difference_due" gorm:"column:difference_due"`
	Items               []LineItem         `json:"items" gorm:"foreignKey:Id"`
	PaymentCollectionId uuid.NullUUID      `json:"payment_collection_id" gorm:"column:payment_collection_id"`
	PaymentCollection   *PaymentCollection `json:"region" gorm:"foreignKey:PaymentCollectionId"`
	GiftCardTotal       float64            `json:"gift_card_total" gorm:"column:gift_card_total"`
	GiftCardTaxTotal    float64            `json:"gift_card_tax_total" gorm:"column:gift_card_tax_total"`
}

@oas:schema:OrderEdit title: "Order Edit" description: "Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order." type: object required:

  • canceled_at
  • canceled_by
  • confirmed_by
  • confirmed_at
  • created_at
  • created_by
  • declined_at
  • declined_by
  • declined_reason
  • id
  • internal_note
  • order_id
  • payment_collection_id
  • requested_at
  • requested_by
  • status
  • updated_at

properties:

id:
  description: The order edit's ID
  type: string
  example: oe_01G8TJSYT9M6AVS5N4EMNFS1EK
order_id:
  description: The ID of the order that is edited
  type: string
  example: order_01G2SG30J8C85S4A5CHM2S1NS2
order:
  description: The details of the order that this order edit was created for.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
changes:
  description: The details of all the changes on the original order's line items.
  x-expandable: "changes"
  type: array
  items:
    $ref: "#/components/schemas/OrderItemChange"
internal_note:
  description: An optional note with additional details about the order edit.
  nullable: true
  type: string
  example: Included two more items B to the order.
created_by:
  description: The unique identifier of the user or customer who created the order edit.
  type: string
requested_by:
  description: The unique identifier of the user or customer who requested the order edit.
  nullable: true
  type: string
requested_at:
  description: The date with timezone at which the edit was requested.
  nullable: true
  type: string
  format: date-time
confirmed_by:
  description: The unique identifier of the user or customer who confirmed the order edit.
  nullable: true
  type: string
confirmed_at:
  description: The date with timezone at which the edit was confirmed.
  nullable: true
  type: string
  format: date-time
declined_by:
  description: The unique identifier of the user or customer who declined the order edit.
  nullable: true
  type: string
declined_at:
  description: The date with timezone at which the edit was declined.
  nullable: true
  type: string
  format: date-time
declined_reason:
  description: An optional note why  the order edit is declined.
  nullable: true
  type: string
canceled_by:
  description: The unique identifier of the user or customer who cancelled the order edit.
  nullable: true
  type: string
canceled_at:
  description: The date with timezone at which the edit was cancelled.
  nullable: true
  type: string
  format: date-time
subtotal:
  description: The total of subtotal
  type: integer
  example: 8000
discount_total:
  description: The total of discount
  type: integer
  example: 800
shipping_total:
  description: The total of the shipping amount
  type: integer
  example: 800
gift_card_total:
  description: The total of the gift card amount
  type: integer
  example: 800
gift_card_tax_total:
  description: The total of the gift card tax amount
  type: integer
  example: 800
tax_total:
  description: The total of tax
  type: integer
  example: 0
total:
  description: The total amount of the edited order.
  type: integer
  example: 8200
difference_due:
  description: The difference between the total amount of the order and total amount of edited order.
  type: integer
  example: 8200
status:
  description: The status of the order edit.
  type: string
  enum:
    - confirmed
    - declined
    - requested
    - created
    - canceled
items:
  description: The details of the cloned items from the original order with the new changes. Once the order edit is confirmed, these line items are associated with the original order.
  type: array
  x-expandable: "items"
  items:
    $ref: "#/components/schemas/LineItem"
payment_collection_id:
  description: The ID of the payment collection
  nullable: true
  type: string
  example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
  description: The details of the payment collection used to authorize additional payment if necessary.
  x-expandable: "payment_collection"
  nullable: true
  $ref: "#/components/schemas/PaymentCollection"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time

type OrderEditItemChangeType

type OrderEditItemChangeType string
const (
	OrderEditStatusItemAdd    OrderEditItemChangeType = "item_add"
	OrderEditStatusItemRemove OrderEditItemChangeType = "item_remove"
	OrderEditStatusItemUpdate OrderEditItemChangeType = "item_update"
)

func (*OrderEditItemChangeType) Scan

func (pl *OrderEditItemChangeType) Scan(value interface{}) error

func (OrderEditItemChangeType) Value

func (pl OrderEditItemChangeType) Value() (driver.Value, error)

type OrderEditStatus

type OrderEditStatus string
const (
	OrderEditStatusConfirmed OrderEditStatus = "confirmed"
	OrderEditStatusDeclined  OrderEditStatus = "declined"
	OrderEditStatusRequested OrderEditStatus = "requested"
	OrderEditStatusCreated   OrderEditStatus = "created"
	OrderEditStatusCanceled  OrderEditStatus = "canceled"
)

type OrderGiftCard

type OrderGiftCard struct {
	OrderId    uuid.NullUUID `gorm:"column:order_id;type:character varying;primaryKey;index:IDX_e62ff11e4730bb3adfead979ee,priority:1" json:"order_id"`
	GiftCardId uuid.NullUUID `` /* 128-byte string literal not displayed */
}

type OrderItemChange

type OrderItemChange struct {
	core.SoftDeletableModel

	Type               OrderEditItemChangeType `json:"type" gorm:"column:type"`
	OrderEditId        uuid.NullUUID           `json:"order_edit_id" gorm:"column:order_edit_id"`
	OrderEdit          *OrderEdit              `json:"order_edit" gorm:"foreignKey:OrderEditId"`
	OriginalLineItemId uuid.NullUUID           `json:"original_line_item_id" gorm:"column:original_line_item_id"`
	OriginalLineItem   *LineItem               `json:"original_line_item" gorm:"foreignKey:OriginalLineItemId"`
	LineItemId         uuid.NullUUID           `json:"line_item_id" gorm:"column:line_item_id"`
	LineItem           *LineItem               `json:"line_item" gorm:"foreignKey:LineItemId"`
}

@oas:schema:OrderItemChange title: "Order Item Change" description: "An order item change is a change made within an order edit to an order's items. These changes are not reflected on the original order until the order edit is confirmed." type: object required:

  • created_at
  • deleted_at
  • id
  • line_item_id
  • order_edit_id
  • original_line_item_id
  • type
  • updated_at

properties:

id:
  description: The order item change's ID
  type: string
  example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
  description: The order item change's status
  type: string
  enum:
    - item_add
    - item_remove
    - item_update
order_edit_id:
  description: The ID of the order edit
  type: string
  example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit:
  description: The details of the order edit the item change is associated with.
  x-expandable: "order_edit"
  nullable: true
  $ref: "#/components/schemas/OrderEdit"
original_line_item_id:
   description: The ID of the original line item in the order
   nullable: true
   type: string
   example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item:
   description: The details of the original line item this item change references. This is used if the item change updates or deletes the original item.
   x-expandable: "original_line_item"
   nullable: true
   $ref: "#/components/schemas/LineItem"
line_item_id:
   description: The ID of the cloned line item.
   nullable: true
   type: string
   example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item:
   description: The details of the resulting line item after the item change. This line item is then used in the original order once the order edit is confirmed.
   x-expandable: "line_item"
   nullable: true
   $ref: "#/components/schemas/LineItem"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type OrderSalesChannel

type OrderSalesChannel struct {
	core.SoftDeletableModel

	OrderId        uuid.NullUUID `` /* 131-byte string literal not displayed */
	SalesChannelId uuid.NullUUID `gorm:"column:sales_channel_id;type:character varying;primaryKey" json:"sales_channel_id"`
}

type OrderStatus

type OrderStatus string
const (
	OrderStatusPending        OrderStatus = "pending"
	OrderStatusCompleted      OrderStatus = "completed"
	OrderStatusArchived       OrderStatus = "archived"
	OrderStatusCanceled       OrderStatus = "canceled"
	OrderStatusRefunded       OrderStatus = "refunded"
	OrderStatusRequiresAction OrderStatus = "requires_action"
)

func (*OrderStatus) Scan

func (pl *OrderStatus) Scan(value interface{}) error

func (OrderStatus) Value

func (pl OrderStatus) Value() (driver.Value, error)

type Payment

type Payment struct {
	core.BaseModel

	SwapId         uuid.NullUUID `json:"swap_id" gorm:"column:swap_id"`
	Swap           *Swap         `json:"swap" gorm:"foreignKey:SwapId"`
	CartId         uuid.NullUUID `json:"cart_id" gorm:"column:cart_id"`
	Cart           *Cart         `json:"cart" gorm:"foreignKey:CartId"`
	OrderId        uuid.NullUUID `json:"order_id" gorm:"column:order_id"`
	Order          *Order        `json:"order" gorm:"foreignKey:OrderId"`
	Amount         float64       `json:"amount" gorm:"column:amount"`
	CurrencyCode   string        `json:"currency_code" gorm:"column:currency_code"`
	Currency       *Currency     `json:"currency" gorm:"foreignKey:CurrencyCode;foreignKey:Code"`
	AmountRefunded float64       `json:"amount_refunded" gorm:"column:amount_refunded;default:0"`
	ProviderId     uuid.NullUUID `json:"provider_id" gorm:"column:provider_id"`
	Data           core.JSONB    `json:"data" gorm:"column:data"`
	CapturedAt     *time.Time    `json:"captured_at" gorm:"column:captured_at"`
	CanceledAt     *time.Time    `json:"canceled_at" gorm:"column:canceled_at"`
	IdempotencyKey string        `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:Payment title: "Payment" description: "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources." type: object required:

  • amount
  • amount_refunded
  • canceled_at
  • captured_at
  • cart_id
  • created_at
  • currency_code
  • data
  • id
  • idempotency_key
  • metadata
  • order_id
  • provider_id
  • swap_id
  • updated_at

properties:

id:
  description: The payment's ID
  type: string
  example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE
swap_id:
  description: The ID of the swap that this payment was potentially created for.
  nullable: true
  type: string
  example: null
swap:
  description: The details of the swap that this payment was potentially created for.
  x-expandable: "swap"
  nullable: true
  $ref: "#/components/schemas/Swap"
cart_id:
  description: The ID of the cart that the payment session was potentially created for.
  nullable: true
  type: string
cart:
  description: The details of the cart that the payment session was potentially created for.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
order_id:
  description: The ID of the order that the payment session was potentially created for.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the payment session was potentially created for.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
amount:
  description: The amount that the Payment has been authorized for.
  type: integer
  example: 100
currency_code:
  description: The 3 character ISO currency code of the payment.
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
currency:
  description: The details of the currency of the payment.
  x-expandable: "currency"
  nullable: true
  $ref: "#/components/schemas/Currency"
amount_refunded:
  description: The amount of the original Payment amount that has been refunded back to the Customer.
  type: integer
  default: 0
  example: 0
provider_id:
  description: The id of the Payment Provider that is responsible for the Payment
  type: string
  example: manual
data:
  description: The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.
  type: object
  example: {}
captured_at:
  description: The date with timezone at which the Payment was captured.
  nullable: true
  type: string
  format: date-time
canceled_at:
  description: The date with timezone at which the Payment was canceled.
  nullable: true
  type: string
  format: date-time
idempotency_key:
  description: Randomly generated key used to continue the completion of a payment in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type PaymentCollection

type PaymentCollection struct {
	core.SoftDeletableModel

	Type             PaymentCollectionType   `json:"type" gorm:"column:type"`
	Status           PaymentCollectionStatus `json:"status" gorm:"column:status"`
	Description      string                  `json:"description" gorm:"column:description"`
	Amount           float64                 `json:"amount" gorm:"column:amount"`
	AuthorizedAmount float64                 `json:"authorized_amount" gorm:"column:authorized_amount"`
	RegionId         uuid.NullUUID           `json:"region_id" gorm:"column:region_id"`
	Region           *Region                 `json:"region" gorm:"foreignKey:RegionId"`
	CurrencyCode     string                  `json:"currency_code" gorm:"column:currency_code"`
	Currency         *Currency               `json:"currency" gorm:"foreignKey:CurrencyCode;foreignKey:Code"`
	PaymentSessions  []PaymentSession        `json:"payment_sessions" gorm:"many2many:payment_collection_sessions"`
	Payments         []Payment               `json:"payments" gorm:"many2many:payment_collection_payments"`
	CreatedBy        uuid.NullUUID           `json:"created_by" gorm:"column:created_by"`
}

@oas:schema:PaymentCollection title: "Payment Collection" description: "A payment collection allows grouping and managing a list of payments at one. This can be helpful when making additional payment for order edits or integrating installment payments." type: object required:

  • amount
  • authorized_amount
  • created_at
  • created_by
  • currency_code
  • deleted_at
  • description
  • id
  • metadata
  • region_id
  • status
  • type
  • updated_at

properties:

id:
  description: The payment collection's ID
  type: string
  example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
  description: The type of the payment collection
  type: string
  enum:
    - order_edit
status:
  description: The type of the payment collection
  type: string
  enum:
    - not_paid
    - awaiting
    - authorized
    - partially_authorized
    - canceled
description:
  description: Description of the payment collection
  nullable: true
  type: string
amount:
  description: Amount of the payment collection.
  type: integer
authorized_amount:
  description: Authorized amount of the payment collection.
  nullable: true
  type: integer
region_id:
  description: The ID of the region this payment collection is associated with.
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region this payment collection is associated with.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
currency_code:
  description: The three character ISO code for the currency this payment collection is associated with.
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
currency:
  description: The details of the currency this payment collection is associated with.
  x-expandable: "currency"
  nullable: true
  $ref: "#/components/schemas/Currency"
payment_sessions:
  description: The details of the payment sessions created as part of the payment collection.
  type: array
  x-expandable: "payment_sessions"
  items:
    $ref: "#/components/schemas/PaymentSession"
payments:
  description: The details of the payments created as part of the payment collection.
  type: array
  x-expandable: "payments"
  items:
    $ref: "#/components/schemas/Payment"
created_by:
  description: The ID of the user that created the payment collection.
  type: string
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type PaymentCollectionPayment

type PaymentCollectionPayment struct {
	PaymentCollectionId uuid.NullUUID `` /* 169-byte string literal not displayed */
	PaymentId           uuid.NullUUID `` /* 136-byte string literal not displayed */
}

type PaymentCollectionSession

type PaymentCollectionSession struct {
	PaymentCollectionId uuid.NullUUID `` /* 169-byte string literal not displayed */
	PaymentSessionId    uuid.NullUUID `` /* 160-byte string literal not displayed */
}

type PaymentCollectionStatus

type PaymentCollectionStatus string
const (
	PaymentCollectionStatusNotPaid             PaymentCollectionStatus = "not_paid"
	PaymentCollectionStatusAwaiting            PaymentCollectionStatus = "awaiting"
	PaymentCollectionStatusAuthorized          PaymentCollectionStatus = "authorized"
	PaymentCollectionStatusPartiallyAuthorized PaymentCollectionStatus = "partially_authorized"
	PaymentCollectionStatusCanceled            PaymentCollectionStatus = "canceled"
)

func (*PaymentCollectionStatus) Scan

func (pl *PaymentCollectionStatus) Scan(value interface{}) error

func (PaymentCollectionStatus) Value

func (pl PaymentCollectionStatus) Value() (driver.Value, error)

type PaymentCollectionType

type PaymentCollectionType string
const (
	PaymentCollectionTypeOrderEdit PaymentCollectionType = "order_edit"
)

func (*PaymentCollectionType) Scan

func (pl *PaymentCollectionType) Scan(value interface{}) error

func (PaymentCollectionType) Value

func (pl PaymentCollectionType) Value() (driver.Value, error)

type PaymentProvider

type PaymentProvider struct {
	core.SoftDeletableModel

	IsInstalled bool `json:"is_installed" gorm:"column:is_installed;default:true"`
}

@oas:schema:PaymentProvider title: "Payment Provider" description: "A payment provider represents a payment service installed in the Medusa backend, either through a plugin or backend customizations.

It holds the payment service's installation status."

type: object required:

  • id
  • is_installed

properties:

id:
  description: The ID of the payment provider as given by the payment service.
  type: string
  example: manual
is_installed:
  description: Whether the payment service is installed in the current version. If a payment service is no longer installed, the `is_installed` attribute is set to `false`.
  type: boolean
  default: true

type PaymentSession

type PaymentSession struct {
	core.BaseModel

	CartId              uuid.NullUUID        `json:"cart_id" gorm:"column:cart_id"`
	Cart                *Cart                `json:"cart" gorm:"foreignKey:CartId"`
	ProviderId          uuid.NullUUID        `json:"provider_id" gorm:"column:provider_id"`
	IsSelected          bool                 `json:"is_selected" gorm:"column:is_selected"`
	IsInitiated         bool                 `json:"is_initiated" gorm:"column:is_initiated;default:false"`
	Status              PaymentSessionStatus `json:"status" gorm:"column:status"`
	Data                core.JSONB           `json:"data" gorm:"column:data"`
	Amount              float64              `json:"amount" gorm:"column:amount"`
	PaymentAuthorizedAt *time.Time           `json:"payment_authorized_at" gorm:"column:payment_authorized_at"`
	IdempotencyKey      string               `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:PaymentSession title: "Payment Session" description: "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections." type: object required:

  • amount
  • cart_id
  • created_at
  • data
  • id
  • is_initiated
  • is_selected
  • idempotency_key
  • payment_authorized_at
  • provider_id
  • status
  • updated_at

properties:

id:
  description: The payment session's ID
  type: string
  example: ps_01G901XNSRM2YS3ASN9H5KG3FZ
cart_id:
  description: The ID of the cart that the payment session was created for.
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart that the payment session was created for.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
provider_id:
  description: The ID of the Payment Provider that is responsible for the Payment Session
  type: string
  example: manual
is_selected:
  description: A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase.
  nullable: true
  type: boolean
  example: true
is_initiated:
  description: A flag to indicate if a communication with the third party provider has been initiated.
  type: boolean
  default: false
  example: true
status:
  description: Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer.
  type: string
  enum:
    - authorized
    - pending
    - requires_more
    - error
    - canceled
  example: pending
data:
  description: The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.
  type: object
  example: {}
idempotency_key:
  description: Randomly generated key used to continue the completion of a cart in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
amount:
  description: The amount that the Payment Session has been authorized for.
  nullable: true
  type: integer
  example: 100
payment_authorized_at:
  description: The date with timezone at which the Payment Session was authorized.
  nullable: true
  type: string
  format: date-time
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time

type PaymentSessionStatus

type PaymentSessionStatus string
const (
	PaymentSessionStatusAuthorized   PaymentSessionStatus = "authorized"
	PaymentSessionStatusPending      PaymentSessionStatus = "pending"
	PaymentSessionStatusRequiresMore PaymentSessionStatus = "requires_more"
	PaymentSessionStatusError        PaymentSessionStatus = "error"
	PaymentSessionStatusCanceled     PaymentSessionStatus = "canceled"
	PaymentSessionStatusSuccess      PaymentSessionStatus = "success"
)

func (*PaymentSessionStatus) Scan

func (pl *PaymentSessionStatus) Scan(value interface{}) error

func (PaymentSessionStatus) Value

func (pl PaymentSessionStatus) Value() (driver.Value, error)

type PaymentStatus

type PaymentStatus string
const (
	PaymentStatusNotPaid           PaymentStatus = "not_paid"
	PaymentStatusAwaiting          PaymentStatus = "awaiting"
	PaymentStatusCaptured          PaymentStatus = "captured"
	PaymentStatusPartiallyRefunded PaymentStatus = "partially_refunded"
	PaymentStatusRefunded          PaymentStatus = "refunded"
	PaymentStatusCanceled          PaymentStatus = "canceled"
	PaymentStatusRequiresAction    PaymentStatus = "requires_action"
)

func (*PaymentStatus) Scan

func (pl *PaymentStatus) Scan(value interface{}) error

func (PaymentStatus) Value

func (pl PaymentStatus) Value() (driver.Value, error)

type PriceList

type PriceList struct {
	core.SoftDeletableModel

	CustomerGroups []CustomerGroup `json:"customer_groups" gorm:"many2many:price_list_customer_groups"`
	Description    string          `json:"description" gorm:"column:description"`
	EndsAt         *time.Time      `json:"ends_at" gorm:"column:ends_at"`
	IncludesTax    bool            `json:"includes_tax" gorm:"column:includes_tax"`
	Name           string          `json:"name" gorm:"column:name"`
	Prices         []MoneyAmount   `json:"prices" gorm:"foreignKey:Id"`
	StartsAt       *time.Time      `json:"starts_at" gorm:"column:starts_at"`
	Status         PriceListStatus `json:"status" gorm:"column:status;default:'draft'"`
	Type           PriceListType   `json:"type" gorm:"column:type;default:'sale'"`
}

@oas:schema:PriceList title: "Price List" description: "A Price List represents a set of prices that override the default price for one or more product variants." type: object required:

  • created_at
  • deleted_at
  • description
  • ends_at
  • id
  • name
  • starts_at
  • status
  • type
  • updated_at

properties:

id:
  description: The price list's ID
  type: string
  example: pl_01G8X3CKJXCG5VXVZ87H9KC09W
name:
  description: The price list's name
  type: string
  example: VIP Prices
description:
  description: The price list's description
  type: string
  example: Prices for VIP customers
type:
  description: The type of Price List. This can be one of either `sale` or `override`.
  type: string
  enum:
    - sale
    - override
  default: sale
status:
  description: The status of the Price List
  type: string
  enum:
    - active
    - draft
  default: draft
starts_at:
  description: The date with timezone that the Price List starts being valid.
  nullable: true
  type: string
  format: date-time
ends_at:
  description: The date with timezone that the Price List stops being valid.
  nullable: true
  type: string
  format: date-time
customer_groups:
  description: The details of the customer groups that the Price List can apply to.
  type: array
  x-expandable: "customer_groups"
  items:
    $ref: "#/components/schemas/CustomerGroup"
prices:
  description: The prices that belong to the price list, represented as a Money Amount.
  type: array
  x-expandable: "prices"
  items:
    $ref: "#/components/schemas/MoneyAmount"
includes_tax:
  description: "Whether the price list prices include tax"
  type: boolean
  x-featureFlag: "tax_inclusive_pricing"
  default: false
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type PriceListCustomerGroup

type PriceListCustomerGroup struct {
	PriceListId     uuid.NullUUID `` /* 130-byte string literal not displayed */
	CustomerGroupId uuid.NullUUID `` /* 138-byte string literal not displayed */
}

type PriceListStatus

type PriceListStatus string

The status of the Price List

const (
	PriceListStatusActive PriceListStatus = "active"
	PriceListStatusDraft  PriceListStatus = "draft"
)

Defines values for PriceListStatus.

func (*PriceListStatus) Scan

func (pl *PriceListStatus) Scan(value interface{}) error

func (PriceListStatus) Value

func (pl PriceListStatus) Value() (driver.Value, error)

type PriceListType

type PriceListType string

The type of Price List. This can be one of either `sale` or `override`.

const (
	Override PriceListType = "override"
	Sale     PriceListType = "sale"
)

func (*PriceListType) Scan

func (pl *PriceListType) Scan(value interface{}) error

func (PriceListType) Value

func (pl PriceListType) Value() (driver.Value, error)

type Product

type Product struct {
	core.SoftDeletableModel

	Collection    *ProductCollection `json:"collection" gorm:"foreignKey:CollectionId"`
	CollectionId  uuid.NullUUID      `json:"collection_id" gorm:"column:collection_id"`
	Description   string             `json:"description" gorm:"column:description"`
	Discountable  bool               `json:"discountable" gorm:"column:discountable;default:false"`
	ExternalId    string             `json:"external_id" gorm:"column:external_id"`
	Handle        string             `json:"handle" gorm:"column:handle"`
	Height        float64            `json:"height" gorm:"column:height"`
	HsCode        string             `json:"hs_code" gorm:"column:hs_code"`
	Images        []Image            `json:"images" gorm:"many2many:product_images"`
	IsGiftcard    bool               `json:"is_giftcard" gorm:"column:is_giftcard;default:false"`
	Length        float64            `json:"length" gorm:"column:length"`
	Material      string             `json:"material" gorm:"column:material"`
	MIdCode       uuid.NullUUID      `json:"mid_code" gorm:"column:mid_code"`
	Options       []ProductOption    `json:"options" gorm:"foreignKey:Id"`
	OriginCountry string             `json:"origin_country" gorm:"column:origin_country"`
	Categories    []ProductCategory  `json:"categories" gorm:"many2many:product_category_product"`
	Profile       *ShippingProfile   `json:"profile" gorm:"foreignKey:ProfileId"`
	ProfileId     uuid.NullUUID      `json:"profile_id" gorm:"column:profile_id"`
	Profiles      []ShippingProfile  `json:"profiles" gorm:"many2many:product_shipping_profile"`
	SalesChannels []SalesChannel     `json:"sales_channels" gorm:"many2many:product_sales_channel"`
	Status        ProductStatus      `json:"status" gorm:"column:status;default:'draft'"`
	Subtitle      string             `json:"subtitle" gorm:"column:subtitle"`
	Tags          []ProductTag       `json:"tags" gorm:"many2many:product_tags"`
	Thumbnail     string             `json:"thumbnail" gorm:"column:thumbnail"`
	Title         string             `json:"title" gorm:"column:title"`
	Type          *ProductType       `json:"type" gorm:"foreignKey:TypeId"`
	TypeId        uuid.NullUUID      `json:"type_id" gorm:"column:type_id"`
	Variants      []ProductVariant   `json:"variants" gorm:"foreignKey:Id"`
	Weight        float64            `json:"weight" gorm:"column:weight"`
	Width         float64            `json:"width" gorm:"column:width"`
}

type ProductCategory

type ProductCategory struct {
	core.BaseModel

	Name             string            `json:"name" gorm:"column:name"`
	Description      string            `json:"description" gorm:"column:description;default:''"`
	Handle           string            `json:"handle" gorm:"column:handle"`
	Mpath            string            `json:"mpath" gorm:"column:mpath"`
	IsInternal       bool              `json:"is_internal" gorm:"column:is_internal"`
	IsActive         bool              `json:"is_active" gorm:"column:is_active"`
	Rank             int64             `json:"rank" gorm:"column:rank;default:0"`
	CategoryChildren []ProductCategory `json:"category_children" gorm:"foreignKey:Id"`
	ParentCategoryId uuid.NullUUID     `json:"parent_category_id" gorm:"column:parent_category_id"`
	ParentCategory   *ProductCategory  `json:"parent_category" gorm:"foreignKey:ParentCategoryId"`
	Products         []Product         `json:"products" gorm:"many2many:product_category_product"`
}

@oas:schema:ProductCategory title: "Product Category" description: "A product category can be used to categorize products into a hierarchy of categories." x-resourceId: ProductCategory x-featureFlag: "product_categories" type: object required:

  • category_children
  • created_at
  • handle
  • id
  • is_active
  • is_internal
  • metadata
  • mpath
  • name
  • parent_category_id
  • updated_at

properties:

id:
  description: The product category's ID
  type: string
  example: pcat_01G2SG30J8C85S4A5CHM2S1NS2
name:
  description: The product category's name
  type: string
  example: Regular Fit
description:
  description: The product category's description.
  type: string
  default: ""
handle:
  description: A unique string that identifies the Product Category - can for example be used in slug structures.
  type: string
  example: regular-fit
mpath:
  description: A string for Materialized Paths - used for finding ancestors and descendents
  nullable: true
  type: string
  example: pcat_id1.pcat_id2.pcat_id3
is_internal:
  type: boolean
  description: A flag to make product category an internal category for admins
  default: false
is_active:
  type: boolean
  description: A flag to make product category visible/hidden in the store front
  default: false
rank:
  type: integer
  description: An integer that depicts the rank of category in a tree node
  default: 0
category_children:
  description: The details of the category's children.
  type: array
  x-expandable: "category_children"
  items:
    $ref: "#/components/schemas/ProductCategory"
parent_category_id:
  description: The ID of the parent category.
  nullable: true
  type: string
  default: null
parent_category:
  description: The details of the parent of this category.
  x-expandable: "parent_category"
  nullable: true
  $ref: "#/components/schemas/ProductCategory"
products:
  description: The details of the products that belong to this category.
  type: array
  x-expandable: "products"
  items:
    $ref: "#/components/schemas/Product"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductCategoryProduct

type ProductCategoryProduct struct {
	ProductCategoryId uuid.NullUUID `` /* 200-byte string literal not displayed */
	ProductId         uuid.NullUUID `` /* 173-byte string literal not displayed */
}

type ProductCollection

type ProductCollection struct {
	core.SoftDeletableModel

	Title    string    `json:"title" gorm:"column:title"`
	Handle   string    `json:"handle" gorm:"column:handle"`
	Products []Product `json:"products" gorm:"foreignKey:Id"`
}

@oas:schema:ProductCollection title: "Product Collection" description: "A Product Collection allows grouping together products for promotional purposes. For example, an admin can create a Summer collection, add products to it, and showcase it on the storefront." type: object required:

  • created_at
  • deleted_at
  • handle
  • id
  • metadata
  • title
  • updated_at

properties:

id:
  description: The product collection's ID
  type: string
  example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
title:
  description: The title that the Product Collection is identified by.
  type: string
  example: Summer Collection
handle:
  description: A unique string that identifies the Product Collection - can for example be used in slug structures.
  nullable: true
  type: string
  example: summer-collection
products:
  description: The details of the products that belong to this product collection.
  type: array
  x-expandable: "products"
  items:
    $ref: "#/components/schemas/Product"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductImage

type ProductImage struct {
	ProductId uuid.NullUUID `gorm:"column:product_id;type:character varying;primaryKey;index:IDX_4f166bb8c2bfcef2498d97b406,priority:1" json:"product_id"`
	ImageId   uuid.NullUUID `gorm:"column:image_id;type:character varying;primaryKey;index:IDX_2212515ba306c79f42c46a99db,priority:1" json:"image_id"`
}

type ProductOption

type ProductOption struct {
	core.SoftDeletableModel

	Product   *Product             `json:"product" gorm:"foreignKey:ProductId"`
	ProductId uuid.NullUUID        `json:"product_id" gorm:"column:product_id"`
	Title     string               `json:"title" gorm:"column:title"`
	Values    []ProductOptionValue `json:"values" gorm:"foreignKey:Id"`
}

@oas:schema:ProductOption title: "Product Option" description: A Product Option defines properties that may vary between different variants of a Product. Common Product Options are "Size" and "Color". Admins are free to create any product options. type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • product_id
  • title
  • updated_at

properties:

id:
  description: The product option's ID
  type: string
  example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
title:
  description: The title that the Product Option is defined by (e.g. `Size`).
  type: string
  example: Size
values:
  description: The details of the values of the product option.
  type: array
  x-expandable: "values"
  items:
    $ref: "#/components/schemas/ProductOptionValue"
product_id:
  description: The ID of the product that this product option belongs to.
  type: string
  example: prod_01G1G5V2MBA328390B5AXJ610F
product:
  description: The details of the product that this product option belongs to.
  x-expandable: "product"
  nullable: true
  $ref: "#/components/schemas/Product"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductOptionValue

type ProductOptionValue struct {
	core.SoftDeletableModel

	Option    *ProductOption  `json:"option" gorm:"foreignKey:OptionId"`
	OptionId  uuid.NullUUID   `json:"option_id" gorm:"column:option_id"`
	Value     string          `json:"value" gorm:"column:value"`
	Variant   *ProductVariant `json:"variant" gorm:"foreignKey:VariantId"`
	VariantId uuid.NullUUID   `json:"variant_id" gorm:"column:variant_id"`
}

@oas:schema:ProductOptionValue title: "Product Option Value" description: "An option value is one of the possible values of a Product Option. Product Variants specify a unique combination of product option values." type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • option_id
  • updated_at
  • value
  • variant_id

properties:

id:
  description: The product option value's ID
  type: string
  example: optval_01F0YESHR7S6ECD03RF6W12DSJ
value:
  description: The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is "Size" this value could be `Small`, `Medium` or `Large`).
  type: string
  example: large
option_id:
  description: The ID of the Product Option that the Product Option Value belongs to.
  type: string
  example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
option:
  description: The details of the product option that the Product Option Value belongs to.
  x-expandable: "option"
  nullable: true
  $ref: "#/components/schemas/ProductOption"
variant_id:
  description: The ID of the product variant that uses this product option value.
  type: string
  example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
  description: The details of the product variant that uses this product option value.
  x-expandable: "variant"
  nullable: true
  $ref: "#/components/schemas/ProductVariant"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductSalesChannel

type ProductSalesChannel struct {
	core.BaseModel

	ProductId      uuid.NullUUID `` /* 202-byte string literal not displayed */
	SalesChannelId uuid.NullUUID `` /* 214-byte string literal not displayed */
}

type ProductShippingProfile

type ProductShippingProfile struct {
	ProfileId uuid.NullUUID  `` /* 199-byte string literal not displayed */
	ProductId uuid.NullUUID  `` /* 199-byte string literal not displayed */
	UpdatedAt time.Time      `gorm:"column:updated_at;type:timestamp with time zone;not null;default:now()" json:"updated_at"`
	CreatedAt time.Time      `gorm:"column:created_at;type:timestamp with time zone;not null;default:now()" json:"created_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp with time zone" json:"deleted_at"`
}

type ProductStatus

type ProductStatus string

The status of the product

const (
	ProductStatusDraft     ProductStatus = "draft"
	ProductStatusProposed  ProductStatus = "proposed"
	ProductStatusPublished ProductStatus = "published"
	ProductStatusRejected  ProductStatus = "rejected"
)

func (*ProductStatus) Scan

func (ps *ProductStatus) Scan(value interface{}) error

func (ProductStatus) Value

func (ps ProductStatus) Value() (driver.Value, error)

type ProductTag

type ProductTag struct {
	core.SoftDeletableModel

	Value string `json:"value" gorm:"column:value"`
}

@oas:schema:ProductTag title: "Product Tag" description: "A Product Tag can be added to Products for easy filtering and grouping." type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • updated_at
  • value

properties:

id:
  description: The product tag's ID
  type: string
  example: ptag_01G8K2MTMG9168F2B70S1TAVK3
value:
  description: The value that the Product Tag represents
  type: string
  example: Pants
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductTaxRate

type ProductTaxRate struct {
	ProductId uuid.NullUUID `json:"product_id" gorm:"column:product_id"`
	Product   *Product      `json:"product" gorm:"foreignKey:ProductId"`
	RateId    uuid.NullUUID `json:"rate_id" gorm:"column:rate_id"`
	TaxRate   *TaxRate      `json:"tax_rate" gorm:"foreignKey:RateId"`
	Metadata  core.JSONB    `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:ProductTaxRate title: "Product Tax Rate" description: "This represents the association between a tax rate and a product to indicate that the product is taxed in a way different than the default." type: object required:

  • created_at
  • metadata
  • product_id
  • rate_id
  • updated_at

properties:

product_id:
  description: The ID of the Product
  type: string
  example: prod_01G1G5V2MBA328390B5AXJ610F
product:
  description: The details of the product.
  x-expandable: "product"
  nullable: true
  $ref: "#/components/schemas/Product"
rate_id:
  description: The ID of the Tax Rate
  type: string
  example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
  description: The details of the tax rate.
  x-expandable: "tax_rate"
  nullable: true
  $ref: "#/components/schemas/TaxRate"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductType

type ProductType struct {
	core.SoftDeletableModel

	Value string `json:"value" gorm:"column:value"`
}

@oas:schema:ProductType title: "Product Type" description: "A Product Type can be added to Products for filtering and reporting purposes." type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • updated_at
  • value

properties:

id:
  description: The product type's ID
  type: string
  example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
value:
  description: The value that the Product Type represents.
  type: string
  example: Clothing
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductTypeTaxRate

type ProductTypeTaxRate struct {
	ProductTypeId uuid.NullUUID `json:"product_type_id" gorm:"column:product_type_id"`
	ProductType   *ProductType  `json:"product_type" gorm:"foreignKey:ProductTypeId"`
	RateId        uuid.NullUUID `json:"rate_id" gorm:"column:rate_id"`
	TaxRate       *TaxRate      `json:"tax_rate" gorm:"foreignKey:RateId"`
	Metadata      core.JSONB    `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:ProductTypeTaxRate title: "Product Type Tax Rate" description: "This represents the association between a tax rate and a product type to indicate that the product type is taxed in a different way than the default." type: object required:

  • created_at
  • metadata
  • product_type_id
  • rate_id
  • updated_at

properties:

product_type_id:
  description: The ID of the Product type
  type: string
  example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
product_type:
  description: The details of the product type.
  x-expandable: "product_type"
  nullable: true
  $ref: "#/components/schemas/ProductType"
rate_id:
  description: The id of the Tax Rate
  type: string
  example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
  description: The details of the tax rate.
  x-expandable: "tax_rate"
  nullable: true
  $ref: "#/components/schemas/TaxRate"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ProductVariant

type ProductVariant struct {
	core.SoftDeletableModel

	AllowBackorder    bool                 `json:"allow_backorder" gorm:"column:allow_backorder;default:false"`
	Purchasable       bool                 `json:"purchasable" gorm:"column:purchasable"`
	Barcode           string               `json:"barcode" gorm:"column:barcode"`
	Ean               string               `json:"ean" gorm:"column:ean"`
	Height            float64              `json:"height" gorm:"column:height"`
	HsCode            string               `json:"hs_code" gorm:"column:hs_code"`
	InventoryQuantity int                  `json:"inventory_quantity" gorm:"column:inventory_quantity"`
	Length            float64              `json:"length" gorm:"column:length"`
	ManageInventory   bool                 `json:"manage_inventory" gorm:"column:manage_inventory;default:true"`
	Material          string               `json:"material" gorm:"column:material"`
	MIdCode           string               `json:"mid_code" gorm:"column:mid_code"`
	Options           []ProductOptionValue `json:"options" gorm:"foreignKey:Id"`
	OriginCountry     string               `json:"origin_country" gorm:"column:origin_country"`
	Prices            []MoneyAmount        `json:"prices" gorm:"many2many:product_variant_money_amount"`
	Product           *Product             `json:"product" gorm:"foreignKey:ProductId"`
	ProductId         uuid.NullUUID        `json:"product_id" gorm:"column:product_id"`
	Sku               string               `json:"sku" gorm:"column:sku"`
	Title             string               `json:"title" gorm:"column:title"`
	Upc               string               `json:"upc" gorm:"column:upc"`
	VariantRank       int                  `json:"variant_rank" gorm:"column:variant_rank;default:0"`
	Weight            float64              `json:"weight" gorm:"column:weight"`
	Width             float64              `json:"width" gorm:"column:width"`
}

@oas:schema:ProductVariant title: "Product Variant" description: "A Product Variant represents a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations. A product must at least have one product variant." type: object required:

  • allow_backorder
  • barcode
  • created_at
  • deleted_at
  • ean
  • height
  • hs_code
  • id
  • inventory_quantity
  • length
  • manage_inventory
  • material
  • metadata
  • mid_code
  • origin_country
  • product_id
  • sku
  • title
  • upc
  • updated_at
  • weight
  • width

properties:

id:
  description: The product variant's ID
  type: string
  example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
title:
  description: A title that can be displayed for easy identification of the Product Variant.
  type: string
  example: Small
product_id:
  description: The ID of the product that the product variant belongs to.
  type: string
  example: prod_01G1G5V2MBA328390B5AXJ610F
product:
  description: The details of the product that the product variant belongs to.
  x-expandable: "product"
  nullable: true
  $ref: "#/components/schemas/Product"
prices:
  description: The details of the prices of the Product Variant, each represented as a Money Amount. Each Money Amount represents a price in a given currency or a specific Region.
  type: array
  x-expandable: "prices"
  items:
    $ref: "#/components/schemas/MoneyAmount"
sku:
  description: The unique stock keeping unit used to identify the Product Variant. This will usually be a unique identifer for the item that is to be shipped, and can be referenced across multiple systems.
  nullable: true
  type: string
  example: shirt-123
barcode:
  description: A generic field for a GTIN number that can be used to identify the Product Variant.
  nullable: true
  type: string
  example: null
ean:
  description: An EAN barcode number that can be used to identify the Product Variant.
  nullable: true
  type: string
  example: null
upc:
  description: A UPC barcode number that can be used to identify the Product Variant.
  nullable: true
  type: string
  example: null
variant_rank:
  description: The ranking of this variant
  nullable: true
  type: number
  default: 0
inventory_quantity:
  description: The current quantity of the item that is stocked.
  type: integer
  example: 100
allow_backorder:
  description: Whether the Product Variant should be purchasable when `inventory_quantity` is 0.
  type: boolean
  default: false
manage_inventory:
  description: Whether Medusa should manage inventory for the Product Variant.
  type: boolean
  default: true
hs_code:
  description: The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
  nullable: true
  type: string
  example: null
origin_country:
  description: The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.
  nullable: true
  type: string
  example: null
mid_code:
  description: The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
  nullable: true
  type: string
  example: null
material:
  description: The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.
  nullable: true
  type: string
  example: null
weight:
  description: The weight of the Product Variant. May be used in shipping rate calculations.
  nullable: true
  type: number
  example: null
length:
  description: "The length of the Product Variant. May be used in shipping rate calculations."
  nullable: true
  type: number
  example: null
height:
  description: The height of the Product Variant. May be used in shipping rate calculations.
  nullable: true
  type: number
  example: null
width:
  description: The width of the Product Variant. May be used in shipping rate calculations.
  nullable: true
  type: number
  example: null
options:
  description: The details of the product options that this product variant defines values for.
  type: array
  x-expandable: "options"
  items:
    $ref: "#/components/schemas/ProductOptionValue"
inventory_items:
  description: The details inventory items of the product variant.
  type: array
  x-expandable: "inventory_items"
  items:
    $ref: "#/components/schemas/ProductVariantInventoryItem"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
purchasable:
  description: |
     Only used with the inventory modules.
     A boolean value indicating whether the Product Variant is purchasable.
     A variant is purchasable if:
       - inventory is not managed
       - it has no inventory items
       - it is in stock
       - it is backorderable.
  type: boolean

type ProductVariantInventoryItem

type ProductVariantInventoryItem struct {
	core.SoftDeletableModel

	InventoryItemId  uuid.NullUUID   `json:"inventory_item_id" gorm:"column:inventory_item_id"`
	VariantId        uuid.NullUUID   `json:"variant_id" gorm:"column:variant_id"`
	Variant          *ProductVariant `json:"variant" gorm:"foreignKey:VariantId"`
	RequiredQuantity int             `json:"required_quantity" gorm:"column:required_quantity;default:0"`
}

@oas:schema:ProductVariantInventoryItem title: "Product Variant Inventory Item" description: "A Product Variant Inventory Item links variants with inventory items and denotes the required quantity of the variant." type: object required:

  • created_at
  • deleted_at
  • id
  • inventory_item_id
  • required_quantity
  • updated_at
  • variant_id

properties:

id:
  description: The product variant inventory item's ID
  type: string
  example: pvitem_01G8X9A7ESKAJXG2H0E6F1MW7A
inventory_item_id:
  description: The id of the inventory item
  type: string
variant_id:
  description: The id of the variant.
  type: string
variant:
  description: The details of the product variant.
  x-expandable: "variant"
  nullable: true
  $ref: "#/components/schemas/ProductVariant"
required_quantity:
  description: The quantity of an inventory item required for the variant.
  type: integer
  default: 1
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type ProductVariantMoneyAmount

type ProductVariantMoneyAmount struct {
	core.SoftDeletableModel

	MoneyAmountId uuid.NullUUID `gorm:"index:idx_product_variant_money_amount_money_amount_id_unique;unique"`
	VariantId     uuid.NullUUID `gorm:"index:idx_product_variant_money_amount_variant_id"`
}

type PublishableApiKey

type PublishableApiKey struct {
	core.BaseModel

	CreatedBy uuid.NullUUID `json:"created_by" gorm:"column:created_by"`
	RevokedBy uuid.NullUUID `json:"revoked_by" gorm:"column:revoked_by"`
	RevokedAt *time.Time    `json:"revoked_at" gorm:"column:revoked_at"`
	Title     string        `json:"title" gorm:"column:title"`
}

@oas:schema:PublishableApiKey title: "Publishable API key" description: "A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment." type: object required:

  • created_at
  • created_by
  • id
  • revoked_by
  • revoked_at
  • title
  • updated_at

properties:

id:
  description: The key's ID
  type: string
  example: pk_01G1G5V27GYX4QXNARRQCW1N8T
created_by:
 description: The unique identifier of the user that created the key.
 nullable: true
 type: string
 example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
revoked_by:
  description: The unique identifier of the user that revoked the key.
  nullable: true
  type: string
  example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
revoked_at:
  description: The date with timezone at which the key was revoked.
  nullable: true
  type: string
  format: date-time
title:
  description: The key's title.
  type: string
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time

type PublishableApiKeySalesChannel

type PublishableApiKeySalesChannel struct {
	core.BaseModel

	SalesChannelId   uuid.NullUUID `json:"sales_channel_id" gorm:"column:sales_channel_id;primarykey"`
	PublishableKeyId uuid.NullUUID `json:"publishable_key_id" gorm:"column:publishable_key_id;primarykey"`
}

@oas:schema:PublishableApiKeySalesChannel title: "Publishable API Key Sales Channel" description: "This represents the association between the Publishable API keys and Sales Channels" type: object required:

  • publishable_key_id
  • sales_channel_id
  • created_at
  • updated_at
  • deleted_at

properties:

id:
 description: The relation's ID
 type: string
 example: pksc_01G8X9A7ESKAJXG2H0E6F1MW7A
sales_channel_id:
  description: The sales channel's ID
  type: string
  example: sc_01G1G5V21KADXNGH29BJMAJ4B4
publishable_key_id:
  description: The publishable API key's ID
  type: string
  example: pak_01G1G5V21KADXNGH29BJMAJ4B4
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type Refund

type Refund struct {
	core.BaseModel

	OrderId        uuid.NullUUID `json:"order_id" gorm:"column:order_id"`
	PaymentId      uuid.NullUUID `json:"payment_id" gorm:"column:payment_id"`
	Order          *Order        `json:"order" gorm:"foreignKey:OrderId"`
	Payment        *Payment      `json:"payment" gorm:"foreignKey:PaymentId"`
	Amount         float64       `json:"amount" gorm:"column:amount"`
	Note           string        `json:"note" gorm:"column:note"`
	Reason         RefundReason  `json:"reason" gorm:"column:reason"`
	IdempotencyKey string        `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:Refund title: "Refund" description: "A refund represents an amount of money transfered back to the customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by an admin for an order." type: object required:

  • amount
  • created_at
  • id
  • idempotency_key
  • metadata
  • note
  • order_id
  • payment_id
  • reason
  • updated_at

properties:

id:
  description: The refund's ID
  type: string
  example: ref_01G1G5V27GYX4QXNARRQCW1N8T
order_id:
  description: The ID of the order this refund was created for.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order this refund was created for.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
payment_id:
  description: The payment's ID, if available.
  nullable: true
  type: string
  example: pay_01G8ZCC5W42ZNY842124G7P5R9
payment:
  description: The details of the payment associated with the refund.
  x-expandable: "payment"
  nullable: true
  $ref: "#/components/schemas/Payment"
amount:
  description: The amount that has be refunded to the Customer.
  type: integer
  example: 1000
note:
  description: An optional note explaining why the amount was refunded.
  nullable: true
  type: string
  example: I didn't like it
reason:
  description: The reason given for the Refund, will automatically be set when processed as part of a Swap, Claim or Return.
  type: string
  enum:
    - discount
    - return
    - swap
    - claim
    - other
  example: return
idempotency_key:
  description: Randomly generated key used to continue the completion of the refund in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type RefundReason

type RefundReason string

The status of the product

const (
	RefundReasonDiscount RefundReason = "discount"
	RefundReasonReturn   RefundReason = "return"
	RefundReasonSwap     RefundReason = "swap"
	RefundReasonClaim    RefundReason = "claim"
	RefundReasonOther    RefundReason = "other"
)

func (*RefundReason) Scan

func (ps *RefundReason) Scan(value interface{}) error

func (RefundReason) Value

func (ps RefundReason) Value() (driver.Value, error)

type Region

type Region struct {
	core.SoftDeletableModel

	Name                 string                `json:"name" gorm:"column:name"`
	CurrencyCode         string                `json:"currency_code" gorm:"column:currency_code"`
	Currency             *Currency             `json:"currency" gorm:"foreignKey:CurrencyCode;foreignKey:Code"`
	TaxRate              float64               `json:"tax_rate" gorm:"column:tax_rate"`
	TaxRates             []TaxRate             `json:"tax_rates" gorm:"foreignKey:Id"`
	TaxCode              string                `json:"tax_code" gorm:"column:tax_code"`
	GiftCardsTaxable     bool                  `json:"gift_cards_taxable" gorm:"column:gift_cards_taxable;default:true"`
	AutomaticTaxes       bool                  `json:"automatic_taxes" gorm:"column:automatic_taxes;default:true"`
	Countries            []Country             `json:"countries" gorm:"foreignKey:Id"`
	TaxProviderId        uuid.NullUUID         `json:"tax_provider_id" gorm:"column:tax_provider_id"`
	TaxProvider          *TaxProvider          `json:"tax_provider" gorm:"foreignKey:TaxProviderId"`
	PaymentProviders     []PaymentProvider     `json:"payment_providers" gorm:"many2many:region_payment_providers;"`
	FulfillmentProviders []FulfillmentProvider `json:"fulfillment_providers" gorm:"many2many:region_fulfillment_providers;"`
	IncludesTax          bool                  `json:"includes_tax" gorm:"column:includes_tax"`
}

@oas:schema:Region title: "Region" description: "A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries." type: object required:

  • automatic_taxes
  • created_at
  • currency_code
  • deleted_at
  • gift_cards_taxable
  • id
  • metadata
  • name
  • tax_code
  • tax_provider_id
  • tax_rate
  • updated_at

properties:

id:
  description: The region's ID
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name:
  description: The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.
  type: string
  example: EU
currency_code:
  description: The three character currency code used in the region.
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
currency:
  description: The details of the currency used in the region.
  x-expandable: "currency"
  nullable: true
  $ref: "#/components/schemas/Currency"
tax_rate:
  description: The tax rate that should be charged on purchases in the Region.
  type: number
  example: 0
tax_rates:
  description: The details of the tax rates used in the region, aside from the default rate.
  type: array
  x-expandable: "tax_rates"
  items:
    $ref: "#/components/schemas/TaxRate"
tax_code:
  description: The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.
  nullable: true
  type: string
  example: null
gift_cards_taxable:
  description: Whether the gift cards are taxable or not in this region.
  type: boolean
  default: true
automatic_taxes:
  description: Whether taxes should be automated in this region.
  type: boolean
  default: true
countries:
  description: The details of the countries included in this region.
  type: array
  x-expandable: "countries"
  items:
    $ref: "#/components/schemas/Country"
tax_provider_id:
  description: The ID of the tax provider used in this region
  nullable: true
  type: string
  example: null
tax_provider:
  description: The details of the tax provider used in the region.
  x-expandable: "tax_provider"
  nullable: true
  $ref: "#/components/schemas/TaxProvider"
payment_providers:
  description: The details of the payment providers that can be used to process payments in the region.
  type: array
  x-expandable: "payment_providers"
  items:
    $ref: "#/components/schemas/PaymentProvider"
fulfillment_providers:
  description: The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.
  type: array
  x-expandable: "fulfillment_providers"
  items:
    $ref: "#/components/schemas/FulfillmentProvider"
includes_tax:
  description: "Whether the prices for the region include tax"
  type: boolean
  x-featureFlag: "tax_inclusive_pricing"
  default: false
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type RegionFulfillmentProvider

type RegionFulfillmentProvider struct {
	RegionId   uuid.NullUUID `gorm:"column:region_id;type:character varying;primaryKey;index:IDX_c556e14eff4d6f03db593df955,priority:1" json:"region_id"`
	ProviderId uuid.NullUUID `` /* 126-byte string literal not displayed */
}

type RegionPaymentProvider

type RegionPaymentProvider struct {
	RegionId   uuid.NullUUID `gorm:"column:region_id;type:character varying;primaryKey;index:IDX_8aaa78ba90d3802edac317df86,priority:1" json:"region_id"`
	ProviderId uuid.NullUUID `` /* 126-byte string literal not displayed */
}

type Return

type Return struct {
	core.BaseModel

	Status         ReturnStatus    `json:"status" gorm:"column:status;default:'requested'"`
	Items          []ReturnItem    `json:"items" gorm:"foreignKey:ReturnId"`
	SwapId         uuid.NullUUID   `json:"swap_id" gorm:"column:swap_id"`
	Swap           *Swap           `json:"swap" gorm:"foreignKey:SwapId"`
	OrderId        uuid.NullUUID   `json:"order_id" gorm:"column:order_id"`
	Order          *Order          `json:"order" gorm:"foreignKey:OrderId"`
	ClaimOrderId   uuid.NullUUID   `json:"claim_order_id" gorm:"column:claim_order_id"`
	ClaimOrder     *ClaimOrder     `json:"claim_order" gorm:"foreignKey:ClaimOrderId"`
	ShippingMethod *ShippingMethod `json:"shipping_method" gorm:"foreignKey:Id"`
	ShippingData   core.JSONB      `json:"shipping_data" gorm:"column:shipping_data"`
	RefundAmount   float64         `json:"refund_amount" gorm:"column:refund_amount"`
	NoNotification bool            `json:"no_notification" gorm:"column:no_notification"`
	LocationId     uuid.NullUUID   `json:"location_id" gorm:"column:location_id"`
	IdempotencyKey string          `json:"idempotency_key" gorm:"column:idempotency_key"`
	ReceivedAt     *time.Time      `json:"received_at" gorm:"column:received_at"`
}

@oas:schema:Return title: "Return" description: "A Return holds information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can also be used as part of a Swap or a Claim." type: object required:

  • claim_order_id
  • created_at
  • id
  • idempotency_key
  • location_id
  • metadata
  • no_notification
  • order_id
  • received_at
  • refund_amount
  • shipping_data
  • status
  • swap_id
  • updated_at

properties:

id:
  description: The return's ID
  type: string
  example: ret_01F0YET7XPCMF8RZ0Y151NZV2V
status:
  description: Status of the Return.
  type: string
  enum:
    - requested
    - received
    - requires_action
    - canceled
  default: requested
items:
  description: The details of the items that the customer is returning.
  type: array
  x-expandable: "items"
  items:
    $ref: "#/components/schemas/ReturnItem"
swap_id:
  description: The ID of the swap that the return may belong to.
  nullable: true
  type: string
  example: null
swap:
  description: The details of the swap that the return may belong to.
  x-expandable: "swap"
  nullable: true
  $ref: "#/components/schemas/Swap"
claim_order_id:
  description: The ID of the claim that the return may belong to.
  nullable: true
  type: string
  example: null
claim_order:
  description: The details of the claim that the return may belong to.
  x-expandable: "claim_order"
  nullable: true
  $ref: "#/components/schemas/ClaimOrder"
order_id:
  description: The ID of the order that the return was created for.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the return was created for.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
shipping_method:
  description: The details of the Shipping Method that will be used to send the Return back. Can be null if the Customer will handle the return shipment themselves.
  x-expandable: "shipping_method"
  nullable: true
  $ref: "#/components/schemas/ShippingMethod"
shipping_data:
  description: Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment.
  nullable: true
  type: object
  example: {}
location_id:
  description: The ID of the stock location the return will be added back.
  nullable: true
  type: string
  example: sloc_01G8TJSYT9M6AVS5N4EMNFS1EK
refund_amount:
  description: The amount that should be refunded as a result of the return.
  type: integer
  example: 1000
no_notification:
  description: When set to true, no notification will be sent related to this return.
  nullable: true
  type: boolean
  example: false
idempotency_key:
  description: Randomly generated key used to continue the completion of the return in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
received_at:
  description: The date with timezone at which the return was received.
  nullable: true
  type: string
  format: date-time
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ReturnItem

type ReturnItem struct {
	ReturnId          uuid.NullUUID `json:"return_id" gorm:"column:return_id;primarykey"`
	ReturnOrder       *Return       `json:"return_order" gorm:"foreignKey:ReturnId"`
	ItemId            uuid.NullUUID `json:"item_id" gorm:"column:item_id"`
	Item              *LineItem     `json:"item" gorm:"foreignKey:ItemId"`
	Quantity          int           `json:"quantity" gorm:"column:quantity"`
	IsRequested       bool          `json:"is_requested" gorm:"column:is_requested;default:true"`
	RequestedQuantity int           `json:"requested_quantity" gorm:"column:requested_quantity"`
	RecievedQuantity  int           `json:"recieved_quantity" gorm:"column:recieved_quantity"`
	ReasonId          uuid.NullUUID `json:"reason_id" gorm:"column:reason_id"`
	Reason            *ReturnReason `json:"reason" gorm:"foreignKey:ReasonId"`
	Note              string        `json:"note" gorm:"column:note"`
	Metadata          core.JSONB    `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:ReturnItem title: "Return Item" description: "A return item represents a line item in an order that is to be returned. It includes details related to the return and the reason behind it." type: object required:

  • is_requested
  • item_id
  • metadata
  • note
  • quantity
  • reason_id
  • received_quantity
  • requested_quantity
  • return_id

properties:

return_id:
  description: The ID of the Return that the Return Item belongs to.
  type: string
  example: ret_01F0YET7XPCMF8RZ0Y151NZV2V
item_id:
  description: The ID of the Line Item that the Return Item references.
  type: string
  example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
return_order:
  description: Details of the Return that the Return Item belongs to.
  x-expandable: "return_order"
  nullable: true
  $ref: "#/components/schemas/Return"
item:
  description: The details of the line item in the original order to be returned.
  x-expandable: "item"
  nullable: true
  $ref: "#/components/schemas/LineItem"
quantity:
  description: The quantity of the Line Item to be returned.
  type: integer
  example: 1
is_requested:
  description: Whether the Return Item was requested initially or received unexpectedly in the warehouse.
  type: boolean
  default: true
requested_quantity:
  description: The quantity that was originally requested to be returned.
  nullable: true
  type: integer
  example: 1
received_quantity:
  description: The quantity that was received in the warehouse.
  nullable: true
  type: integer
  example: 1
reason_id:
  description: The ID of the reason for returning the item.
  nullable: true
  type: string
  example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ
reason:
  description: The details of the reason for returning the item.
  x-expandable: "reason"
  nullable: true
  $ref: "#/components/schemas/ReturnReason"
note:
  description: An optional note with additional details about the Return.
  nullable: true
  type: string
  example: I didn't like it.
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ReturnReason

type ReturnReason struct {
	core.SoftDeletableModel

	Description          string         `json:"description" gorm:"column:description"`
	Label                string         `json:"label" gorm:"column:label"`
	Value                string         `json:"value" gorm:"column:value"`
	ParentReturnReasonId uuid.NullUUID  `json:"parent_return_reason_id" gorm:"column:parent_return_reason_id"`
	ParentReturnReason   *ReturnReason  `json:"parent_return_reason" gorm:"foreignKey:ParentReturnReasonId"`
	ReturnReasonChildren []ReturnReason `json:"return_reason_children" gorm:"foreignKey:Id"`
}

@oas:schema:ReturnReason title: "Return Reason" description: "A Return Reason is a value defined by an admin. It can be used on Return Items in order to indicate why a Line Item was returned." type: object required:

  • created_at
  • deleted_at
  • description
  • id
  • label
  • metadata
  • parent_return_reason_id
  • updated_at
  • value

properties:

id:
  description: The return reason's ID
  type: string
  example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ
value:
  description: The value to identify the reason by.
  type: string
  example: damaged
label:
  description: A text that can be displayed to the Customer as a reason.
  type: string
  example: Damaged goods
description:
  description: A description of the Reason.
  nullable: true
  type: string
  example: Items that are damaged
parent_return_reason_id:
  description: The ID of the parent reason.
  nullable: true
  type: string
  example: null
parent_return_reason:
  description: The details of the parent reason.
  x-expandable: "parent_return_reason"
  nullable: true
  $ref: "#/components/schemas/ReturnReason"
return_reason_children:
  description: The details of the child reasons.
  x-expandable: "return_reason_children"
  $ref: "#/components/schemas/ReturnReason"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ReturnStatus

type ReturnStatus string

ReturnStatus represents the status of a return

const (
	ReturnRequested      ReturnStatus = "requested"
	ReturnReceived       ReturnStatus = "received"
	ReturnRequiresAction ReturnStatus = "requires_action"
	ReturnCanceled       ReturnStatus = "canceled"
)

Enum values for ReturnStatus

func (*ReturnStatus) Scan

func (pl *ReturnStatus) Scan(value interface{}) error

func (ReturnStatus) Value

func (pl ReturnStatus) Value() (driver.Value, error)

type SalesChannel

type SalesChannel struct {
	core.SoftDeletableModel

	Name            string              `json:"name" gorm:"column:name"`
	Description     string              `json:"description" gorm:"column:description"`
	IsDisabled      bool                `json:"is_disabled" gorm:"column:is_disabled;default:false"`
	LocationIds     core.UUIDSlice      `json:"location_id" gorm:"column:location_id"`
	Products        []Product           `json:"products" gorm:"many2many:product_sales_channel"`
	Carts           []Cart              `json:"carts" gorm:"many2many:cart_sales_channel"`
	Orders          []Order             `json:"orders" gorm:"many2many:order_sales_channel"`
	PublishableKeys []PublishableApiKey `json:"publishableKeys" gorm:"many2many:publishable_api_key_sales_channel"`
	//TODO:add
	Locations []SalesChannelLocation `json:"locations" gorm:"foreignKey:SalesChannelId"`
}

type SalesChannelLocation

type SalesChannelLocation struct {
	core.SoftDeletableModel

	SalesChannelId uuid.NullUUID `json:"sales_channel_id" gorm:"column:sales_channel_id"`
	LocationId     uuid.NullUUID `json:"location_id" gorm:"column:location_id"`
	SalesChannel   *SalesChannel `json:"sales_channel" gorm:"foreignKey:SalesChannelId"`
}

@oas:schema:SalesChannelLocation title: "Sales Channel Stock Location" description: "This represents the association between a sales channel and a stock locations." type: object required:

  • created_at
  • deleted_at
  • id
  • location_id
  • sales_channel_id
  • updated_at

properties:

id:
  description: The Sales Channel Stock Location's ID
  type: string
  example: scloc_01G8X9A7ESKAJXG2H0E6F1MW7A
sales_channel_id:
  description: "The ID of the Sales Channel"
  type: string
  example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A
location_id:
  description: "The ID of the Location Stock."
  type: string
sales_channel:
  description: The details of the sales channel the location is associated with.
  x-expandable: "sales_channel"
  nullable: true
  $ref: "#/components/schemas/SalesChannel"
created_at:
  description: "The date with timezone at which the resource was created."
  type: string
  format: date-time
updated_at:
  description: "The date with timezone at which the resource was updated."
  type: string
  format: date-time
deleted_at:
  description: "The date with timezone at which the resource was deleted."
  nullable: true
  type: string
  format: date-time

type ShippingMethod

type ShippingMethod struct {
	core.SoftDeletableModel

	ShippingOptionId uuid.NullUUID           `json:"shipping_option_id" gorm:"column:shipping_option_id"`
	ShippingOption   *ShippingOption         `json:"shipping_option" gorm:"foreignKey:ShippingOptionId"`
	OrderId          uuid.NullUUID           `json:"order_id" gorm:"column:order_id"`
	Order            *Order                  `json:"order" gorm:"foreignKey:OrderId"`
	ReturnId         uuid.NullUUID           `json:"return_id" gorm:"column:return_id"`
	ReturnOrder      *Return                 `json:"return_order" gorm:"foreignKey:ReturnId"`
	SwapId           uuid.NullUUID           `json:"swap_id" gorm:"column:swap_id"`
	Swap             *Swap                   `json:"swap" gorm:"foreignKey:SwapId"`
	CartId           uuid.NullUUID           `json:"cart_id" gorm:"column:cart_id"`
	Cart             *Cart                   `json:"cart" gorm:"foreignKey:CartId"`
	ClaimOrderId     uuid.NullUUID           `json:"claim_order_id" gorm:"column:claim_order_id"`
	ClaimOrder       *ClaimOrder             `json:"claim_order" gorm:"foreignKey:ClaimOrderId"`
	TaxLines         []ShippingMethodTaxLine `json:"tax_lines" gorm:"foreignKey:Id"`
	Price            float64                 `json:"price" gorm:"column:price"`
	Subtotal         float64                 `json:"subtotal" gorm:"column:subtotal"`
	TaxTotal         float64                 `json:"tax_total" gorm:"column:tax_total"`
	Total            float64                 `json:"total" gorm:"column:total"`
	OriginalTotal    float64                 `json:"original_total" gorm:"column:original_total"`
	OriginalTaxTotal float64                 `json:"original_tax_total" gorm:"column:original_tax_total"`
	Data             core.JSONB              `json:"data" gorm:"column:data"`
	IncludesTax      bool                    `json:"includes_tax" gorm:"column:includes_tax"`
}

@oas:schema:ShippingMethod title: "Shipping Method" description: "A Shipping Method represents a way in which an Order or Return can be shipped. Shipping Methods are created from a Shipping Option, but may contain additional details that can be necessary for the Fulfillment Provider to handle the shipment. If the shipping method is created for a return, it may be associated with a claim or a swap that the return is part of." type: object required:

  • cart_id
  • claim_order_id
  • data
  • id
  • order_id
  • price
  • return_id
  • shipping_option_id
  • swap_id

properties:

id:
  description: The shipping method's ID
  type: string
  example: sm_01F0YET7DR2E7CYVSDHM593QG2
shipping_option_id:
  description: The ID of the Shipping Option that the Shipping Method is built from.
  type: string
  example: so_01G1G5V27GYX4QXNARRQCW1N8T
order_id:
  description: The ID of the order that the shipping method is used in.
  nullable: true
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the shipping method is used in.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
claim_order_id:
  description: The ID of the claim that the shipping method is used in.
  nullable: true
  type: string
  example: null
claim_order:
  description: The details of the claim that the shipping method is used in.
  x-expandable: "claim_order"
  nullable: true
  $ref: "#/components/schemas/ClaimOrder"
cart_id:
  description: The ID of the cart that the shipping method is used in.
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart that the shipping method is used in.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
swap_id:
  description: The ID of the swap that the shipping method is used in.
  nullable: true
  type: string
  example: null
swap:
  description: The details of the swap that the shipping method is used in.
  x-expandable: "swap"
  nullable: true
  $ref: "#/components/schemas/Swap"
return_id:
  description: The ID of the return that the shipping method is used in.
  nullable: true
  type: string
  example: null
return_order:
  description: The details of the return that the shipping method is used in.
  x-expandable: "return_order"
  nullable: true
  $ref: "#/components/schemas/Return"
shipping_option:
  description: The details of the shipping option the method was created from.
  x-expandable: "shipping_option"
  nullable: true
  $ref: "#/components/schemas/ShippingOption"
tax_lines:
  description: The details of the tax lines applied on the shipping method.
  type: array
  x-expandable: "tax_lines"
  items:
    $ref: "#/components/schemas/ShippingMethodTaxLine"
price:
  description: The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of.
  type: integer
  example: 200
data:
  description: Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id.
  type: object
  example: {}
includes_tax:
  description: "Whether the shipping method price include tax"
  type: boolean
  x-featureFlag: "tax_inclusive_pricing"
  default: false
subtotal:
  description: The subtotal of the shipping
  type: integer
  example: 8000
total:
  description: The total amount of the shipping
  type: integer
  example: 8200
tax_total:
  description: The total of tax
  type: integer
  example: 0

type ShippingMethodTaxLine

type ShippingMethodTaxLine struct {
	core.SoftDeletableModel

	ShippingMethodId uuid.NullUUID   `json:"shipping_method_id" gorm:"column:shipping_method_id"`
	ShippingMethod   *ShippingMethod `json:"shipping_method" gorm:"foreignKey:ShippingMethodId"`
	Code             string          `json:"code" gorm:"column:code"`
	Name             string          `json:"name" gorm:"column:name"`
	Rate             float64         `json:"rate" gorm:"column:rate"`
}

type ShippingOption

type ShippingOption struct {
	core.SoftDeletableModel

	Amount       float64                     `json:"amount" gorm:"column:amount"`
	Data         core.JSONB                  `json:"data" gorm:"column:data"`
	IncludesTax  bool                        `json:"includes_tax" gorm:"column:includes_tax"`
	IsReturn     bool                        `json:"is_return" gorm:"column:is_return;default:false"`
	AdminOnly    bool                        `json:"admin_only" gorm:"column:admin_only;default:false"`
	Name         string                      `json:"name" gorm:"column:name"`
	PriceType    ShippingOptionPriceType     `json:"price_type" gorm:"column:price_type"`
	Profile      *ShippingProfile            `json:"profile" gorm:"foreignKey:ProfileId"`
	ProfileId    uuid.NullUUID               `json:"profile_id" gorm:"column:profile_id"`
	Provider     *FulfillmentProvider        `json:"provider" gorm:"foreignKey:ProviderId"`
	ProviderId   uuid.NullUUID               `json:"provider_id" gorm:"column:provider_id"`
	Region       *Region                     `json:"region" gorm:"foreignKey:RegionId"`
	RegionId     uuid.NullUUID               `json:"region_id" gorm:"column:region_id"`
	Requirements []ShippingOptionRequirement `json:"requirements" gorm:"foreignKey:Id"`
}

@oas:schema:ShippingOption title: "Shipping Option" description: "A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information." type: object required:

  • admin_only
  • amount
  • created_at
  • data
  • deleted_at
  • id
  • is_return
  • metadata
  • name
  • price_type
  • profile_id
  • provider_id
  • region_id
  • updated_at

properties:

id:
  description: The shipping option's ID
  type: string
  example: so_01G1G5V27GYX4QXNARRQCW1N8T
name:
  description: The name given to the Shipping Option - this may be displayed to the Customer.
  type: string
  example: PostFake Standard
region_id:
  description: The ID of the region this shipping option can be used in.
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region this shipping option can be used in.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
profile_id:
  description: The ID of the Shipping Profile that the shipping option belongs to.
  type: string
  example: sp_01G1G5V239ENSZ5MV4JAR737BM
profile:
  description: The details of the shipping profile that the shipping option belongs to.
  x-expandable: "profile"
  nullable: true
  $ref: "#/components/schemas/ShippingProfile"
provider_id:
  description: The ID of the fulfillment provider that will be used to later to process the shipping method created from this shipping option and its fulfillments.
  type: string
  example: manual
provider:
  description: The details of the fulfillment provider that will be used to later to process the shipping method created from this shipping option and its fulfillments.
  x-expandable: "provider"
  nullable: true
  $ref: "#/components/schemas/FulfillmentProvider"
price_type:
  description: The type of pricing calculation that is used when creatin Shipping Methods from the Shipping Option. Can be `flat_rate` for fixed prices or `calculated` if the Fulfillment Provider can provide price calulations.
  type: string
  enum:
    - flat_rate
    - calculated
  example: flat_rate
amount:
  description: The amount to charge for shipping when the Shipping Option price type is `flat_rate`.
  nullable: true
  type: integer
  example: 200
is_return:
  description: Flag to indicate if the Shipping Option can be used for Return shipments.
  type: boolean
  default: false
admin_only:
  description: Flag to indicate if the Shipping Option usage is restricted to admin users.
  type: boolean
  default: false
requirements:
  description: The details of the requirements that must be satisfied for the Shipping Option to be available for usage in a Cart.
  type: array
  x-expandable: "requirements"
  items:
    $ref: "#/components/schemas/ShippingOptionRequirement"
data:
  description: The data needed for the Fulfillment Provider to identify the Shipping Option.
  type: object
  example: {}
includes_tax:
  description: "Whether the shipping option price include tax"
  type: boolean
  x-featureFlag: "tax_inclusive_pricing"
  default: false
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ShippingOptionPriceType

type ShippingOptionPriceType string

The type of pricing calculation that is used when creatin Shipping Methods from the Shipping Option. Can be `flat_rate` for fixed prices or `calculated` if the Fulfillment Provider can provide price calulations.

const (
	ShippingOptionPriceCalculated ShippingOptionPriceType = "calculated"
	ShippingOptionPriceFlatRate   ShippingOptionPriceType = "flat_rate"
)

Defines values for ShippingOptionPriceType.

func (*ShippingOptionPriceType) Scan

func (so *ShippingOptionPriceType) Scan(value interface{}) error

func (ShippingOptionPriceType) Value

func (so ShippingOptionPriceType) Value() (driver.Value, error)

type ShippingOptionRequirement

type ShippingOptionRequirement struct {
	core.SoftDeletableModel

	Amount           float64                       `json:"amount" gorm:"column:amount"`
	ShippingOption   *ShippingOption               `json:"shipping_option" gorm:"foreignKey:ShippingOptionId"`
	ShippingOptionId uuid.NullUUID                 `json:"shipping_option_id" gorm:"column:shipping_option_id"`
	Type             ShippingOptionRequirementType `json:"type" gorm:"column:type"`
}

@oas:schema:ShippingOptionRequirement title: "Shipping Option Requirement" description: "A shipping option requirement defines conditions that a Cart must satisfy for the Shipping Option to be available for usage in the Cart." type: object required:

  • amount
  • deleted_at
  • id
  • shipping_option_id
  • type

properties:

id:
  description: The shipping option requirement's ID
  type: string
  example: sor_01G1G5V29AB4CTNDRFSRWSRKWD
shipping_option_id:
  description: The ID of the shipping option that the requirements belong to.
  type: string
  example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
  description: The details of the shipping option that the requirements belong to.
  x-expandable: "shipping_option"
  nullable: true
  $ref: "#/components/schemas/ShippingOption"
type:
  description: The type of the requirement, this defines how the value will be compared to the Cart's total. `min_subtotal` requirements define the minimum subtotal that is needed for the Shipping Option to be available, while the `max_subtotal` defines the maximum subtotal that the Cart can have for the Shipping Option to be available.
  type: string
  enum:
    - min_subtotal
    - max_subtotal
  example: min_subtotal
amount:
  description: The amount to compare the Cart subtotal to.
  type: integer
  example: 100
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time

type ShippingOptionRequirementType

type ShippingOptionRequirementType string

The type of the requirement, this defines how the value will be compared to the Cart's total. `min_subtotal` requirements define the minimum subtotal that is needed for the Shipping Option to be available, while the `max_subtotal` defines the maximum subtotal that the Cart can have for the Shipping Option to be available.

const (
	ShippingOptionRequirementMaxSubtotal ShippingOptionRequirementType = "max_subtotal"
	ShippingOptionRequirementMinSubtotal ShippingOptionRequirementType = "min_subtotal"
)

Defines values for ShippingOptionRequirementType.

func (*ShippingOptionRequirementType) Scan

func (so *ShippingOptionRequirementType) Scan(value interface{}) error

func (ShippingOptionRequirementType) Value

type ShippingProfile

type ShippingProfile struct {
	core.SoftDeletableModel

	Name            string              `json:"name" gorm:"column:name"`
	Products        []Product           `json:"products" gorm:"many2many:product_shipping_profile"`
	ShippingOptions []ShippingOption    `json:"shipping_options" gorm:"foreignKey:Id"`
	Type            ShippingProfileType `json:"type" gorm:"column:type"`
}

@oas:schema:ShippingProfile title: "Shipping Profile" description: "A Shipping Profile has a set of defined Shipping Options that can be used to fulfill a given set of Products. For example, gift cards are shipped differently than physical products,

so a shipping profile with the type `gift_card` groups together the shipping options that can only be used for gift cards."

type: object required:

  • created_at
  • deleted_at
  • id
  • metadata
  • name
  • type
  • updated_at

properties:

id:
  description: The shipping profile's ID
  type: string
  example: sp_01G1G5V239ENSZ5MV4JAR737BM
name:
  description: The name given to the Shipping profile - this may be displayed to the Customer.
  type: string
  example: Default Shipping Profile
type:
  description: The type of the Shipping Profile, may be `default`, `gift_card` or `custom`.
  type: string
  enum:
    - default
    - gift_card
    - custom
  example: default
products:
  description: The details of the products that the Shipping Profile defines Shipping Options for. Available if the relation `products` is expanded.
  type: array
  x-expandable: "products"
  items:
    $ref: "#/components/schemas/Product"
shipping_options:
  description: The details of the shipping options that can be used to create shipping methods for the Products in the Shipping Profile.
  type: array
  x-expandable: "shipping_options"
  items:
    $ref: "#/components/schemas/ShippingOption"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type ShippingProfileType

type ShippingProfileType string

The type of the Shipping Profile, may be `default`, `gift_card` or `custom`.

const (
	ShippingProfileTypeCustom   ShippingProfileType = "custom"
	ShippingProfileTypeDefault  ShippingProfileType = "default"
	ShippingProfileTypeGiftCard ShippingProfileType = "gift_card"
)

Defines values for ShippingProfileType.

func (*ShippingProfileType) Scan

func (sp *ShippingProfileType) Scan(value interface{}) error

func (ShippingProfileType) Value

func (sp ShippingProfileType) Value() (driver.Value, error)

type ShippingTaxRate

type ShippingTaxRate struct {
	ShippingOptionId uuid.NullUUID   `json:"shipping_option_id" gorm:"column:shipping_option_id;primaryKey"`
	RateId           uuid.NullUUID   `json:"rate_id" gorm:"column:rate_id;primaryKey"`
	ShippingOption   *ShippingOption `json:"shipping_option" gorm:"foreignKey:ShippingOptionId"`
	TaxRate          *TaxRate        `json:"tax_rate" gorm:"foreignKey:RateId"`
	CreatedAt        time.Time       `json:"created_at" gorm:"column:created_at;created_at"`
	UpdatedAt        time.Time       `json:"updated_at" gorm:"column:updated_at;updated_at"`
	Metadata         core.JSONB      `json:"metadata" gorm:"column:metadata"`
}

@oas:schema:ShippingTaxRate title: "Shipping Tax Rate" description: "This represents the tax rates applied on a shipping option." type: object required:

  • created_at
  • metadata
  • rate_id
  • shipping_option_id
  • updated_at

properties:

shipping_option_id:
  description: The ID of the shipping option.
  type: string
  example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
  description: The details of the shipping option.
  x-expandable: "shipping_option"
  nullable: true
  $ref: "#/components/schemas/ShippingOption"
rate_id:
  description: The ID of the associated tax rate.
  type: string
  example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
  description: The details of the associated tax rate.
  x-expandable: "tax_rate"
  nullable: true
  $ref: "#/components/schemas/TaxRate"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type StagedJob

type StagedJob struct {
	core.SoftDeletableModel

	EventName string     `json:"event_name" gorm:"column:event_name"`
	Data      core.JSONB `json:"data" gorm:"column:data"`
	//TODO: add ;default:{}
	Options core.JSONB `json:"options" gorm:"column:options"`
}

@oas:schema:StagedJob title: "Staged Job" description: "A staged job resource" type: object required:

  • data
  • event_name
  • id
  • options

properties:

id:
  description: The staged job's ID
  type: string
  example: job_01F0YET7BZTARY9MKN1SJ7AAXF
event_name:
  description: The name of the event
  type: string
  example: order.placed
data:
  description: Data necessary for the job
  type: object
  example: {}
option:
  description: The staged job's option
  type: object
  example: {}

type Store

type Store struct {
	core.BaseModel

	Name                  string        `json:"name" gorm:"column:name;default:'Store'"`
	DefaultCurrencyCode   string        `json:"default_currency_code" gorm:"column:default_currency_code;default:'usd'"`
	DefaultCurrency       *Currency     `json:"default_currency" gorm:"foreignKey:DefaultCurrencyCode;foreignKey:Code"`
	Currencies            []Currency    `json:"currencies" gorm:"many2many:store_currencies"`
	SwapLinkTemplate      string        `json:"swap_link_template" gorm:"column:swap_link_template"`
	PaymentLinkTemplate   string        `json:"payment_link_template" gorm:"column:payment_link_template"`
	InviteLinkTemplate    string        `json:"invite_link_template" gorm:"column:invite_link_template"`
	DefaultSalesChannelId uuid.NullUUID `json:"default_sales_channel_id" gorm:"column:default_sales_channel_id"`
	DefaultSalesChannel   *SalesChannel `json:"default_sales_channel" gorm:"foreignKey:DefaultSalesChannelId"`
}

@oas:schema:Store title: "Store" description: "A store holds the main settings of the commerce shop. By default, only one store is created and used within the Medusa backend. It holds settings related to the name of the store, available currencies, and more." type: object required:

  • created_at
  • default_currency_code
  • default_location_id
  • id
  • invite_link_template
  • metadata
  • name
  • payment_link_template
  • swap_link_template
  • updated_at

properties:

id:
  description: The store's ID
  type: string
  example: store_01G1G5V21KADXNGH29BJMAJ4B4
name:
  description: The name of the Store - this may be displayed to the Customer.
  type: string
  example: Medusa Store
  default: Medusa Store
default_currency_code:
  description: The three character currency code that is the default of the store.
  type: string
  example: usd
  externalDocs:
    url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
    description: See a list of codes.
default_currency:
  description: The details of the store's default currency.
  x-expandable: "default_currency"
  default: "usd"
  nullable: true
  $ref: "#/components/schemas/Currency"
currencies:
  description: The details of the enabled currencies in the store.
  type: array
  x-expandable: "currencies"
  items:
    $ref: "#/components/schemas/Currency"
swap_link_template:
  description: A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link.
  nullable: true
  type: string
  example: null
payment_link_template:
  description: A template to generate Payment links from. Use {{cart_id}} to include the payment's `cart_id` in the link.
  nullable: true
  type: string
  example: null
invite_link_template:
  description: A template to generate Invite links from
  nullable: true
  type: string
  example: null
default_location_id:
  description: The location ID the store is associated with.
  nullable: true
  type: string
  example: null
default_sales_channel_id:
  description: The ID of the store's default sales channel.
  nullable: true
  type: string
  example: null
default_sales_channel:
  description: The details of the store's default sales channel.
  x-expandable: "default_sales_channel"
  nullable: true
  $ref: "#/components/schemas/SalesChannel"
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type StoreCurrency

type StoreCurrency struct {
	StoreId      uuid.NullUUID `gorm:"column:store_id;type:character varying;primaryKey;index:IDX_b4f4b63d1736689b7008980394,priority:1" json:"store_id"`
	CurrencyCode string        `` /* 130-byte string literal not displayed */
}

type Swap

type Swap struct {
	core.SoftDeletableModel

	FulfillmentStatus SwapFulfillmentStatus `json:"fulfillment_status" gorm:"column:fulfillment_status"`
	PaymentStatus     SwapPaymentStatus     `json:"payment_status" gorm:"column:payment_status"`
	OrderId           uuid.NullUUID         `json:"order_id" gorm:"column:order_id"`
	Order             *Order                `json:"order" gorm:"foreignKey:OrderId"`
	AdditionalItems   []LineItem            `json:"additional_items" gorm:"foreignKey:Id"`
	ReturnOrder       *Return               `json:"return_order" gorm:"foreignKey:Id"`
	Fulfillments      []Fulfillment         `json:"fulfillments" gorm:"foreignKey:Id"`
	Payment           *Payment              `json:"payment" gorm:"foreignKey:Id"`
	DifferenceDue     float64               `json:"difference_due" gorm:"column:difference_due"`
	ShippingAddressId uuid.NullUUID         `json:"shipping_address_id" gorm:"column:shipping_address_id"`
	ShippingAddress   *Address              `json:"shipping_address" gorm:"foreignKey:ShippingAddressId"`
	ShippingMethods   []ShippingMethod      `json:"shipping_methods" gorm:"foreignKey:Id"`
	CartId            uuid.NullUUID         `json:"cart_id" gorm:"column:cart_id"`
	Cart              *Cart                 `json:"cart" gorm:"foreignKey:CartId"`
	AllowBackorder    bool                  `json:"allow_backorder" gorm:"column:allow_backorder;default:false"`
	IdempotencyKey    string                `json:"idempotency_key" gorm:"column:idempotency_key"`
	ConfirmedAt       *time.Time            `json:"confirmed_at" gorm:"column:confirmed_at"`
	CanceledAt        *time.Time            `json:"canceled_at" gorm:"column:canceled_at"`
	NoNotification    bool                  `json:"no_notification" gorm:"column:no_notification"`
}

@oas:schema:Swap title: "Swap" description: "A swap can be created when a Customer wishes to exchange Products that they have purchased with different Products. It consists of a Return of previously purchased Products and a Fulfillment of new Products. It also includes information on any additional payment or refund required based on the difference between the exchanged products." type: object required:

  • allow_backorder
  • canceled_at
  • cart_id
  • confirmed_at
  • created_at
  • deleted_at
  • difference_due
  • fulfillment_status
  • id
  • idempotency_key
  • metadata
  • no_notification
  • order_id
  • payment_status
  • shipping_address_id
  • updated_at

properties:

id:
  description: The swap's ID
  type: string
  example: swap_01F0YET86Y9G92D3YDR9Y6V676
fulfillment_status:
  description: The status of the Fulfillment of the Swap.
  type: string
  enum:
    - not_fulfilled
    - fulfilled
    - shipped
    - partially_shipped
    - canceled
    - requires_action
  example: not_fulfilled
payment_status:
  description: The status of the Payment of the Swap. The payment may either refer to the refund of an amount or the authorization of a new amount.
  type: string
  enum:
    - not_paid
    - awaiting
    - captured
    - confirmed
    - canceled
    - difference_refunded
    - partially_refunded
    - refunded
    - requires_action
  example: not_paid
order_id:
  description: The ID of the order that the swap belongs to.
  type: string
  example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
  description: The details of the order that the swap belongs to.
  x-expandable: "order"
  nullable: true
  $ref: "#/components/schemas/Order"
additional_items:
  description: The details of the new products to send to the customer, represented as line items.
  type: array
  x-expandable: "additional_items"
  items:
    $ref: "#/components/schemas/LineItem"
return_order:
  description: The details of the return that belongs to the swap, which holds the details on the items being returned.
  x-expandable: "return_order"
  nullable: true
  $ref: "#/components/schemas/Return"
fulfillments:
  description: The details of the fulfillments that are used to send the new items to the customer.
  x-expandable: "fulfillments"
  type: array
  items:
    $ref: "#/components/schemas/Fulfillment"
payment:
  description: The details of the additional payment authorized by the customer when `difference_due` is positive.
  x-expandable: "payment"
  nullable: true
  $ref: "#/components/schemas/Payment"
difference_due:
  description: The difference amount between the order’s original total and the new total imposed by the swap. If its value is negative, a refund must be issues to the customer. If it's positive, additional payment must be authorized by the customer. Otherwise, no payment processing is required.
  nullable: true
  type: integer
  example: 0
shipping_address_id:
  description: The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order.
  nullable: true
  type: string
  example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
  description: The details of the shipping address that the new items should be sent to.
  x-expandable: "shipping_address"
  nullable: true
  $ref: "#/components/schemas/Address"
shipping_methods:
  description: The details of the shipping methods used to fulfill the additional items purchased.
  type: array
  x-expandable: "shipping_methods"
  items:
    $ref: "#/components/schemas/ShippingMethod"
cart_id:
  description: The ID of the cart that the customer uses to complete the swap.
  nullable: true
  type: string
  example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
  description: The details of the cart that the customer uses to complete the swap.
  x-expandable: "cart"
  nullable: true
  $ref: "#/components/schemas/Cart"
confirmed_at:
  description: The date with timezone at which the Swap was confirmed by the Customer.
  nullable: true
  type: string
  format: date-time
canceled_at:
  description: The date with timezone at which the Swap was canceled.
  nullable: true
  type: string
  format: date-time
no_notification:
  description: If set to true, no notification will be sent related to this swap
  nullable: true
  type: boolean
  example: false
allow_backorder:
  description: If true, swaps can be completed with items out of stock
  type: boolean
  default: false
idempotency_key:
  description: Randomly generated key used to continue the completion of the swap in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type SwapFulfillmentStatus

type SwapFulfillmentStatus string
const (
	SwapFulfillmentNotFulfilled     SwapFulfillmentStatus = "not_fulfilled"
	SwapFulfillmentFulfilled        SwapFulfillmentStatus = "fulfilled"
	SwapFulfillmentShipped          SwapFulfillmentStatus = "shipped"
	SwapFulfillmentPartiallyShipped SwapFulfillmentStatus = "partially_shipped"
	SwapFulfillmentCanceled         SwapFulfillmentStatus = "canceled"
	SwapFulfillmentRequiresAction   SwapFulfillmentStatus = "requires_action"
)

func (*SwapFulfillmentStatus) Scan

func (pl *SwapFulfillmentStatus) Scan(value interface{}) error

func (SwapFulfillmentStatus) Value

func (pl SwapFulfillmentStatus) Value() (driver.Value, error)

type SwapPaymentStatus

type SwapPaymentStatus string
const (
	SwapPaymentNotPaid            SwapPaymentStatus = "not_paid"
	SwapPaymentAwaiting           SwapPaymentStatus = "awaiting"
	SwapPaymentCaptured           SwapPaymentStatus = "captured"
	SwapPaymentConfirmed          SwapPaymentStatus = "confirmed"
	SwapPaymentCanceled           SwapPaymentStatus = "canceled"
	SwapPaymentDifferenceRefunded SwapPaymentStatus = "difference_refunded"
	SwapPaymentPartiallyRefunded  SwapPaymentStatus = "partially_refunded"
	SwapPaymentRefunded           SwapPaymentStatus = "refunded"
	SwapPaymentRequiresAction     SwapPaymentStatus = "requires_action"
)

func (*SwapPaymentStatus) Scan

func (pl *SwapPaymentStatus) Scan(value interface{}) error

func (SwapPaymentStatus) Value

func (pl SwapPaymentStatus) Value() (driver.Value, error)

type TaxLine

type TaxLine struct {
	core.BaseModel

	Code string  `json:"code" gorm:"column:code"`
	Name string  `json:"name" gorm:"column:name"`
	Rate float64 `json:"rate" gorm:"column:rate"`
}

@oas:schema:TaxLine title: "Tax Line" description: "A tax line represents the taxes amount applied to a line item." type: object required:

  • code
  • created_at
  • id
  • metadata
  • name
  • rate
  • updated_at

properties:

id:
  description: The tax line's ID
  type: string
  example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8
code:
  description: A code to identify the tax type by
  nullable: true
  type: string
  example: tax01
name:
  description: A human friendly name for the tax
  type: string
  example: Tax Example
rate:
  description: The numeric rate to charge tax by
  type: number
  example: 10
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type TaxProvider

type TaxProvider struct {
	core.SoftDeletableModel

	IsInstalled bool `json:"is_installed" gorm:"column:is_installed;default:true"`
}

@oas:schema:TaxProvider title: "Tax Provider" description: "A tax provider represents a tax service installed in the Medusa backend, either through a plugin or backend customizations.

It holds the tax service's installation status."

type: object required:

  • id
  • is_installed

properties:

id:
  description: The ID of the tax provider as given by the tax service.
  type: string
  example: manual
is_installed:
  description: Whether the tax service is installed in the current version. If a tax service is no longer installed, the `is_installed` attribute is set to `false`.
  type: boolean
  default: true

type TaxRate

type TaxRate struct {
	core.BaseModel

	Rate                float64          `json:"rate" gorm:"column:rate"`
	Code                string           `json:"code" gorm:"column:code"`
	Name                string           `json:"name" gorm:"column:name"`
	RegionId            uuid.NullUUID    `json:"region_id" gorm:"column:region_id"`
	Region              *Region          `json:"region" gorm:"foreignKey:RegionId"`
	Products            []Product        `json:"products" gorm:"many2many:product_tax_rate"`
	ProductTypes        []ProductType    `json:"product_types" gorm:"many2many:product_type_tax_rate"`
	ShippingOptions     []ShippingOption `json:"shipping_options" gorm:"many2many:shipping_tax_rate"`
	ProductCount        int32            `json:"product_count" gorm:"column:product_count"`
	ProductTypeCount    int32            `json:"product_type_count" gorm:"column:product_type_count"`
	ShippingOptionCount int32            `json:"shipping_option_count" gorm:"column:shipping_option_count"`
}

@oas:schema:TaxRate title: "Tax Rate" description: "A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region." type: object required:

  • code
  • created_at
  • id
  • metadata
  • name
  • rate
  • region_id
  • updated_at

properties:

id:
  description: The tax rate's ID
  type: string
  example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
rate:
  description: The numeric rate to charge
  nullable: true
  type: number
  example: 10
code:
  description: A code to identify the tax type by
  nullable: true
  type: string
  example: tax01
name:
  description: A human friendly name for the tax
  type: string
  example: Tax Example
region_id:
  description: The ID of the region that the rate belongs to.
  type: string
  example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
  description: The details of the region that the rate belongs to.
  x-expandable: "region"
  nullable: true
  $ref: "#/components/schemas/Region"
products:
  description: The details of the products that belong to this tax rate.
  type: array
  x-expandable: "products"
  items:
    $ref: "#/components/schemas/Product"
product_types:
  description: The details of the product types that belong to this tax rate.
  type: array
  x-expandable: "product_types"
  items:
    $ref: "#/components/schemas/ProductType"
shipping_options:
  description: The details of the shipping options that belong to this tax rate.
  type: array
  x-expandable: "shipping_options"
  items:
    $ref: "#/components/schemas/ShippingOption"
product_count:
  description: The count of products
  type: integer
  example: 10
product_type_count:
  description: The count of product types
  type: integer
  example: 2
shipping_option_count:
  description: The count of shipping options
  type: integer
  example: 1
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
type TrackingLink struct {
	core.SoftDeletableModel

	Url            string        `json:"url" gorm:"column:url"`
	TrackingNumber string        `json:"tracking_number" gorm:"column:tracking_number"`
	FulfillmentId  uuid.NullUUID `json:"fulfillment_id" gorm:"column:fulfillment_id"`
	Fulfillment    *Fulfillment  `json:"fulfillment" gorm:"foreignKey:FulfillmentId"`
	IdempotencyKey string        `json:"idempotency_key" gorm:"column:idempotency_key"`
}

@oas:schema:TrackingLink title: "Tracking Link" description: "A tracking link holds information about tracking numbers for a Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment. Typically, the tracking link is provided from the third-party service integrated through the used fulfillment provider." type: object required:

  • created_at
  • deleted_at
  • fulfillment_id
  • id
  • idempotency_key
  • metadata
  • tracking_number
  • updated_at
  • url

properties:

id:
  description: The tracking link's ID
  type: string
  example: tlink_01G8ZH853Y6TFXWPG5EYE81X63
url:
  description: The URL at which the status of the shipment can be tracked.
  nullable: true
  type: string
  format: uri
tracking_number:
  description: The tracking number given by the shipping carrier.
  type: string
  format: RH370168054CN
fulfillment_id:
  description: The ID of the fulfillment that the tracking link belongs to.
  type: string
  example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
fulfillment:
  description: The details of the fulfillment that the tracking link belongs to.
  x-expandable: "fulfillment"
  nullable: true
  $ref: "#/components/schemas/Fulfillment"
idempotency_key:
  description: Randomly generated key used to continue the completion of a process in case of failure.
  nullable: true
  type: string
  externalDocs:
    url: https://docs.medusajs.com/development/idempotency-key/overview.md
    description: Learn more how to use the idempotency key.
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type User

type User struct {
	core.SoftDeletableModel

	Role         UserRole `json:"role" gorm:"column:role;default:'member'"`
	Email        string   `json:"email" gorm:"column:email"`
	FirstName    string   `json:"first_name" gorm:"column:first_name"`
	LastName     string   `json:"last_name" gorm:"column:last_name"`
	PasswordHash string   `json:"password_hash" gorm:"column:password_hash"`
	ApiToken     string   `json:"api_token" gorm:"column:api_token"`
}

@oas:schema:User title: "User" description: "A User is an administrator who can manage store settings and data." type: object required:

  • api_token
  • created_at
  • deleted_at
  • email
  • first_name
  • id
  • last_name
  • metadata
  • role
  • updated_at

properties:

id:
  description: The user's ID
  type: string
  example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
role:
  description: The user's role. These roles don't provide any different privileges.
  type: string
  enum:
    - admin
    - member
    - developer
  default: member
email:
  description: The email of the User
  type: string
  format: email
first_name:
  description: The first name of the User
  nullable: true
  type: string
  example: Levi
last_name:
  description: The last name of the User
  nullable: true
  type: string
  example: Bogan
api_token:
  description: An API token associated with the user.
  nullable: true
  type: string
  example: null
created_at:
  description: The date with timezone at which the resource was created.
  type: string
  format: date-time
updated_at:
  description: The date with timezone at which the resource was updated.
  type: string
  format: date-time
deleted_at:
  description: The date with timezone at which the resource was deleted.
  nullable: true
  type: string
  format: date-time
metadata:
  description: An optional key-value map with additional details
  nullable: true
  type: object
  example: {car: "white"}
  externalDocs:
    description: "Learn about the metadata attribute, and how to delete and update it."
    url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"

type UserRole

type UserRole string
const (
	UserRoleAdmin     UserRole = "admin"
	UserRoleMember    UserRole = "member"
	UserRoleDeveloper UserRole = "developer"
)

Defines values for UserRole.

func (*UserRole) Scan

func (sp *UserRole) Scan(value interface{}) error

func (UserRole) Value

func (sp UserRole) Value() (driver.Value, error)

Source Files

Jump to

Keyboard shortcuts

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