Skip to content

Instantly share code, notes, and snippets.

@man-person
Created April 25, 2022 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save man-person/713e4356c3b390de118ea55cabda9118 to your computer and use it in GitHub Desktop.
Save man-person/713e4356c3b390de118ea55cabda9118 to your computer and use it in GitHub Desktop.
shopify order typing
enum OrderStatusEnum {
OPEN = 'open',
CLOSED = 'closed',
ANY = 'any'
}
enum OrderCancelReason {
CUSTOMER = 'customer',
FRAUD = 'fraud',
INVENTORY = 'inventory',
DECLINED = 'declined',
OTHER = 'other'
}
enum FinancialStatusEnum {
AUTHORIZED = 'authorized', // Show only authorized orders
PENDING = 'pending', // Show only pending orders
PAID = 'paid', // Show only paid orders
PARTIALLY_PAID = 'partially_paid', // Show only partially paid orders
REFUNDED = 'refunded', // Show only refunded orders
VOIDED = 'voided', // Show only voided orders
PARTIALLY_REFUNDED = 'partially_refunded', // Show only partially refunded orders
ANY = 'any', // Show orders of any financial status.
UNPAID = 'unpaid', // Show authorized and partially paid orders.
}
enum FulfillmentStatusEnum {
SHIPPED = 'shipped', // Show orders that have been shipped. Returns orders with fulfillment_status of fulfilled.
PARTIAL = 'partial', // Show partially shipped orders.
UNSHIPPED = 'unshipped', // Show orders that have not yet been shipped. Returns orders with fulfillment_status of null.
ANY = 'any', // Show orders of any fulfillment status.
UNFULFILLED = 'unfulfilled', // Returns orders with fulfillment_status of null or partial
}
interface IOrderClientDetails {
accept_language: string //The languages and locales that the browser understands.
browser_height: number
browser_ip: string
browser_width: number
session_hash: string
user_agent: string //"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
}
interface IOrderPriceSet {
shop_money: {
amount: string // float as string
currency_code: string
},
presentment_money: {
amount: string // float as string
currency_code: string
}
}
interface IDiscountCode {
code: string
amount: string //float as string
type: string
}
interface INoteAttributes {
name: string
value: string
}
interface ITaxLines {
price: string // float as string
rate: number
title: string
price_set: IOrderPriceSet
channel_liable: boolean
}
interface IAddress {
first_name: string
address1: string
phone: string
city: string
zip: string
province: any
country: string
last_name: string
address2: string
company: string
latitude: number | string
longitude: number | string
name: string
country_code: string
province_code: any
}
interface IDiscountApplication {
target_type: string
type: string
value: string
value_type: string
allocation_method: string
target_selection: string
code: string
}
interface ILineItem {
id: number
admin_graphql_api_id: string
fulfillable_quantity: number
fulfillment_service: string
fulfillment_status: string
gift_card: false,
grams: number
name: string
origin_location: Partial<IAddress>
price: string // float as string
price_set: IOrderPriceSet
product_exists: boolean
product_id: number
properties: any[]
quantity: number
requires_shipping: boolean
sku: string
taxable: boolean
title: string
total_discount: string // float as string
total_discount_set: IOrderPriceSet
variant_id: number
variant_inventory_management: any
variant_title: string
vendor: string
tax_lines: ITaxLines[]
duties: any[]
discount_allocations: any[]
}
export interface IPaymentDetails {
credit_card_bin: string
avs_result_code: string
cvv_result_code: string
credit_card_number: string
credit_card_company: string
}
interface IPaymentSchedule {
amount: number
currency: string
issued_at: ShopifyDate
due_at: ShopifyDate
completed_at: string
expected_payment_method: string
}
interface IPaymentTerms {
amount: number
currency: string
payment_terms_name: string
payment_terms_type: string
due_in_days: number
payment_schedules: IPaymentSchedule[]
}
interface IDiscountAllocations {
amount: string // float as string
amount_set: IOrderPriceSet
discount_application_index: number
}
interface IShippingLine {
id: number
carrier_identifier: string
code: string
delivery_category: string
discounted_price: string // float as string
discounted_price_set: IOrderPriceSet
phone: string
price: string // float as string
price_set: IOrderPriceSet
requested_fulfillment_service_id: string
source: string
title: string
tax_lines: ITaxLines[],
discount_allocations: IDiscountAllocations[]
}
interface IOrder {
id: number
admin_graphql_api_id: string // "gid://shopify/Order/4471427498031"
app_id: number
browser_ip: string
buyer_accepts_marketing: boolean
cancel_reason: OrderCancelReason
cancelled_at: ShopifyDate
cart_token: string
checkout_id: number
checkout_token: string
client_details: IOrderClientDetails
closed_at: ShopifyDate
confirmed: boolean
contact_email: string
created_at: ShopifyDate
currency: string
current_subtotal_price: string // float as string
current_subtotal_price_set: IOrderPriceSet
current_total_discounts: string //float as string
current_total_discounts_set: IOrderPriceSet
current_total_duties_set: IOrderPriceSet
current_total_price: string //float as string
current_total_price_set: IOrderPriceSet
current_total_tax: string //float as string
current_total_tax_set: IOrderPriceSet
customer_locale: string
device_id: string | number
discount_codes: IDiscountCode[]
email: string
estimated_taxes: boolean
financial_status: FinancialStatusEnum
fulfillment_status: FulfillmentStatusEnum
gateway: string
landing_site: string
landing_site_ref: string
location_id: number
name: string
note: string
note_attributes: INoteAttributes[]
number: number
order_number: number
order_status_url: string
original_total_duties_set: IOrderPriceSet
payment_gateway_names: string[]
phone: string
presentment_currency: string
processed_at: ShopifyDate
processing_method: string
reference: string
referring_site: string
source_identifier: string
source_name: string
source_url: string
subtotal_price: string //float as string
subtotal_price_set: IOrderPriceSet
tags: string
tax_lines: ITaxLines[]
taxes_included: boolean
test: boolean
token: string
total_discounts: string // float as number
total_discounts_set: IOrderPriceSet
total_line_items_price: string // float as number
total_line_items_price_set: IOrderPriceSet
total_outstanding: string // float as number
total_price: string // float as number
total_price_set: IOrderPriceSet
total_price_usd: string // float as number
total_shipping_price_set: IOrderPriceSet
total_tax: string // float as number
total_tax_set: IOrderPriceSet
total_tip_received: string // float as number
total_weight: number
updated_at: ShopifyDate
user_id: number
billing_address: IAddress
customer: ICustomer
discount_applications: IDiscountApplication[]
line_items: ILineItem[]
payment_details: IPaymentDetails
payment_terms: IPaymentTerms
refunds: []
shipping_address: IAddress
shipping_lines: IShippingLine[]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment