Skip to content

Commit

Permalink
add presentment_currency & inventory_behaviour to Order (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
markovic-nikola authored Jan 29, 2024
1 parent e220127 commit 48a5f98
Showing 1 changed file with 87 additions and 71 deletions.
158 changes: 87 additions & 71 deletions order.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,79 +174,95 @@ type OrderCancelOptions struct {
Refund *Refund `json:"refund,omitempty"`
}

// The behaviour to use when updating inventory.
type orderInventoryBehaviour string

const (
// Do not claim inventory.
OrderInventoryBehaviourBypass orderInventoryBehaviour = "bypass"

// Ignore the product's inventory policy and claim inventory.
OrderInventoryBehaviourDecrementIgnoringPolicy orderInventoryBehaviour = "decrement_ignoring_policy"

// Follow the product's inventory policy and claim inventory, if possible.
OrderInventoryBehaviourDecrementObeyingPolicy orderInventoryBehaviour = "decrement_obeying_policy"
)

// Order represents a Shopify order
type Order struct {
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
ProcessedAt *time.Time `json:"processed_at,omitempty"`
Customer *Customer `json:"customer,omitempty"`
BillingAddress *Address `json:"billing_address,omitempty"`
ShippingAddress *Address `json:"shipping_address,omitempty"`
Currency string `json:"currency,omitempty"`
TotalPrice *decimal.Decimal `json:"total_price,omitempty"`
TotalPriceSet *AmountSet `json:"total_price_set,omitempty"`
TotalShippingPriceSet *AmountSet `json:"total_shipping_price_set,omitempty"`
CurrentTotalPrice *decimal.Decimal `json:"current_total_price,omitempty"`
SubtotalPrice *decimal.Decimal `json:"subtotal_price,omitempty"`
CurrentSubtotalPrice *decimal.Decimal `json:"current_subtotal_price,omitempty"`
TotalDiscounts *decimal.Decimal `json:"total_discounts,omitempty"`
CurrentTotalDiscounts *decimal.Decimal `json:"current_total_discounts,omitempty"`
TotalLineItemsPrice *decimal.Decimal `json:"total_line_items_price,omitempty"`
TaxesIncluded bool `json:"taxes_included,omitempty"`
TotalTax *decimal.Decimal `json:"total_tax,omitempty"`
TotalTaxSet *AmountSet `json:"total_tax_set,omitempty"`
CurrentTotalTax *decimal.Decimal `json:"current_total_tax,omitempty"`
TaxLines []TaxLine `json:"tax_lines,omitempty"`
TotalWeight int `json:"total_weight,omitempty"`
FinancialStatus orderFinancialStatus `json:"financial_status,omitempty"`
Fulfillments []Fulfillment `json:"fulfillments,omitempty"`
FulfillmentStatus orderFulfillmentStatus `json:"fulfillment_status,omitempty"`
Token string `json:"token,omitempty"`
CartToken string `json:"cart_token,omitempty"`
Number int `json:"number,omitempty"`
OrderNumber int `json:"order_number,omitempty"`
Note string `json:"note,omitempty"`
Test bool `json:"test,omitempty"`
BrowserIp string `json:"browser_ip,omitempty"`
BuyerAcceptsMarketing bool `json:"buyer_accepts_marketing,omitempty"`
CancelReason orderCancelReason `json:"cancel_reason,omitempty"`
NoteAttributes []NoteAttribute `json:"note_attributes,omitempty"`
DiscountCodes []DiscountCode `json:"discount_codes,omitempty"`
LineItems []LineItem `json:"line_items,omitempty"`
ShippingLines []ShippingLines `json:"shipping_lines,omitempty"`
Transactions []Transaction `json:"transactions,omitempty"`
AppID int `json:"app_id,omitempty"`
CustomerLocale string `json:"customer_locale,omitempty"`
LandingSite string `json:"landing_site,omitempty"`
ReferringSite string `json:"referring_site,omitempty"`
SourceName string `json:"source_name,omitempty"`
ClientDetails *ClientDetails `json:"client_details,omitempty"`
Tags string `json:"tags,omitempty"`
LocationId int64 `json:"location_id,omitempty"`
PaymentGatewayNames []string `json:"payment_gateway_names,omitempty"`
ProcessingMethod string `json:"processing_method,omitempty"`
Refunds []Refund `json:"refunds,omitempty"`
UserId int64 `json:"user_id,omitempty"`
OrderStatusUrl string `json:"order_status_url,omitempty"`
Gateway string `json:"gateway,omitempty"`
Confirmed bool `json:"confirmed,omitempty"`
CheckoutToken string `json:"checkout_token,omitempty"`
Reference string `json:"reference,omitempty"`
SourceIdentifier string `json:"source_identifier,omitempty"`
SourceURL string `json:"source_url,omitempty"`
DeviceID int64 `json:"device_id,omitempty"`
Phone string `json:"phone,omitempty"`
LandingSiteRef string `json:"landing_site_ref,omitempty"`
CheckoutID int64 `json:"checkout_id,omitempty"`
ContactEmail string `json:"contact_email,omitempty"`
Metafields []Metafield `json:"metafields,omitempty"`
SendReceipt bool `json:"send_receipt,omitempty"`
SendFulfillmentReceipt bool `json:"send_fulfillment_receipt,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
ProcessedAt *time.Time `json:"processed_at,omitempty"`
Customer *Customer `json:"customer,omitempty"`
BillingAddress *Address `json:"billing_address,omitempty"`
ShippingAddress *Address `json:"shipping_address,omitempty"`
Currency string `json:"currency,omitempty"`
TotalPrice *decimal.Decimal `json:"total_price,omitempty"`
TotalPriceSet *AmountSet `json:"total_price_set,omitempty"`
TotalShippingPriceSet *AmountSet `json:"total_shipping_price_set,omitempty"`
CurrentTotalPrice *decimal.Decimal `json:"current_total_price,omitempty"`
SubtotalPrice *decimal.Decimal `json:"subtotal_price,omitempty"`
CurrentSubtotalPrice *decimal.Decimal `json:"current_subtotal_price,omitempty"`
TotalDiscounts *decimal.Decimal `json:"total_discounts,omitempty"`
CurrentTotalDiscounts *decimal.Decimal `json:"current_total_discounts,omitempty"`
TotalLineItemsPrice *decimal.Decimal `json:"total_line_items_price,omitempty"`
TaxesIncluded bool `json:"taxes_included,omitempty"`
TotalTax *decimal.Decimal `json:"total_tax,omitempty"`
TotalTaxSet *AmountSet `json:"total_tax_set,omitempty"`
CurrentTotalTax *decimal.Decimal `json:"current_total_tax,omitempty"`
TaxLines []TaxLine `json:"tax_lines,omitempty"`
TotalWeight int `json:"total_weight,omitempty"`
FinancialStatus orderFinancialStatus `json:"financial_status,omitempty"`
Fulfillments []Fulfillment `json:"fulfillments,omitempty"`
FulfillmentStatus orderFulfillmentStatus `json:"fulfillment_status,omitempty"`
Token string `json:"token,omitempty"`
CartToken string `json:"cart_token,omitempty"`
Number int `json:"number,omitempty"`
OrderNumber int `json:"order_number,omitempty"`
Note string `json:"note,omitempty"`
Test bool `json:"test,omitempty"`
BrowserIp string `json:"browser_ip,omitempty"`
BuyerAcceptsMarketing bool `json:"buyer_accepts_marketing,omitempty"`
CancelReason orderCancelReason `json:"cancel_reason,omitempty"`
NoteAttributes []NoteAttribute `json:"note_attributes,omitempty"`
DiscountCodes []DiscountCode `json:"discount_codes,omitempty"`
LineItems []LineItem `json:"line_items,omitempty"`
ShippingLines []ShippingLines `json:"shipping_lines,omitempty"`
Transactions []Transaction `json:"transactions,omitempty"`
AppID int `json:"app_id,omitempty"`
CustomerLocale string `json:"customer_locale,omitempty"`
LandingSite string `json:"landing_site,omitempty"`
ReferringSite string `json:"referring_site,omitempty"`
SourceName string `json:"source_name,omitempty"`
ClientDetails *ClientDetails `json:"client_details,omitempty"`
Tags string `json:"tags,omitempty"`
LocationId int64 `json:"location_id,omitempty"`
PaymentGatewayNames []string `json:"payment_gateway_names,omitempty"`
ProcessingMethod string `json:"processing_method,omitempty"`
Refunds []Refund `json:"refunds,omitempty"`
UserId int64 `json:"user_id,omitempty"`
OrderStatusUrl string `json:"order_status_url,omitempty"`
Gateway string `json:"gateway,omitempty"`
Confirmed bool `json:"confirmed,omitempty"`
CheckoutToken string `json:"checkout_token,omitempty"`
Reference string `json:"reference,omitempty"`
SourceIdentifier string `json:"source_identifier,omitempty"`
SourceURL string `json:"source_url,omitempty"`
DeviceID int64 `json:"device_id,omitempty"`
Phone string `json:"phone,omitempty"`
LandingSiteRef string `json:"landing_site_ref,omitempty"`
CheckoutID int64 `json:"checkout_id,omitempty"`
ContactEmail string `json:"contact_email,omitempty"`
Metafields []Metafield `json:"metafields,omitempty"`
SendReceipt bool `json:"send_receipt,omitempty"`
SendFulfillmentReceipt bool `json:"send_fulfillment_receipt,omitempty"`
PresentmentCurrency string `json:"presentment_currency,omitempty"`
InventoryBehaviour orderInventoryBehaviour `json:"inventory_behaviour,omitempty"`
}

type Address struct {
Expand Down

0 comments on commit 48a5f98

Please sign in to comment.