Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add refund, capture and fulfill callbacks

dominik-zeglen6758beb5b654
diff --git a/saleor/static/dashboard-next/gql-types.ts b/saleor/static/dashboard-next/gql-types.ts
new file mode 100644
index 0000000000..41a1dd6129
--- /dev/null
+++ b/saleor/static/dashboard-next/gql-types.ts
@@ -0,0 +1,4031 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+export interface FulfillmentCreateInput {
+ // ID of the order to be fulfilled.
+ order?: string | null,
+ // Fulfillment tracking number
+ trackingNumber?: string | null,
+ // If true, send an email notification to the customer.
+ notifyCustomer?: boolean | null,
+ // Item line to be fulfilled.
+ lines?: Array< FulfillmentLineInput | null > | null,
+};
+
+export interface FulfillmentLineInput {
+ // The ID of the order line.
+ orderLineId?: string | null,
+ // The number of line item(s) to be fulfiled.
+ quantity?: number | null,
+};
+
+// An enumeration.
+export enum OrderStatus {
+ CANCELED = "CANCELED", // Canceled
+ DRAFT = "DRAFT", // Draft
+ FULFILLED = "FULFILLED", // Fulfilled
+ PARTIALLY_FULFILLED = "PARTIALLY_FULFILLED", // Partially fulfilled
+ UNFULFILLED = "UNFULFILLED", // Unfulfilled
+}
+
+
+// An enumeration.
+export enum AddressCountry {
+ AD = "AD", // Andorra
+ AE = "AE", // United Arab Emirates
+ AF = "AF", // Afghanistan
+ AG = "AG", // Antigua and Barbuda
+ AI = "AI", // Anguilla
+ AL = "AL", // Albania
+ AM = "AM", // Armenia
+ AO = "AO", // Angola
+ AQ = "AQ", // Antarctica
+ AR = "AR", // Argentina
+ AS = "AS", // American Samoa
+ AT = "AT", // Austria
+ AU = "AU", // Australia
+ AW = "AW", // Aruba
+ AX = "AX", // Åland Islands
+ AZ = "AZ", // Azerbaijan
+ BA = "BA", // Bosnia and Herzegovina
+ BB = "BB", // Barbados
+ BD = "BD", // Bangladesh
+ BE = "BE", // Belgium
+ BF = "BF", // Burkina Faso
+ BG = "BG", // Bulgaria
+ BH = "BH", // Bahrain
+ BI = "BI", // Burundi
+ BJ = "BJ", // Benin
+ BL = "BL", // Saint Barthélemy
+ BM = "BM", // Bermuda
+ BN = "BN", // Brunei
+ BO = "BO", // Bolivia
+ BQ = "BQ", // Bonaire, Sint Eustatius and Saba
+ BR = "BR", // Brazil
+ BS = "BS", // Bahamas
+ BT = "BT", // Bhutan
+ BV = "BV", // Bouvet Island
+ BW = "BW", // Botswana
+ BY = "BY", // Belarus
+ BZ = "BZ", // Belize
+ CA = "CA", // Canada
+ CC = "CC", // Cocos (Keeling) Islands
+ CD = "CD", // Congo (the Democratic Republic of the)
+ CF = "CF", // Central African Republic
+ CG = "CG", // Congo
+ CH = "CH", // Switzerland
+ CI = "CI", // Côte d'Ivoire
+ CK = "CK", // Cook Islands
+ CL = "CL", // Chile
+ CM = "CM", // Cameroon
+ CN = "CN", // China
+ CO = "CO", // Colombia
+ CR = "CR", // Costa Rica
+ CU = "CU", // Cuba
+ CV = "CV", // Cabo Verde
+ CW = "CW", // Curaçao
+ CX = "CX", // Christmas Island
+ CY = "CY", // Cyprus
+ CZ = "CZ", // Czechia
+ DE = "DE", // Germany
+ DJ = "DJ", // Djibouti
+ DK = "DK", // Denmark
+ DM = "DM", // Dominica
+ DO = "DO", // Dominican Republic
+ DZ = "DZ", // Algeria
+ EC = "EC", // Ecuador
+ EE = "EE", // Estonia
+ EG = "EG", // Egypt
+ EH = "EH", // Western Sahara
+ ER = "ER", // Eritrea
+ ES = "ES", // Spain
+ ET = "ET", // Ethiopia
+ EU = "EU", // European Union
+ FI = "FI", // Finland
+ FJ = "FJ", // Fiji
+ FK = "FK", // Falkland Islands [Malvinas]
+ FM = "FM", // Micronesia (Federated States of)
+ FO = "FO", // Faroe Islands
+ FR = "FR", // France
+ GA = "GA", // Gabon
+ GB = "GB", // United Kingdom
+ GD = "GD", // Grenada
+ GE = "GE", // Georgia
+ GF = "GF", // French Guiana
+ GG = "GG", // Guernsey
+ GH = "GH", // Ghana
+ GI = "GI", // Gibraltar
+ GL = "GL", // Greenland
+ GM = "GM", // Gambia
+ GN = "GN", // Guinea
+ GP = "GP", // Guadeloupe
+ GQ = "GQ", // Equatorial Guinea
+ GR = "GR", // Greece
+ GS = "GS", // South Georgia and the South Sandwich Islands
+ GT = "GT", // Guatemala
+ GU = "GU", // Guam
+ GW = "GW", // Guinea-Bissau
+ GY = "GY", // Guyana
+ HK = "HK", // Hong Kong
+ HM = "HM", // Heard Island and McDonald Islands
+ HN = "HN", // Honduras
+ HR = "HR", // Croatia
+ HT = "HT", // Haiti
+ HU = "HU", // Hungary
+ ID = "ID", // Indonesia
+ IE = "IE", // Ireland
+ IL = "IL", // Israel
+ IM = "IM", // Isle of Man
+ IN = "IN", // India
+ IO = "IO", // British Indian Ocean Territory
+ IQ = "IQ", // Iraq
+ IR = "IR", // Iran
+ IS = "IS", // Iceland
+ IT = "IT", // Italy
+ JE = "JE", // Jersey
+ JM = "JM", // Jamaica
+ JO = "JO", // Jordan
+ JP = "JP", // Japan
+ KE = "KE", // Kenya
+ KG = "KG", // Kyrgyzstan
+ KH = "KH", // Cambodia
+ KI = "KI", // Kiribati
+ KM = "KM", // Comoros
+ KN = "KN", // Saint Kitts and Nevis
+ KP = "KP", // North Korea
+ KR = "KR", // South Korea
+ KW = "KW", // Kuwait
+ KY = "KY", // Cayman Islands
+ KZ = "KZ", // Kazakhstan
+ LA = "LA", // Laos
+ LB = "LB", // Lebanon
+ LC = "LC", // Saint Lucia
+ LI = "LI", // Liechtenstein
+ LK = "LK", // Sri Lanka
+ LR = "LR", // Liberia
+ LS = "LS", // Lesotho
+ LT = "LT", // Lithuania
+ LU = "LU", // Luxembourg
+ LV = "LV", // Latvia
+ LY = "LY", // Libya
+ MA = "MA", // Morocco
+ MC = "MC", // Monaco
+ MD = "MD", // Moldova
+ ME = "ME", // Montenegro
+ MF = "MF", // Saint Martin (French part)
+ MG = "MG", // Madagascar
+ MH = "MH", // Marshall Islands
+ MK = "MK", // Macedonia
+ ML = "ML", // Mali
+ MM = "MM", // Myanmar
+ MN = "MN", // Mongolia
+ MO = "MO", // Macao
+ MP = "MP", // Northern Mariana Islands
+ MQ = "MQ", // Martinique
+ MR = "MR", // Mauritania
+ MS = "MS", // Montserrat
+ MT = "MT", // Malta
+ MU = "MU", // Mauritius
+ MV = "MV", // Maldives
+ MW = "MW", // Malawi
+ MX = "MX", // Mexico
+ MY = "MY", // Malaysia
+ MZ = "MZ", // Mozambique
+ NA = "NA", // Namibia
+ NC = "NC", // New Caledonia
+ NE = "NE", // Niger
+ NF = "NF", // Norfolk Island
+ NG = "NG", // Nigeria
+ NI = "NI", // Nicaragua
+ NL = "NL", // Netherlands
+ NO = "NO", // Norway
+ NP = "NP", // Nepal
+ NR = "NR", // Nauru
+ NU = "NU", // Niue
+ NZ = "NZ", // New Zealand
+ OM = "OM", // Oman
+ PA = "PA", // Panama
+ PE = "PE", // Peru
+ PF = "PF", // French Polynesia
+ PG = "PG", // Papua New Guinea
+ PH = "PH", // Philippines
+ PK = "PK", // Pakistan
+ PL = "PL", // Poland
+ PM = "PM", // Saint Pierre and Miquelon
+ PN = "PN", // Pitcairn
+ PR = "PR", // Puerto Rico
+ PS = "PS", // Palestine, State of
+ PT = "PT", // Portugal
+ PW = "PW", // Palau
+ PY = "PY", // Paraguay
+ QA = "QA", // Qatar
+ RE = "RE", // Réunion
+ RO = "RO", // Romania
+ RS = "RS", // Serbia
+ RU = "RU", // Russia
+ RW = "RW", // Rwanda
+ SA = "SA", // Saudi Arabia
+ SB = "SB", // Solomon Islands
+ SC = "SC", // Seychelles
+ SD = "SD", // Sudan
+ SE = "SE", // Sweden
+ SG = "SG", // Singapore
+ SH = "SH", // Saint Helena, Ascension and Tristan da Cunha
+ SI = "SI", // Slovenia
+ SJ = "SJ", // Svalbard and Jan Mayen
+ SK = "SK", // Slovakia
+ SL = "SL", // Sierra Leone
+ SM = "SM", // San Marino
+ SN = "SN", // Senegal
+ SO = "SO", // Somalia
+ SR = "SR", // Suriname
+ SS = "SS", // South Sudan
+ ST = "ST", // Sao Tome and Principe
+ SV = "SV", // El Salvador
+ SX = "SX", // Sint Maarten (Dutch part)
+ SY = "SY", // Syria
+ SZ = "SZ", // Swaziland
+ TC = "TC", // Turks and Caicos Islands
+ TD = "TD", // Chad
+ TF = "TF", // French Southern Territories
+ TG = "TG", // Togo
+ TH = "TH", // Thailand
+ TJ = "TJ", // Tajikistan
+ TK = "TK", // Tokelau
+ TL = "TL", // Timor-Leste
+ TM = "TM", // Turkmenistan
+ TN = "TN", // Tunisia
+ TO = "TO", // Tonga
+ TR = "TR", // Turkey
+ TT = "TT", // Trinidad and Tobago
+ TV = "TV", // Tuvalu
+ TW = "TW", // Taiwan
+ TZ = "TZ", // Tanzania
+ UA = "UA", // Ukraine
+ UG = "UG", // Uganda
+ UM = "UM", // United States Minor Outlying Islands
+ US = "US", // United States of America
+ UY = "UY", // Uruguay
+ UZ = "UZ", // Uzbekistan
+ VA = "VA", // Holy See
+ VC = "VC", // Saint Vincent and the Grenadines
+ VE = "VE", // Venezuela
+ VG = "VG", // Virgin Islands (British)
+ VI = "VI", // Virgin Islands (U.S.)
+ VN = "VN", // Vietnam
+ VU = "VU", // Vanuatu
+ WF = "WF", // Wallis and Futuna
+ WS = "WS", // Samoa
+ YE = "YE", // Yemen
+ YT = "YT", // Mayotte
+ ZA = "ZA", // South Africa
+ ZM = "ZM", // Zambia
+ ZW = "ZW", // Zimbabwe
+}
+
+
+// An enumeration.
+export enum OrderEvents {
+ CANCELED = "CANCELED",
+ EMAIL_SENT = "EMAIL_SENT",
+ FULFILLMENT_CANCELED = "FULFILLMENT_CANCELED",
+ FULFILLMENT_FULFILLED_ITEMS = "FULFILLMENT_FULFILLED_ITEMS",
+ FULFILLMENT_RESTOCKED_ITEMS = "FULFILLMENT_RESTOCKED_ITEMS",
+ NOTE_ADDED = "NOTE_ADDED",
+ ORDER_FULLY_PAID = "ORDER_FULLY_PAID",
+ ORDER_MARKED_AS_PAID = "ORDER_MARKED_AS_PAID",
+ OTHER = "OTHER",
+ PAYMENT_CAPTURED = "PAYMENT_CAPTURED",
+ PAYMENT_REFUNDED = "PAYMENT_REFUNDED",
+ PAYMENT_RELEASED = "PAYMENT_RELEASED",
+ PLACED = "PLACED",
+ PLACED_FROM_DRAFT = "PLACED_FROM_DRAFT",
+ UPDATED = "UPDATED",
+}
+
+
+// An enumeration.
+export enum FulfillmentStatus {
+ CANCELED = "CANCELED", // Canceled
+ FULFILLED = "FULFILLED", // Fulfilled
+}
+
+
+export interface AttributeValueInput {
+ // Slug of an attribute.
+ slug: string,
+ // Value of an attribute.
+ value: string,
+};
+
+export interface TokenAuthMutationVariables {
+ email: string,
+ password: string,
+};
+
+export interface TokenAuthMutation {
+ tokenCreate: {
+ token: string | null,
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ isStaff: boolean,
+ note: string | null,
+ permissions: Array< {
+ // Internal code for permission.
+ code: string,
+ // Describe action(s) allowed to do by permission.
+ name: string,
+ } | null > | null,
+ } | null,
+ } | null,
+};
+
+export interface VerifyTokenMutationVariables {
+ token: string,
+};
+
+export interface VerifyTokenMutation {
+ tokenVerify: {
+ payload: string | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ isStaff: boolean,
+ note: string | null,
+ permissions: Array< {
+ // Internal code for permission.
+ code: string,
+ // Describe action(s) allowed to do by permission.
+ name: string,
+ } | null > | null,
+ } | null,
+ } | null,
+};
+
+export interface CategoryDeleteMutationVariables {
+ id: string,
+};
+
+export interface CategoryDeleteMutation {
+ categoryDelete: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ } | null,
+};
+
+export interface CategoryCreateMutationVariables {
+ name?: string | null,
+ description?: string | null,
+ parent?: string | null,
+};
+
+export interface CategoryCreateMutation {
+ categoryCreate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ parent: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface CategoryUpdateMutationVariables {
+ id: string,
+ name?: string | null,
+ description?: string | null,
+};
+
+export interface CategoryUpdateMutation {
+ categoryUpdate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ parent: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface CategoryDetailsQueryVariables {
+ id: string,
+};
+
+export interface CategoryDetailsQuery {
+ // Lookup a category by ID.
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ parent: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ } | null,
+};
+
+export interface RootCategoryChildrenQuery {
+ // List of the shop's categories.
+ categories: {
+ edges: Array< {
+ // A cursor for use in pagination
+ cursor: string,
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ // List of children of the category.
+ children: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ } | null,
+ // List of products in the category.
+ products: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ } | null,
+ },
+ } >,
+ } | null,
+};
+
+export interface CategoryPropertiesQueryVariables {
+ id: string,
+ first?: number | null,
+ after?: string | null,
+ last?: number | null,
+ before?: string | null,
+};
+
+export interface CategoryPropertiesQuery {
+ // Lookup a category by ID.
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ parent: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ // List of children of the category.
+ children: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ // List of children of the category.
+ children: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ } | null,
+ // List of products in the category.
+ products: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ } | null,
+ },
+ } >,
+ } | null,
+ // List of products in the category.
+ products: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ pageInfo: {
+ // When paginating forwards, the cursor to continue.
+ endCursor: string | null,
+ // When paginating forwards, are there more items?
+ hasNextPage: boolean,
+ // When paginating backwards, are there more items?
+ hasPreviousPage: boolean,
+ // When paginating backwards, the cursor to continue.
+ startCursor: string | null,
+ },
+ edges: Array< {
+ // A cursor for use in pagination
+ cursor: string,
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ },
+ } >,
+ } | null,
+ } | null,
+};
+
+export interface OrderCancelMutationVariables {
+ id: string,
+};
+
+export interface OrderCancelMutation {
+ orderCancel: {
+ // Canceled order.
+ order: {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface OrderRefundMutationVariables {
+ id: string,
+ amount: string,
+};
+
+export interface OrderRefundMutation {
+ orderRefund: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ // A refunded order.
+ order: {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface OrderReleaseMutationVariables {
+ id: string,
+};
+
+export interface OrderReleaseMutation {
+ orderRelease: {
+ // A released order.
+ order: {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface OrderCaptureMutationVariables {
+ id: string,
+ amount: string,
+};
+
+export interface OrderCaptureMutation {
+ orderCapture: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ // Captured order.
+ order: {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface OrderCreateFulfillmentMutationVariables {
+ input: FulfillmentCreateInput,
+};
+
+export interface OrderCreateFulfillmentMutation {
+ fulfillmentCreate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ } | null,
+};
+
+export interface OrderListQueryVariables {
+ first?: number | null,
+ after?: string | null,
+ last?: number | null,
+ before?: string | null,
+};
+
+export interface OrderListQuery {
+ // List of the shop's orders.
+ orders: {
+ edges: Array< {
+ // A cursor for use in pagination
+ cursor: string,
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // User-friendly number of an order.
+ number: string | null,
+ created: string,
+ // Internal payment status.
+ paymentStatus: string | null,
+ status: OrderStatus,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ userEmail: string,
+ },
+ } >,
+ pageInfo: {
+ // When paginating backwards, are there more items?
+ hasPreviousPage: boolean,
+ // When paginating forwards, are there more items?
+ hasNextPage: boolean,
+ // When paginating backwards, the cursor to continue.
+ startCursor: string | null,
+ // When paginating forwards, the cursor to continue.
+ endCursor: string | null,
+ },
+ } | null,
+};
+
+export interface OrderDetailsQueryVariables {
+ id: string,
+};
+
+export interface OrderDetailsQuery {
+ // Lookup an order by ID.
+ order: {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+ } | null,
+};
+
+export interface OrderShippingMethodsQuery {
+ // List of the shop's shipping zones.
+ shippingZones: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ shippingMethods: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ } | null,
+ } | null >,
+ } | null,
+ },
+ } >,
+ } | null,
+};
+
+export interface PageDeleteMutationVariables {
+ id: string,
+};
+
+export interface PageDeleteMutation {
+ pageDelete: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ } | null,
+};
+
+export interface PageUpdateMutationVariables {
+ id: string,
+ title: string,
+ content: string,
+ slug: string,
+ isVisible: boolean,
+ availableOn?: string | null,
+};
+
+export interface PageUpdateMutation {
+ pageUpdate: {
+ page: {
+ // The ID of the object.
+ id: string,
+ slug: string,
+ title: string,
+ content: string,
+ isVisible: boolean,
+ availableOn: string | null,
+ } | null,
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ } | null,
+};
+
+export interface PageCreateMutationVariables {
+ title: string,
+ content: string,
+ slug: string,
+ isVisible: boolean,
+ availableOn?: string | null,
+};
+
+export interface PageCreateMutation {
+ pageCreate: {
+ page: {
+ // The ID of the object.
+ id: string,
+ slug: string,
+ title: string,
+ content: string,
+ isVisible: boolean,
+ availableOn: string | null,
+ created: string,
+ } | null,
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ } | null,
+};
+
+export interface PageListQueryVariables {
+ first?: number | null,
+ after?: string | null,
+ last?: number | null,
+ before?: string | null,
+};
+
+export interface PageListQuery {
+ // List of the shop's pages.
+ pages: {
+ edges: Array< {
+ // A cursor for use in pagination
+ cursor: string,
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ slug: string,
+ title: string,
+ isVisible: boolean,
+ },
+ } >,
+ pageInfo: {
+ // When paginating backwards, are there more items?
+ hasPreviousPage: boolean,
+ // When paginating forwards, are there more items?
+ hasNextPage: boolean,
+ // When paginating backwards, the cursor to continue.
+ startCursor: string | null,
+ // When paginating forwards, the cursor to continue.
+ endCursor: string | null,
+ },
+ } | null,
+};
+
+export interface PageDetailsQueryVariables {
+ id: string,
+};
+
+export interface PageDetailsQuery {
+ // Lookup a page by ID or by slug.
+ page: {
+ // The ID of the object.
+ id: string,
+ slug: string,
+ title: string,
+ content: string,
+ created: string,
+ isVisible: boolean,
+ availableOn: string | null,
+ } | null,
+};
+
+export interface ProductImageCreateMutationVariables {
+ product: string,
+ image: string,
+ alt?: string | null,
+};
+
+export interface ProductImageCreateMutation {
+ productImageCreate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+ } | null,
+ } | null,
+};
+
+export interface ProductDeleteMutationVariables {
+ id: string,
+};
+
+export interface ProductDeleteMutation {
+ productDelete: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ } | null,
+};
+
+export interface ProductImageReorderMutationVariables {
+ productId: string,
+ imagesIds: Array< string | null >,
+};
+
+export interface ProductImageReorderMutation {
+ productImageReorder: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface ProductUpdateMutationVariables {
+ id: string,
+ attributes?: Array< AttributeValueInput | null > | null,
+ availableOn?: string | null,
+ category?: string | null,
+ chargeTaxes: boolean,
+ collections?: Array< string | null > | null,
+ description?: string | null,
+ isPublished: boolean,
+ name?: string | null,
+ price?: string | null,
+};
+
+export interface ProductUpdateMutation {
+ productUpdate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+ } | null,
+ } | null,
+};
+
+export interface ProductCreateMutationVariables {
+ attributes?: Array< AttributeValueInput | null > | null,
+ availableOn?: string | null,
+ category: string,
+ chargeTaxes: boolean,
+ collections?: Array< string | null > | null,
+ description?: string | null,
+ isPublished: boolean,
+ name: string,
+ price?: string | null,
+ productType: string,
+};
+
+export interface ProductCreateMutation {
+ productCreate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+ } | null,
+ } | null,
+};
+
+export interface VariantDeleteMutationVariables {
+ id: string,
+};
+
+export interface VariantDeleteMutation {
+ productVariantDelete: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ } | null,
+};
+
+export interface VariantUpdateMutationVariables {
+ id: string,
+ attributes?: Array< AttributeValueInput | null > | null,
+ costPrice?: string | null,
+ priceOverride?: string | null,
+ sku?: string | null,
+ quantity?: number | null,
+ trackInventory: boolean,
+};
+
+export interface VariantUpdateMutation {
+ productVariantUpdate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+ } | null,
+ } | null,
+};
+
+export interface VariantCreateMutationVariables {
+ attributes?: Array< AttributeValueInput | null > | null,
+ costPrice?: string | null,
+ priceOverride?: string | null,
+ product: string,
+ sku?: string | null,
+ quantity?: number | null,
+ trackInventory: boolean,
+};
+
+export interface VariantCreateMutation {
+ productVariantCreate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+ } | null,
+ } | null,
+};
+
+export interface ProductImageDeleteMutationVariables {
+ id: string,
+};
+
+export interface ProductImageDeleteMutation {
+ productImageDelete: {
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ } | null,
+ } | null,
+};
+
+export interface ProductImageUpdateMutationVariables {
+ id: string,
+ alt: string,
+};
+
+export interface ProductImageUpdateMutation {
+ productImageUpdate: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+ } | null,
+ } | null,
+};
+
+export interface VariantImageAssignMutationVariables {
+ variantId: string,
+ imageId: string,
+};
+
+export interface VariantImageAssignMutation {
+ variantImageAssign: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+ } | null,
+ } | null,
+};
+
+export interface VariantImageUnassignMutationVariables {
+ variantId: string,
+ imageId: string,
+};
+
+export interface VariantImageUnassignMutation {
+ variantImageUnassign: {
+ // List of errors that occurred executing the mutation.
+ errors: Array< {
+ // Name of a field that caused the error. A value of
+ // `null` indicates that the error isn't associated with a particular
+ // field.
+ field: string | null,
+ // The error message.
+ message: string | null,
+ } | null > | null,
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+ } | null,
+ } | null,
+};
+
+export interface ProductListQueryVariables {
+ first?: number | null,
+ after?: string | null,
+ last?: number | null,
+ before?: string | null,
+};
+
+export interface ProductListQuery {
+ // List of the shop's products.
+ products: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ },
+ } >,
+ pageInfo: {
+ // When paginating backwards, are there more items?
+ hasPreviousPage: boolean,
+ // When paginating forwards, are there more items?
+ hasNextPage: boolean,
+ // When paginating backwards, the cursor to continue.
+ startCursor: string | null,
+ // When paginating forwards, the cursor to continue.
+ endCursor: string | null,
+ },
+ } | null,
+};
+
+export interface ProductDetailsQueryVariables {
+ id: string,
+};
+
+export interface ProductDetailsQuery {
+ // Lookup a product by ID.
+ product: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+ } | null,
+ // List of the shop's collections.
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // List of the shop's categories.
+ categories: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+};
+
+export interface ProductVariantDetailsQueryVariables {
+ id: string,
+};
+
+export interface ProductVariantDetailsQuery {
+ // Lookup a variant by ID.
+ productVariant: {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+ } | null,
+};
+
+export interface ProductCreateDataQuery {
+ // List of the shop's product types.
+ productTypes: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ productAttributes: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ sortOrder: number,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ // List of the shop's collections.
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // List of the shop's categories.
+ categories: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+};
+
+export interface ProductVariantCreateDataQueryVariables {
+ id: string,
+};
+
+export interface ProductVariantCreateDataQuery {
+ // Lookup a product by ID.
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ variantAttributes: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ sortOrder: number,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ },
+ } >,
+ } | null,
+ },
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ } | null,
+};
+
+export interface ProductImageQueryVariables {
+ productId: string,
+ imageId: string,
+};
+
+export interface ProductImageQuery {
+ // Lookup a product by ID.
+ product: {
+ // The ID of the object.
+ id: string,
+ // Get a single product image by ID
+ mainImage: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ // The URL of the image.
+ url: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ pageInfo: {
+ // When paginating backwards, are there more items?
+ hasPreviousPage: boolean,
+ // When paginating forwards, are there more items?
+ hasNextPage: boolean,
+ // When paginating backwards, the cursor to continue.
+ startCursor: string | null,
+ // When paginating forwards, the cursor to continue.
+ endCursor: string | null,
+ },
+ } | null,
+ } | null,
+};
+
+export interface UserFragment {
+ // The ID of the object.
+ id: string,
+ email: string,
+ isStaff: boolean,
+ note: string | null,
+ permissions: Array< {
+ // Internal code for permission.
+ code: string,
+ // Describe action(s) allowed to do by permission.
+ name: string,
+ } | null > | null,
+};
+
+export interface OrderDetailsFragment {
+ // The ID of the object.
+ id: string,
+ billingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ created: string,
+ // List of events associated with the order.
+ events: Array< {
+ // The ID of the object.
+ id: string,
+ // Amount of money.
+ amount: number | null,
+ // Date when event happened at in ISO 8601 format.
+ date: string | null,
+ // Email of the customer
+ email: string | null,
+ // Type of an email sent to the customer
+ emailType: string | null,
+ // Content of a note added to the order.
+ message: string | null,
+ // Number of items.
+ quantity: number | null,
+ // Order event type
+ type: OrderEvents | null,
+ // User who performed the action.
+ user: {
+ email: string,
+ } | null,
+ } | null > | null,
+ // List of shipments for the order.
+ fulfillments: Array< {
+ // The ID of the object.
+ id: string,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ orderLine: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ },
+ quantity: number,
+ },
+ } >,
+ } | null,
+ status: FulfillmentStatus,
+ trackingNumber: string,
+ } | null >,
+ lines: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ productName: string,
+ productSku: string,
+ quantity: number,
+ quantityFulfilled: number,
+ unitPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ },
+ } >,
+ } | null,
+ // User-friendly number of an order.
+ number: string | null,
+ // Internal payment status.
+ paymentStatus: string | null,
+ shippingAddress: {
+ // The ID of the object.
+ id: string,
+ city: string,
+ cityArea: string,
+ companyName: string,
+ country: AddressCountry,
+ countryArea: string,
+ firstName: string,
+ lastName: string,
+ phone: string | null,
+ postalCode: string,
+ streetAddress1: string,
+ streetAddress2: string,
+ } | null,
+ shippingMethod: {
+ // The ID of the object.
+ id: string,
+ } | null,
+ shippingMethodName: string | null,
+ shippingPrice: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ status: OrderStatus,
+ // The sum of line prices not including shipping.
+ subtotal: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ total: {
+ // Amount of money including taxes.
+ gross: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ // Amount of taxes.
+ tax: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Amount authorized for the order.
+ totalAuthorized: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Amount captured by payment.
+ totalCaptured: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ user: {
+ // The ID of the object.
+ id: string,
+ email: string,
+ } | null,
+};
+
+export interface MoneyFragment {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+};
+
+export interface ProductImageFragment {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+};
+
+export interface ProductFragment {
+ // The ID of the object.
+ id: string,
+ name: string,
+ description: string,
+ seoTitle: string | null,
+ seoDescription: string | null,
+ category: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ collections: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ },
+ } >,
+ } | null,
+ // The product's base price (without any discounts
+ // applied).
+ price: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ margin: {
+ start: number | null,
+ stop: number | null,
+ } | null,
+ purchaseCost: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ } | null,
+ isPublished: boolean,
+ chargeTaxes: boolean,
+ availableOn: string | null,
+ // List of product attributes assigned to this product.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // Visible name for display purposes.
+ name: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Informs about product's availability in the storefront,
+ // current price and discounts.
+ availability: {
+ available: boolean | null,
+ priceRange: {
+ // Lower bound of a price range.
+ start: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ // Upper bound of a price range.
+ stop: {
+ // Amount of money without taxes.
+ net: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ },
+ } | null,
+ } | null,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ variants: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ sku: string,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ // Quantity of a product available for sale.
+ stockQuantity: number,
+ // Gross margin percentage value.
+ margin: number | null,
+ },
+ } >,
+ } | null,
+ productType: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ hasVariants: boolean,
+ },
+ // The storefront URL for the product.
+ url: string,
+};
+
+export interface ProductVariantFragment {
+ // The ID of the object.
+ id: string,
+ // List of attributes assigned to this variant.
+ attributes: Array< {
+ // Name of an attribute
+ attribute: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ // List of attribute's values.
+ values: Array< {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null > | null,
+ } | null,
+ // Value of an attribute.
+ value: {
+ // The ID of the object.
+ id: string,
+ // Visible name for display purposes.
+ name: string | null,
+ // Internal representation of an attribute name.
+ slug: string | null,
+ } | null,
+ } | null > | null,
+ // Cost price of the variant.
+ costPrice: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // Override the base price of a product if necessary.
+ // A value of `null` indicates that the default product price is used.
+ priceOverride: {
+ // Amount of money.
+ amount: number,
+ // Currency code.
+ currency: string,
+ } | null,
+ product: {
+ // The ID of the object.
+ id: string,
+ images: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ alt: string,
+ sortOrder: number,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ name: string,
+ // The URL of a main thumbnail for a product.
+ thumbnailUrl: string | null,
+ variants: {
+ // A total count of items in the collection
+ totalCount: number | null,
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ name: string,
+ sku: string,
+ image: {
+ edges: Array< {
+ // The item at the end of the edge
+ node: {
+ // The ID of the object.
+ id: string,
+ // The URL of the image.
+ url: string,
+ },
+ } >,
+ } | null,
+ },
+ } >,
+ } | null,
+ },
+ sku: string,
+ quantity: number,
+ quantityAllocated: number,
+};
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index 230c7d1228..9689c2d397 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -17,10 +17,14 @@ import OrderCustomer from "../OrderCustomer";
import OrderCustomerEditDialog from "../OrderCustomerEditDialog";
import OrderFulfillment from "../OrderFulfillment";
import OrderFulfillmentCancelDialog from "../OrderFulfillmentCancelDialog";
-import OrderFulfillmentDialog from "../OrderFulfillmentDialog";
+import OrderFulfillmentDialog, {
+ FormData as OrderFulfillFormData
+} from "../OrderFulfillmentDialog";
import OrderFulfillmentTrackingDialog from "../OrderFulfillmentTrackingDialog";
import OrderHistory from "../OrderHistory";
-import OrderPaymentDialog from "../OrderPaymentDialog";
+import OrderPaymentDialog, {
+ FormData as OrderPaymentFormData
+} from "../OrderPaymentDialog";
import OrderPaymentReleaseDialog from "../OrderPaymentReleaseDialog";
import OrderProductAddDialog from "../OrderProductAddDialog";
import OrderShippingMethodEditDialog from "../OrderShippingMethodEditDialog";
@@ -137,10 +141,13 @@ interface OrderDetailsPageProps {
onBack();
onCreate?();
onCustomerEmailClick?(id: string);
+ onOrderFulfill(data: OrderFulfillFormData);
onOrderLineChange?(id: string): (value: string) => () => void;
onOrderLineRemove?(id: string): () => void;
onProductClick?(id: string);
onPackingSlipClick?(id: string);
+ onPaymentCapture(data: OrderPaymentFormData);
+ onPaymentRefund(data: OrderPaymentFormData);
onPaymentRelease?();
onOrderCancel?();
}
@@ -243,9 +250,12 @@ class OrderDetailsPageComponent extends React.Component<
onCreate,
onCustomerEmailClick,
onOrderCancel,
+ onOrderFulfill,
onOrderLineChange,
onOrderLineRemove,
onPackingSlipClick,
+ onPaymentCapture,
+ onPaymentRefund,
onPaymentRelease,
onProductClick
} = this.props;
@@ -314,51 +324,26 @@ class OrderDetailsPageComponent extends React.Component<
onRowClick={onProductClick}
onShippingMethodClick={this.toggleShippingMethodEditDialog}
/>
+ <OrderFulfillmentDialog
+ open={openedFulfillmentDialog && !!order}
+ products={unfulfilled}
+ onClose={this.toggleFulfillmentDialog}
+ onSubmit={onOrderFulfill}
+ />
+ <OrderPaymentDialog
+ open={openedPaymentCaptureDialog && !!order}
+ variant="capture"
+ onClose={this.togglePaymentCaptureDialog}
+ onSubmit={onPaymentCapture}
+ />
+ <OrderPaymentDialog
+ open={openedPaymentRefundDialog && !!order}
+ variant="refund"
+ onClose={this.togglePaymentRefundDialog}
+ onSubmit={onPaymentRefund}
+ />
{order && (
<>
- <Form
- initial={Ø(() =>
- unfulfilled.reduce((prev, curr) => {
- prev[curr.id] = curr.quantity;
- return prev;
- }, {})
- )}
- >
- {({ data, change, submit }) => (
- <OrderFulfillmentDialog
- data={data}
- open={openedFulfillmentDialog}
- products={unfulfilled}
- onChange={change}
- onClose={this.toggleFulfillmentDialog}
- onConfirm={submit}
- />
- )}
- </Form>
- <Form initial={{ value: 0 }}>
- {({ data, change, submit }) => (
- <OrderPaymentDialog
- open={openedPaymentCaptureDialog}
- value={data.value}
- variant="capture"
- onChange={change}
- onClose={this.togglePaymentCaptureDialog}
- onConfirm={submit}
- />
- )}
- </Form>
- <Form initial={{ value: 0 }}>
- {({ data, change, submit }) => (
- <OrderPaymentDialog
- open={openedPaymentRefundDialog}
- value={data.value}
- variant="refund"
- onChange={change}
- onClose={this.togglePaymentRefundDialog}
- onConfirm={submit}
- />
- )}
- </Form>
<Form
initial={{
quantity: 1,
diff --git a/saleor/static/dashboard-next/orders/components/OrderFulfillmentDialog/OrderFulfillmentDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderFulfillmentDialog/OrderFulfillmentDialog.tsx
index 3c05dc4ae1..fab077e823 100644
--- a/saleor/static/dashboard-next/orders/components/OrderFulfillmentDialog/OrderFulfillmentDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderFulfillmentDialog/OrderFulfillmentDialog.tsx
@@ -12,7 +12,13 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
+import Form from "../../../components/Form";
import i18n from "../../../i18n";
+import { Ø } from "../../../misc";
+
+export interface FormData {
+ lines: number[];
+}
interface OrderFulfillmentDialogProps {
open: boolean;
@@ -24,10 +30,8 @@ interface OrderFulfillmentDialogProps {
quantityFulfilled: number;
thumbnailUrl?: string;
}>;
- data: any;
- onChange(event: React.ChangeEvent<any>);
- onClose?();
- onConfirm?(event: React.FormEvent<any>);
+ onClose();
+ onSubmit(data: FormData);
}
const decorate = withStyles(
@@ -47,55 +51,92 @@ const decorate = withStyles(
{ name: "OrderFulfillmentDialog" }
);
const OrderFulfillmentDialog = decorate<OrderFulfillmentDialogProps>(
- ({ classes, open, products, data, onChange, onClose, onConfirm }) => (
+ ({ classes, open, products, onClose, onSubmit }) => (
<Dialog open={open}>
- <DialogTitle>{i18n.t("Fulfill products")}</DialogTitle>
- <Table>
- <TableHead>
- <TableRow>
- <TableCell />
- <TableCell>{i18n.t("Product name")}</TableCell>
- <TableCell>{i18n.t("SKU")}</TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Quantity")}
- </TableCell>
- </TableRow>
- </TableHead>
- <TableBody>
- {products.map(product => (
- <TableRow key={product.id}>
- <TableCell className={classes.avatarCell}>
- <Avatar src={product.thumbnailUrl} />
- </TableCell>
- <TableCell>{product.productName}</TableCell>
- <TableCell>{product.productSku}</TableCell>
- <TableCell className={classes.textRight}>
- <Input
- type="number"
- inputProps={{
- max: product.quantity - product.quantityFulfilled,
- style: { textAlign: "right" }
- }}
- className={classes.quantityInput}
- value={data[product.id]}
- onChange={onChange}
- name={product.id}
- error={product.quantity < data[product.id]}
- />{" "}
- / {product.quantity}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- <DialogActions>
- <Button onClick={onClose}>
- {i18n.t("Cancel", { context: "button" })}
- </Button>
- <Button color="primary" variant="raised" onClick={onConfirm}>
- {i18n.t("Confirm", { context: "button" })}
- </Button>
- </DialogActions>
+ <Form
+ initial={{
+ lines: Ø(
+ () =>
+ products.map(
+ product => product.quantity - product.quantityFulfilled
+ ),
+ []
+ )
+ }}
+ onSubmit={onSubmit}
+ >
+ {({ data, change }) => {
+ const handleQuantityChange = (
+ productIndex: number,
+ event: React.ChangeEvent<any>
+ ) => {
+ const newData = data.lines;
+ newData[productIndex] = event.target.value;
+ change({
+ target: {
+ name: "lines",
+ value: newData
+ }
+ } as any);
+ };
+ return (
+ <>
+ <DialogTitle>{i18n.t("Fulfill products")}</DialogTitle>
+ <Table>
+ <TableHead>
+ <TableRow>
+ <TableCell />
+ <TableCell>{i18n.t("Product name")}</TableCell>
+ <TableCell>{i18n.t("SKU")}</TableCell>
+ <TableCell className={classes.textRight}>
+ {i18n.t("Quantity")}
+ </TableCell>
+ </TableRow>
+ </TableHead>
+ <TableBody>
+ {products.map((product, productIndex) => {
+ const remainingQuantity =
+ product.quantity - product.quantityFulfilled;
+ return (
+ <TableRow key={product.id}>
+ <TableCell className={classes.avatarCell}>
+ <Avatar src={product.thumbnailUrl} />
+ </TableCell>
+ <TableCell>{product.productName}</TableCell>
+ <TableCell>{product.productSku}</TableCell>
+ <TableCell className={classes.textRight}>
+ <Input
+ type="number"
+ inputProps={{
+ max: remainingQuantity,
+ style: { textAlign: "right" }
+ }}
+ className={classes.quantityInput}
+ value={data.lines[productIndex]}
+ onChange={event =>
+ handleQuantityChange(productIndex, event)
+ }
+ error={remainingQuantity < data.lines[productIndex]}
+ />{" "}
+ / {remainingQuantity}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ <DialogActions>
+ <Button onClick={onClose}>
+ {i18n.t("Cancel", { context: "button" })}
+ </Button>
+ <Button color="primary" variant="raised" type="submit">
+ {i18n.t("Confirm", { context: "button" })}
+ </Button>
+ </DialogActions>
+ </>
+ );
+ }}
+ </Form>
</Dialog>
)
);
diff --git a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
index 9b7fbdda4b..fc6bb0ddfa 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
@@ -6,47 +6,66 @@ import DialogTitle from "@material-ui/core/DialogTitle";
import TextField from "@material-ui/core/TextField";
import * as React from "react";
+import Form from "../../../components/Form";
import i18n from "../../../i18n";
+export interface FormData {
+ amount: string;
+}
+
interface OrderPaymentDialogProps {
open: boolean;
- value: number;
variant: string;
- onChange(event: React.ChangeEvent<any>);
- onClose?();
- onConfirm?(event: React.FormEvent<any>);
+ onClose: () => void;
+ onSubmit: (data: FormData) => void;
}
+const initialForm: FormData = { amount: "0" };
+
const OrderPaymentDialog: React.StatelessComponent<OrderPaymentDialogProps> = ({
open,
variant,
- onConfirm,
onClose,
- onChange
+ onSubmit
}) => (
<Dialog open={open}>
- <DialogTitle>
- {variant === "capture"
- ? i18n.t("Capture payment", { context: "title" })
- : i18n.t("Refund payment", { context: "title" })}
- </DialogTitle>
- <DialogContent>
- <TextField
- label={i18n.t("Amount")}
- name="value"
- onChange={onChange}
- fullWidth
- type="number"
- />
- </DialogContent>
- <DialogActions>
- <Button onClick={onClose}>
- {i18n.t("Cancel", { context: "button" })}
- </Button>
- <Button color="primary" variant="raised" onClick={onConfirm}>
- {i18n.t("Confirm", { context: "button" })}
- </Button>
- </DialogActions>
+ <Form initial={initialForm} onSubmit={onSubmit}>
+ {({ data, change, submit }) => (
+ <>
+ <DialogTitle>
+ {variant === "capture"
+ ? i18n.t("Capture payment", { context: "title" })
+ : i18n.t("Refund payment", { context: "title" })}
+ </DialogTitle>
+
+ <DialogContent>
+ <TextField
+ fullWidth
+ label={i18n.t("Amount")}
+ name="amount"
+ onChange={change}
+ type="number"
+ value={data.amount}
+ />
+ </DialogContent>
+ <DialogActions>
+ <Button onClick={onClose}>
+ {i18n.t("Cancel", { context: "button" })}
+ </Button>
+ <Button
+ color="primary"
+ variant="raised"
+ onClick={data => {
+ onClose();
+ submit(data);
+ }}
+ >
+ {i18n.t("Confirm", { context: "button" })}
+ </Button>
+ </DialogActions>
+ </>
+ )}
+ </Form>
</Dialog>
);
export default OrderPaymentDialog;
diff --git a/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
new file mode 100644
index 0000000000..7f111c8c23
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
@@ -0,0 +1,41 @@
+import * as React from "react";
+
+import {
+ OrderCreateFulfillmentMutation,
+ OrderCreateFulfillmentMutationVariables
+} from "../../gql-types";
+import { TypedOrderCreateFulfillmentMutation } from "../mutations";
+
+import {
+ PartialMutationProviderProps,
+ PartialMutationProviderRenderProps
+} from "../..";
+
+interface OrderCreateFulfillmentProviderProps
+ extends PartialMutationProviderProps<OrderCreateFulfillmentMutation> {
+ id: string;
+ children: PartialMutationProviderRenderProps<
+ OrderCreateFulfillmentMutation,
+ OrderCreateFulfillmentMutationVariables
+ >;
+}
+
+const OrderCreateFulfillmentProvider: React.StatelessComponent<
+ OrderCreateFulfillmentProviderProps
+> = ({ children, onError, onSuccess }) => (
+ <TypedOrderCreateFulfillmentMutation
+ onCompleted={onSuccess}
+ onError={onError}
+ >
+ {(mutate, { data, error, loading }) =>
+ children({
+ data,
+ error,
+ loading,
+ mutate
+ })
+ }
+ </TypedOrderCreateFulfillmentMutation>
+);
+
+export default OrderCreateFulfillmentProvider;
diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
new file mode 100644
index 0000000000..3546a30466
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
@@ -0,0 +1,109 @@
+import * as React from "react";
+
+import {
+ MutationProviderProps,
+ MutationProviderRenderProps,
+ PartialMutationProviderOutput
+} from "../..";
+import {
+ OrderCaptureMutation,
+ OrderCaptureMutationVariables,
+ OrderCreateFulfillmentMutation,
+ OrderCreateFulfillmentMutationVariables,
+ OrderRefundMutation,
+ OrderRefundMutationVariables
+} from "../../gql-types";
+import { Ø } from "../../misc";
+import OrderCreateFulfillmentProvider from "./OrderCreateFulfillment";
+import OrderPaymentCaptureProvider from "./OrderPaymentCapture";
+import OrderPaymentRefundProvider from "./OrderPaymentRefund";
+
+interface OrderOperationsProps extends MutationProviderProps {
+ order: string;
+ children: MutationProviderRenderProps<{
+ orderCreateFulfillment: PartialMutationProviderOutput<
+ OrderCreateFulfillmentMutation,
+ OrderCreateFulfillmentMutationVariables
+ >;
+ orderPaymentCapture: PartialMutationProviderOutput<
+ OrderCaptureMutation,
+ OrderCaptureMutationVariables
+ >;
+ orderPaymentRefund: PartialMutationProviderOutput<
+ OrderRefundMutation,
+ OrderRefundMutationVariables
+ >;
+ }>;
+ onFulfillmentCreate: (data: OrderCreateFulfillmentMutation) => void;
+ onPaymentCapture: (data: OrderCaptureMutation) => void;
+ onPaymentRefund: (data: OrderRefundMutation) => void;
+}
+
+const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
+ children,
+ order,
+ onError,
+ onFulfillmentCreate,
+ onPaymentCapture,
+ onPaymentRefund
+}) => (
+ <OrderPaymentCaptureProvider
+ id={order}
+ onError={onError}
+ onSuccess={onPaymentCapture}
+ >
+ {paymentCapture => (
+ <OrderPaymentRefundProvider
+ id={order}
+ onError={onError}
+ onSuccess={onPaymentRefund}
+ >
+ {paymentRefund => (
+ <OrderCreateFulfillmentProvider
+ id={order}
+ onError={onError}
+ onSuccess={onFulfillmentCreate}
+ >
+ {createFulfillment =>
+ children({
+ errors: [
+ ...Ø(
+ () => createFulfillment.data.fulfillmentCreate.errors,
+ [] as any
+ ),
+ ...Ø(
+ () => paymentCapture.data.orderCapture.errors,
+ [] as any
+ ),
+ ...Ø(() => paymentRefund.data.orderRefund.errors, [] as any)
+ ],
+ orderCreateFulfillment: {
+ data: createFulfillment.data,
+ loading: createFulfillment.loading,
+ mutate: variables =>
+ createFulfillment.mutate({
+ variables: {
+ ...variables,
+ input: { ...variables.input, order }
+ }
+ })
+ },
+ orderPaymentCapture: {
+ data: paymentCapture.data,
+ loading: paymentCapture.loading,
+ mutate: variables => paymentCapture.mutate({ variables })
+ },
+ orderPaymentRefund: {
+ data: paymentRefund.data,
+ loading: paymentRefund.loading,
+ mutate: variables => paymentRefund.mutate({ variables })
+ }
+ })
+ }
+ </OrderCreateFulfillmentProvider>
+ )}
+ </OrderPaymentRefundProvider>
+ )}
+ </OrderPaymentCaptureProvider>
+);
+export default OrderOperations;
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
new file mode 100644
index 0000000000..bc4cac3f19
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
@@ -0,0 +1,38 @@
+import * as React from "react";
+
+import {
+ OrderCaptureMutation,
+ OrderCaptureMutationVariables
+} from "../../gql-types";
+import { TypedOrderCaptureMutation } from "../mutations";
+
+import {
+ PartialMutationProviderProps,
+ PartialMutationProviderRenderProps
+} from "../..";
+
+interface OrderPaymentCaptureProviderProps
+ extends PartialMutationProviderProps<OrderCaptureMutation> {
+ id: string;
+ children: PartialMutationProviderRenderProps<
+ OrderCaptureMutation,
+ OrderCaptureMutationVariables
+ >;
+}
+
+const OrderPaymentCaptureProvider: React.StatelessComponent<
+ OrderPaymentCaptureProviderProps
+> = ({ children, onError, onSuccess }) => (
+ <TypedOrderCaptureMutation onCompleted={onSuccess} onError={onError}>
+ {(mutate, { data, error, loading }) =>
+ children({
+ data,
+ error,
+ loading,
+ mutate
+ })
+ }
+ </TypedOrderCaptureMutation>
+);
+
+export default OrderPaymentCaptureProvider;
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
new file mode 100644
index 0000000000..62e2c72650
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
@@ -0,0 +1,38 @@
+import * as React from "react";
+
+import {
+ OrderRefundMutation,
+ OrderRefundMutationVariables
+} from "../../gql-types";
+import { TypedOrderRefundMutation } from "../mutations";
+
+import {
+ PartialMutationProviderProps,
+ PartialMutationProviderRenderProps
+} from "../..";
+
+interface OrderPaymentCaptureProviderProps
+ extends PartialMutationProviderProps<OrderRefundMutation> {
+ id: string;
+ children: PartialMutationProviderRenderProps<
+ OrderRefundMutation,
+ OrderRefundMutationVariables
+ >;
+}
+
+const OrderPaymentCaptureProvider: React.StatelessComponent<
+ OrderPaymentCaptureProviderProps
+> = ({ children, onError, onSuccess }) => (
+ <TypedOrderRefundMutation onCompleted={onSuccess} onError={onError}>
+ {(mutate, { data, error, loading }) =>
+ children({
+ data,
+ error,
+ loading,
+ mutate
+ })
+ }
+ </TypedOrderRefundMutation>
+);
+
+export default OrderPaymentCaptureProvider;
diff --git a/saleor/static/dashboard-next/orders/mutations.ts b/saleor/static/dashboard-next/orders/mutations.ts
index f4fd329277..b297d10ae3 100644
--- a/saleor/static/dashboard-next/orders/mutations.ts
+++ b/saleor/static/dashboard-next/orders/mutations.ts
@@ -3,6 +3,11 @@ import gql from "graphql-tag";
import { TypedMutation } from "../mutations";
import { fragmentOrderDetails } from "./queries";
import { OrderCancel, OrderCancelVariables } from "./types/OrderCancel";
+import { OrderCapture, OrderCaptureVariables } from "./types/OrderCapture";
+import {
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
+} from "./types/OrderCreateFulfillment";
import { OrderRefund, OrderRefundVariables } from "./types/OrderRefund";
import { OrderRelease, OrderReleaseVariables } from "./types/OrderRelease";
@@ -25,6 +30,10 @@ const orderRefundMutation = gql`
${fragmentOrderDetails}
mutation OrderRefund($id: ID!, $amount: Decimal!) {
orderRefund(id: $id, amount: $amount) {
+ errors {
+ field
+ message
+ }
order {
...OrderDetailsFragment
}
@@ -50,3 +59,37 @@ export const TypedOrderReleaseMutation = TypedMutation<
OrderRelease,
OrderReleaseVariables
>(orderReleaseMutation);
+
+const orderCaptureMutation = gql`
+ ${fragmentOrderDetails}
+ mutation OrderCapture($id: ID!, $amount: Decimal!) {
+ orderCapture(id: $id, amount: $amount) {
+ errors {
+ field
+ message
+ }
+ order {
+ ...OrderDetailsFragment
+ }
+ }
+ }
+`;
+export const TypedOrderCaptureMutation = TypedMutation<
+ OrderCapture,
+ OrderCaptureVariables
+>(orderCaptureMutation);
+
+const orderCreateFulfillmentMutation = gql`
+ mutation OrderCreateFulfillment($input: FulfillmentCreateInput!) {
+ fulfillmentCreate(input: $input) {
+ errors {
+ field
+ message
+ }
+ }
+ }
+`;
+export const TypedOrderCreateFulfillmentMutation = TypedMutation<
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
+>(orderCreateFulfillmentMutation);
diff --git a/saleor/static/dashboard-next/orders/types/OrderCapture.ts b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
new file mode 100644
index 0000000000..2f52511c85
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
@@ -0,0 +1,233 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+import { AddressCountry, OrderEvents, FulfillmentStatus, OrderStatus } from "./../../types/globalTypes";
+
+// ====================================================
+// GraphQL mutation operation: OrderCapture
+// ====================================================
+
+export interface OrderCapture_orderCapture_errors {
+ __typename: "Error";
+ field: string | null;
+ message: string | null;
+}
+
+export interface OrderCapture_orderCapture_order_billingAddress {
+ __typename: "Address";
+ id: string;
+ city: string;
+ cityArea: string;
+ companyName: string;
+ country: AddressCountry;
+ countryArea: string;
+ firstName: string;
+ lastName: string;
+ phone: string | null;
+ postalCode: string;
+ streetAddress1: string;
+ streetAddress2: string;
+}
+
+export interface OrderCapture_orderCapture_order_events_user {
+ __typename: "User";
+ email: string;
+}
+
+export interface OrderCapture_orderCapture_order_events {
+ __typename: "OrderEvent";
+ id: string;
+ amount: number | null;
+ date: any | null;
+ email: string | null;
+ emailType: string | null;
+ message: string | null;
+ quantity: number | null;
+ type: OrderEvents | null;
+ user: OrderCapture_orderCapture_order_events_user | null;
+}
+
+export interface OrderCapture_orderCapture_order_fulfillments_lines_edges_node_orderLine {
+ __typename: "OrderLine";
+ id: string;
+ productName: string;
+}
+
+export interface OrderCapture_orderCapture_order_fulfillments_lines_edges_node {
+ __typename: "FulfillmentLine";
+ id: string;
+ orderLine: OrderCapture_orderCapture_order_fulfillments_lines_edges_node_orderLine;
+ quantity: number;
+}
+
+export interface OrderCapture_orderCapture_order_fulfillments_lines_edges {
+ __typename: "FulfillmentLineCountableEdge";
+ node: OrderCapture_orderCapture_order_fulfillments_lines_edges_node;
+}
+
+export interface OrderCapture_orderCapture_order_fulfillments_lines {
+ __typename: "FulfillmentLineCountableConnection";
+ edges: OrderCapture_orderCapture_order_fulfillments_lines_edges[];
+}
+
+export interface OrderCapture_orderCapture_order_fulfillments {
+ __typename: "Fulfillment";
+ id: string;
+ lines: OrderCapture_orderCapture_order_fulfillments_lines | null;
+ status: FulfillmentStatus;
+ trackingNumber: string;
+}
+
+export interface OrderCapture_orderCapture_order_lines_edges_node_unitPrice_gross {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_lines_edges_node_unitPrice_net {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_lines_edges_node_unitPrice {
+ __typename: "TaxedMoney";
+ gross: OrderCapture_orderCapture_order_lines_edges_node_unitPrice_gross;
+ net: OrderCapture_orderCapture_order_lines_edges_node_unitPrice_net;
+}
+
+export interface OrderCapture_orderCapture_order_lines_edges_node {
+ __typename: "OrderLine";
+ id: string;
+ productName: string;
+ productSku: string;
+ quantity: number;
+ quantityFulfilled: number;
+ unitPrice: OrderCapture_orderCapture_order_lines_edges_node_unitPrice | null;
+}
+
+export interface OrderCapture_orderCapture_order_lines_edges {
+ __typename: "OrderLineCountableEdge";
+ node: OrderCapture_orderCapture_order_lines_edges_node;
+}
+
+export interface OrderCapture_orderCapture_order_lines {
+ __typename: "OrderLineCountableConnection";
+ edges: OrderCapture_orderCapture_order_lines_edges[];
+}
+
+export interface OrderCapture_orderCapture_order_shippingAddress {
+ __typename: "Address";
+ id: string;
+ city: string;
+ cityArea: string;
+ companyName: string;
+ country: AddressCountry;
+ countryArea: string;
+ firstName: string;
+ lastName: string;
+ phone: string | null;
+ postalCode: string;
+ streetAddress1: string;
+ streetAddress2: string;
+}
+
+export interface OrderCapture_orderCapture_order_shippingMethod {
+ __typename: "ShippingMethod";
+ id: string;
+}
+
+export interface OrderCapture_orderCapture_order_shippingPrice_gross {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_shippingPrice {
+ __typename: "TaxedMoney";
+ gross: OrderCapture_orderCapture_order_shippingPrice_gross;
+}
+
+export interface OrderCapture_orderCapture_order_subtotal_gross {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_subtotal {
+ __typename: "TaxedMoney";
+ gross: OrderCapture_orderCapture_order_subtotal_gross;
+}
+
+export interface OrderCapture_orderCapture_order_total_gross {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_total_tax {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_total {
+ __typename: "TaxedMoney";
+ gross: OrderCapture_orderCapture_order_total_gross;
+ tax: OrderCapture_orderCapture_order_total_tax;
+}
+
+export interface OrderCapture_orderCapture_order_totalAuthorized {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_totalCaptured {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface OrderCapture_orderCapture_order_user {
+ __typename: "User";
+ id: string;
+ email: string;
+}
+
+export interface OrderCapture_orderCapture_order {
+ __typename: "Order";
+ id: string;
+ billingAddress: OrderCapture_orderCapture_order_billingAddress | null;
+ created: any;
+ events: (OrderCapture_orderCapture_order_events | null)[] | null;
+ fulfillments: (OrderCapture_orderCapture_order_fulfillments | null)[];
+ lines: OrderCapture_orderCapture_order_lines | null;
+ number: string | null;
+ paymentStatus: string | null;
+ shippingAddress: OrderCapture_orderCapture_order_shippingAddress | null;
+ shippingMethod: OrderCapture_orderCapture_order_shippingMethod | null;
+ shippingMethodName: string | null;
+ shippingPrice: OrderCapture_orderCapture_order_shippingPrice | null;
+ status: OrderStatus;
+ subtotal: OrderCapture_orderCapture_order_subtotal | null;
+ total: OrderCapture_orderCapture_order_total | null;
+ totalAuthorized: OrderCapture_orderCapture_order_totalAuthorized | null;
+ totalCaptured: OrderCapture_orderCapture_order_totalCaptured | null;
+ user: OrderCapture_orderCapture_order_user | null;
+}
+
+export interface OrderCapture_orderCapture {
+ __typename: "OrderCapture";
+ errors: (OrderCapture_orderCapture_errors | null)[] | null;
+ order: OrderCapture_orderCapture_order | null;
+}
+
+export interface OrderCapture {
+ orderCapture: OrderCapture_orderCapture | null;
+}
+
+export interface OrderCaptureVariables {
+ id: string;
+ amount: any;
+}
diff --git a/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
new file mode 100644
index 0000000000..a1054b4d83
--- /dev/null
+++ b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
@@ -0,0 +1,27 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+import { FulfillmentCreateInput } from "./../../types/globalTypes";
+
+// ====================================================
+// GraphQL mutation operation: OrderCreateFulfillment
+// ====================================================
+
+export interface OrderCreateFulfillment_fulfillmentCreate_errors {
+ __typename: "Error";
+ field: string | null;
+ message: string | null;
+}
+
+export interface OrderCreateFulfillment_fulfillmentCreate {
+ __typename: "FulfillmentCreate";
+ errors: (OrderCreateFulfillment_fulfillmentCreate_errors | null)[] | null;
+}
+
+export interface OrderCreateFulfillment {
+ fulfillmentCreate: OrderCreateFulfillment_fulfillmentCreate | null;
+}
+
+export interface OrderCreateFulfillmentVariables {
+ input: FulfillmentCreateInput;
+}
diff --git a/saleor/static/dashboard-next/orders/types/OrderRefund.ts b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
index 06e18bd75f..36f3fb848d 100644
--- a/saleor/static/dashboard-next/orders/types/OrderRefund.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
@@ -7,6 +7,12 @@ import { AddressCountry, OrderEvents, FulfillmentStatus, OrderStatus } from "./.
// GraphQL mutation operation: OrderRefund
// ====================================================
+export interface OrderRefund_orderRefund_errors {
+ __typename: "Error";
+ field: string | null;
+ message: string | null;
+}
+
export interface OrderRefund_orderRefund_order_billingAddress {
__typename: "Address";
id: string;
@@ -213,6 +219,7 @@ export interface OrderRefund_orderRefund_order {
export interface OrderRefund_orderRefund {
__typename: "OrderRefund";
+ errors: (OrderRefund_orderRefund_errors | null)[] | null;
order: OrderRefund_orderRefund_order | null;
}
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
index bc22f066bf..0606a729c7 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
@@ -3,10 +3,18 @@ import * as React from "react";
import { orderListUrl } from "..";
import { UserContext } from "../../auth";
import ErrorMessageCard from "../../components/ErrorMessageCard";
+import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
+import {
+ OrderCaptureMutation,
+ OrderCreateFulfillmentMutation,
+ OrderRefundMutation
+} from "../../gql-types";
+import i18n from "../../i18n";
import { Ø } from "../../misc";
import { productUrl } from "../../products";
import OrderDetailsPage from "../components/OrderDetailsPage";
+import OrderOperations from "../containers/OrderOperations";
import {
TypedOrderCancelMutation,
TypedOrderReleaseMutation
@@ -25,55 +33,155 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
}) => (
<Navigator>
{navigate => (
- <TypedOrderDetailsQuery variables={{ id }}>
- {({ data, error }) => {
- if (error) {
- return <ErrorMessageCard message="Something went wrong" />;
- }
- const order = data && data.order;
- return (
- <UserContext.Consumer>
- {({ user }) => (
- <TypedOrderCancelMutation variables={{ id }}>
- {cancelOrder => (
- <TypedOrderReleaseMutation variables={{ id }}>
- {releasePayment => (
- <TypedOrderShippingMethodsQuery>
- {({ data }) => {
- return (
- <OrderDetailsPage
- onBack={() => navigate(orderListUrl)}
- order={order}
- shippingMethods={Ø(() =>
- ([] as Array<{
- id: string;
- name: string;
- }>).concat(
- ...data.shippingZones.edges.map(edge =>
- edge.node.shippingMethods.edges.map(
- edge => edge.node
+ <Messages>
+ {pushMessage => (
+ <TypedOrderDetailsQuery variables={{ id }}>
+ {({ data, error }) => {
+ if (error) {
+ return <ErrorMessageCard message="Something went wrong" />;
+ }
+ const order = data && data.order;
+ return (
+ <UserContext.Consumer>
+ {({ user }) => (
+ <TypedOrderCancelMutation variables={{ id }}>
+ {cancelOrder => (
+ <TypedOrderReleaseMutation variables={{ id }}>
+ {releasePayment => (
+ <TypedOrderShippingMethodsQuery>
+ {({ data }) => {
+ const handlePaymentCapture = (
+ data: OrderCaptureMutation
+ ) => {
+ if (
+ !Ø(() => data.orderCapture.errors.length)
+ ) {
+ pushMessage({
+ text: i18n.t(
+ "Payment succesfully captured",
+ { context: "notification" }
+ )
+ });
+ }
+ };
+ const handlePaymentRefund = (
+ data: OrderRefundMutation
+ ) => {
+ if (
+ !Ø(() => data.orderRefund.errors.length)
+ ) {
+ pushMessage({
+ text: i18n.t(
+ "Payment succesfully refunded",
+ { context: "notification" }
)
+ });
+ }
+ };
+ const handleFulfillmentCreate = (
+ data: OrderCreateFulfillmentMutation
+ ) => {
+ if (
+ !Ø(
+ () => data.fulfillmentCreate.errors.length
)
- )
- )}
- user={user}
- onOrderCancel={cancelOrder}
- onPaymentRelease={releasePayment}
- onProductClick={id => () =>
- navigate(productUrl(id))}
- />
- );
- }}
- </TypedOrderShippingMethodsQuery>
+ ) {
+ pushMessage({
+ text: i18n.t(
+ "Items succesfully fulfilled",
+ { context: "notification" }
+ )
+ });
+ }
+ };
+ return (
+ <OrderOperations
+ order={id}
+ onError={undefined}
+ onFulfillmentCreate={
+ handleFulfillmentCreate
+ }
+ onPaymentCapture={handlePaymentCapture}
+ onPaymentRefund={handlePaymentRefund}
+ >
+ {({
+ orderCreateFulfillment,
+ orderPaymentCapture,
+ orderPaymentRefund
+ }) => (
+ <OrderDetailsPage
+ onBack={() => navigate(orderListUrl)}
+ order={order}
+ shippingMethods={Ø(() =>
+ ([] as Array<{
+ id: string;
+ name: string;
+ }>).concat(
+ ...data.shippingZones.edges.map(
+ edge =>
+ edge.node.shippingMethods.edges.map(
+ edge => edge.node
+ )
+ )
+ )
+ )}
+ user={user}
+ onOrderCancel={cancelOrder}
+ onOrderFulfill={variables =>
+ orderCreateFulfillment.mutate({
+ input: {
+ ...variables,
+ lines: Ø(
+ () => order.lines.edges,
+ []
+ )
+ .map(edge => edge.node)
+ .filter(
+ line =>
+ line.quantityFulfilled <
+ line.quantity
+ )
+ .map((line, lineIndex) => ({
+ orderLineId: line.id,
+ quantity:
+ variables.lines[lineIndex]
+ })),
+ order: order.id
+ }
+ })
+ }
+ onPaymentCapture={variables =>
+ orderPaymentCapture.mutate({
+ ...variables,
+ id
+ })
+ }
+ onPaymentRelease={releasePayment}
+ onPaymentRefund={variables =>
+ orderPaymentRefund.mutate({
+ ...variables,
+ id
+ })
+ }
+ onProductClick={id => () =>
+ navigate(productUrl(id))}
+ />
+ )}
+ </OrderOperations>
+ );
+ }}
+ </TypedOrderShippingMethodsQuery>
+ )}
+ </TypedOrderReleaseMutation>
)}
- </TypedOrderReleaseMutation>
+ </TypedOrderCancelMutation>
)}
- </TypedOrderCancelMutation>
- )}
- </UserContext.Consumer>
- );
- }}
- </TypedOrderDetailsQuery>
+ </UserContext.Consumer>
+ );
+ }}
+ </TypedOrderDetailsQuery>
+ )}
+ </Messages>
)}
</Navigator>
);
diff --git a/saleor/static/dashboard-next/types/globalTypes.ts b/saleor/static/dashboard-next/types/globalTypes.ts
index 77add0af5f..cbc339fc8f 100644
--- a/saleor/static/dashboard-next/types/globalTypes.ts
+++ b/saleor/static/dashboard-next/types/globalTypes.ts
@@ -321,6 +321,18 @@ export interface AttributeValueInput {
value: string;
}
+export interface FulfillmentCreateInput {
+ order?: string | null;
+ trackingNumber?: string | null;
+ notifyCustomer?: boolean | null;
+ lines?: (FulfillmentLineInput | null)[] | null;
+}
+
+export interface FulfillmentLineInput {
+ orderLineId?: string | null;
+ quantity?: number | null;
+}
+
export interface ProductTypeInput {
name?: string | null;
hasVariants?: boolean | null;