Introduce fulfillment creation API (#1241)

* Display warehouse name for each fulfillment (#1259)

* Hide no-stocks columns in fulfillment view (#1260)

* Hide no-stocks columns in fulfillment view

* Update tests

* Refactor

* Update tests

* Add fulfillment settings card (#1242)

* Add fulfillment setting card

* Make fulfillment approvement naming consistent

* Fix mutation bug

* Update types

* Trigger CI

* Handle fulfillment acceptance on order details page (#1255)

* Handle fulfillment acceptance on order details page

* Make fulfillment approvement naming consistent

* Update fulfillment schema and its usage

* Render history events regarding waiting fulfillments (#1265)

* Add awaiting for approval fulfillment order event

* Fix warehouse name

* Change fulfillment quantity calculation (#1267)

* Change fulfillment quantity calculation

* Fix warehouse name

* Update messages

* Trigger CI

* Refactor

* Fix refactor

* Fix fulfillment for no variant

* Allow creating fulfillments waiting for acceptance (#1248)

* Fix fulfillment page style and typescript classname types perfomance issue

* Allow creating fulfillments waiting for acceptance

* Make fulfillment approvement naming consistent

* Update schema

* Add tooltip to fulfillment savebar

* Update unpaid fulfillment creation restriction

* Update fulfillment cration restriction

* Update test snapshots

* Add possibility to cancel "waiting" fulfillments (#1288)

* Allow to cancel waiting fulfillments

* Add delete button to fulfillment card

* Update test snapshots

* Handle waiting fulfillments on refund page (#1290)

* Handle waiting fulfillments on refund page

* Trigger CI

* Trigger CI

* Calculate quantity to refund on quantityToFulfill

* Update changelog

* Update snapshots

Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
This commit is contained in:
Dawid Tarasiuk 2021-08-20 16:36:05 +02:00 committed by GitHub
parent ab4c897b2a
commit 08637b27fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
87 changed files with 3193 additions and 1511 deletions

View file

@ -76,6 +76,8 @@ All notable, unreleased changes to this project will be documented in this file.
- Fixed navigation menu items reordering issue - #1239 by @kamilpastuszka - Fixed navigation menu items reordering issue - #1239 by @kamilpastuszka
- Fixed issue with modals containing invalid, redundant scrolls #1240 by @kamilpastuszka - Fixed issue with modals containing invalid, redundant scrolls #1240 by @kamilpastuszka
- Add text attribute for product and page translations - #1276 by @kamilpastuszka - Add text attribute for product and page translations - #1276 by @kamilpastuszka
- Add app dashboard extensions - #1292 by @jwm0
- Introduce fulfillment creation - #1241 by @orzechdev
# 2.11.1 # 2.11.1

View file

@ -536,6 +536,10 @@
"context": "button", "context": "button",
"string": "Accept" "string": "Accept"
}, },
"src_dot_approve": {
"context": "button",
"string": "Approve"
},
"src_dot_apps": { "src_dot_apps": {
"context": "apps section name", "context": "apps section name",
"string": "Apps" "string": "Apps"
@ -1302,6 +1306,10 @@
"context": "order status", "context": "order status",
"string": "Cancelled" "string": "Cancelled"
}, },
"src_dot_cannotFullfillUnpaidOrder": {
"context": "disabled option description",
"string": "Cant fulfill until payment is captured"
},
"src_dot_catalog": { "src_dot_catalog": {
"string": "Catalog" "string": "Catalog"
}, },
@ -3956,68 +3964,66 @@
"context": "button", "context": "button",
"string": "Finalize" "string": "Finalize"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_1608534452": { "src_dot_orders_dot_components_dot_OrderFulfillPage_dot_headerOrder": {
"context": "page header",
"string": "Order no. {orderNumber} - Add Fulfillment"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_2094985970": {
"context": "quantity of fulfilled products",
"string": "Quantity to fulfill"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_2095687440": {
"context": "fulfill order, button",
"string": "Fulfill"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_2588284040": {
"context": "no variant stock in warehouse",
"string": "No Stock"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_3244948255": {
"context": "header",
"string": "Items ready to ship"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_3620521256": {
"context": "page header", "context": "page header",
"string": "Order" "string": "Order"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_4046223826": { "src_dot_orders_dot_components_dot_OrderFulfillPage_dot_headerOrderNumber": {
"string": "Product name" "context": "page header",
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_4251997263": {
"context": "checkbox",
"string": "Send shipment details to customer"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_580490159": {
"context": "page header with order number",
"string": "Order #{orderNumber}" "string": "Order #{orderNumber}"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_693960049": { "src_dot_orders_dot_components_dot_OrderFulfillPage_dot_headerOrderNumberAddFulfillment": {
"context": "page header",
"string": "Order no. {orderNumber} - Add Fulfillment"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_itemsReadyToShip": {
"context": "header",
"string": "Items ready to ship"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_noStock": {
"context": "no variant stock in warehouse",
"string": "No Stock"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_productName": {
"context": "name",
"string": "Product name"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_quantityToFulfill": {
"context": "quantity of fulfilled products",
"string": "Quantity to fulfill"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_sentShipmentDetails": {
"context": "checkbox label",
"string": "Send shipment details to customer"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_sku": {
"context": "product's sku", "context": "product's sku",
"string": "SKU" "string": "SKU"
}, },
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_1119771899": { "src_dot_orders_dot_components_dot_OrderFulfillPage_dot_submitFulfillment": {
"context": "fulfill order, button",
"string": "Fulfill"
},
"src_dot_orders_dot_components_dot_OrderFulfillPage_dot_submitPrepareFulfillment": {
"context": "prepare order fulfillment, button",
"string": "Prepare fulfillment"
},
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_addTracking": {
"context": "add tracking button", "context": "add tracking button",
"string": "Add tracking" "string": "Add tracking"
}, },
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_2211099657": { "src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_editTracking": {
"context": "edit tracking button", "context": "edit tracking button",
"string": "Edit tracking" "string": "Edit tracking"
}, },
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_2845258362": {
"context": "refund button",
"string": "Refund"
},
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_3254150098": {
"string": "Tracking Number: {trackingNumber}"
},
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_732594284": {
"context": "button",
"string": "Cancel Fulfillment"
},
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_fulfilled": { "src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_fulfilled": {
"context": "fulfillment group", "context": "fulfillment group",
"string": "Fulfilled from: " "string": "Fulfilled from: "
}, },
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_refund": {
"context": "refund button",
"string": "Refund"
},
"src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_restocked": { "src_dot_orders_dot_components_dot_OrderFulfilledProductsCard_dot_restocked": {
"context": "restocked group", "context": "restocked group",
"string": "Restocked from: " "string": "Restocked from: "
@ -4026,6 +4032,18 @@
"context": "tracking number", "context": "tracking number",
"string": "Tracking Number: {trackingNumber}" "string": "Tracking Number: {trackingNumber}"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentApproveDialog_dot_description": {
"context": "dialog description",
"string": "Are you sure you want to approve this fullfillment?"
},
"src_dot_orders_dot_components_dot_OrderFulfillmentApproveDialog_dot_notifyCustomer": {
"context": "checkbox label, fulfillment approval",
"string": "Send shipment details to customer"
},
"src_dot_orders_dot_components_dot_OrderFulfillmentApproveDialog_dot_title": {
"context": "dialog header",
"string": "Approve this fulfillment"
},
"src_dot_orders_dot_components_dot_OrderFulfillmentCancelDialog_dot_1097287358": { "src_dot_orders_dot_components_dot_OrderFulfillmentCancelDialog_dot_1097287358": {
"string": "Are you sure you want to cancel fulfillment? Canceling a fulfillment will restock products at a selected warehouse." "string": "Are you sure you want to cancel fulfillment? Canceling a fulfillment will restock products at a selected warehouse."
}, },
@ -4037,24 +4055,25 @@
"context": "dialog header", "context": "dialog header",
"string": "Cancel Fulfillment" "string": "Cancel Fulfillment"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentDialog_dot_2796503714": { "src_dot_orders_dot_components_dot_OrderFulfillmentSettings_dot_1154699654": {
"context": "quantity of fulfilled products", "context": "checkbox label",
"string": "Quantity" "string": "Allow fulfillment without payment"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentDialog_dot_3123761129": { "src_dot_orders_dot_components_dot_OrderFulfillmentSettings_dot_2478368540": {
"context": "dialog header", "context": "checkbox label description",
"string": "Fulfill Products" "string": "All fulfillments will be automatically approved"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentDialog_dot_3252172269": { "src_dot_orders_dot_components_dot_OrderFulfillmentSettings_dot_3336812159": {
"context": "fulfillment group", "context": "checkbox label",
"string": "Tracking number" "string": "Automatically approve all fulfillments"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentDialog_dot_4046223826": { "src_dot_orders_dot_components_dot_OrderFulfillmentSettings_dot_3666602886": {
"string": "Product name" "context": "checkbox label description",
"string": "You will be able to fulfill products without capturing payment for the order."
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentDialog_dot_693960049": { "src_dot_orders_dot_components_dot_OrderFulfillmentSettings_dot_4200951094": {
"context": "product's sku", "context": "section header",
"string": "SKU" "string": "Fulfillment settings"
}, },
"src_dot_orders_dot_components_dot_OrderFulfillmentTrackingDialog_dot_3252172269": { "src_dot_orders_dot_components_dot_OrderFulfillmentTrackingDialog_dot_3252172269": {
"string": "Tracking number" "string": "Tracking number"
@ -4163,6 +4182,10 @@
"context": "order history message", "context": "order history message",
"string": "Products were added to an order" "string": "Products were added to an order"
}, },
"src_dot_orders_dot_components_dot_OrderHistory_dot_3854352507": {
"context": "order history message",
"string": "Fulfillment awaits approval"
},
"src_dot_orders_dot_components_dot_OrderHistory_dot_393045022": { "src_dot_orders_dot_components_dot_OrderHistory_dot_393045022": {
"context": "order history message", "context": "order history message",
"string": "Invoice no. {invoiceNumber} was updated" "string": "Invoice no. {invoiceNumber} was updated"
@ -4441,10 +4464,6 @@
"context": "order line total price", "context": "order line total price",
"string": "Total" "string": "Total"
}, },
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_1097582574": {
"context": "section header returned",
"string": "Fulfillment returned"
},
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_1134347598": { "src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_1134347598": {
"context": "tabel column header", "context": "tabel column header",
"string": "Price" "string": "Price"
@ -4464,10 +4483,6 @@
"context": "button", "context": "button",
"string": "Set maximal quantities" "string": "Set maximal quantities"
}, },
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_615325604": {
"context": "section header",
"string": "Fulfillment"
},
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_878013594": { "src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_878013594": {
"context": "tabel column header", "context": "tabel column header",
"string": "Total" "string": "Total"
@ -4476,6 +4491,18 @@
"context": "error message", "context": "error message",
"string": "Improper value" "string": "Improper value"
}, },
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_fulfillment": {
"context": "section header",
"string": "Fulfillment"
},
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_fulfillmentReturned": {
"context": "section header returned",
"string": "Fulfillment returned"
},
"src_dot_orders_dot_components_dot_OrderRefundFulfilledProducts_dot_fulfillmentWaitingForApproval": {
"context": "section header returned",
"string": "Fulfillment waiting for approval"
},
"src_dot_orders_dot_components_dot_OrderRefundPage_dot_194531545": { "src_dot_orders_dot_components_dot_OrderRefundPage_dot_194531545": {
"context": "page header", "context": "page header",
"string": "Order no. {orderNumber} - Refund" "string": "Order no. {orderNumber} - Refund"
@ -4651,6 +4678,10 @@
"context": "section header", "context": "section header",
"string": "Fulfilled ({quantity})" "string": "Fulfilled ({quantity})"
}, },
"src_dot_orders_dot_components_dot_OrderReturnPage_dot_OrderReturnRefundItemsCard_dot_fulfilledFrom": {
"context": "fulfilled fulfillment, section header",
"string": "Fulfilled from {warehouseName}"
},
"src_dot_orders_dot_components_dot_OrderReturnPage_dot_OrderReturnRefundItemsCard_dot_improperValue": { "src_dot_orders_dot_components_dot_OrderReturnPage_dot_OrderReturnRefundItemsCard_dot_improperValue": {
"context": "error message", "context": "error message",
"string": "Improper value" "string": "Improper value"
@ -4687,6 +4718,10 @@
"context": "section header", "context": "section header",
"string": "Unfulfilled" "string": "Unfulfilled"
}, },
"src_dot_orders_dot_components_dot_OrderReturnPage_dot_OrderReturnRefundItemsCard_dot_waitingForApproval": {
"context": "unapproved fulfillment, section header",
"string": "Waiting for approval ({quantity})"
},
"src_dot_orders_dot_components_dot_OrderReturnPage_dot_appTitle": { "src_dot_orders_dot_components_dot_OrderReturnPage_dot_appTitle": {
"context": "page header with order number", "context": "page header with order number",
"string": "Order #{orderNumber}" "string": "Order #{orderNumber}"
@ -4758,6 +4793,9 @@
"src_dot_orders_dot_views_dot_OrderDetails_dot_3367579693": { "src_dot_orders_dot_views_dot_OrderDetails_dot_3367579693": {
"string": "Order successfully updated" "string": "Order successfully updated"
}, },
"src_dot_orders_dot_views_dot_OrderDetails_dot_3897044696": {
"string": "Fulfillment successfully approved"
},
"src_dot_orders_dot_views_dot_OrderDetails_dot_4085755992": { "src_dot_orders_dot_views_dot_OrderDetails_dot_4085755992": {
"string": "Invoice email sent" "string": "Invoice email sent"
}, },

View file

@ -2144,6 +2144,13 @@ type Fulfillment implements Node & ObjectWithMetadata {
warehouse: Warehouse warehouse: Warehouse
} }
type FulfillmentApprove {
fulfillment: Fulfillment
order: Order
orderErrors: [OrderError!]! @deprecated(reason: "Use errors field instead. This field will be removed in Saleor 4.0.")
errors: [OrderError!]!
}
type FulfillmentCancel { type FulfillmentCancel {
fulfillment: Fulfillment fulfillment: Fulfillment
order: Order order: Order
@ -2184,6 +2191,7 @@ enum FulfillmentStatus {
REPLACED REPLACED
REFUNDED_AND_RETURNED REFUNDED_AND_RETURNED
CANCELED CANCELED
WAITING_FOR_APPROVAL
} }
type FulfillmentUpdateTracking { type FulfillmentUpdateTracking {
@ -3695,6 +3703,7 @@ type Mutation {
orderConfirm(id: ID!): OrderConfirm orderConfirm(id: ID!): OrderConfirm
orderFulfill(input: OrderFulfillInput!, order: ID): OrderFulfill orderFulfill(input: OrderFulfillInput!, order: ID): OrderFulfill
orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel
orderFulfillmentApprove(id: ID!, notifyCustomer: Boolean!): FulfillmentApprove
orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking
orderFulfillmentRefundProducts(input: OrderRefundProductsInput!, order: ID!): FulfillmentRefundProducts orderFulfillmentRefundProducts(input: OrderRefundProductsInput!, order: ID!): FulfillmentRefundProducts
orderFulfillmentReturnProducts(input: OrderReturnProductsInput!, order: ID!): FulfillmentReturnProducts orderFulfillmentReturnProducts(input: OrderReturnProductsInput!, order: ID!): FulfillmentReturnProducts
@ -4038,6 +4047,7 @@ enum OrderErrorCode {
CANNOT_DELETE CANNOT_DELETE
CANNOT_DISCOUNT CANNOT_DISCOUNT
CANNOT_REFUND CANNOT_REFUND
CANNOT_FULFILL_UNPAID_ORDER
CAPTURE_INACTIVE_PAYMENT CAPTURE_INACTIVE_PAYMENT
NOT_EDITABLE NOT_EDITABLE
FULFILL_ORDER_LINE FULFILL_ORDER_LINE
@ -4168,6 +4178,7 @@ enum OrderEventsEnum {
FULFILLMENT_REFUNDED FULFILLMENT_REFUNDED
FULFILLMENT_RETURNED FULFILLMENT_RETURNED
FULFILLMENT_REPLACED FULFILLMENT_REPLACED
FULFILLMENT_AWAITS_APPROVAL
TRACKING_UPDATED TRACKING_UPDATED
NOTE_ADDED NOTE_ADDED
OTHER OTHER
@ -4226,6 +4237,7 @@ type OrderLine implements Node {
translatedProductName: String! translatedProductName: String!
translatedVariantName: String! translatedVariantName: String!
allocations: [Allocation!] allocations: [Allocation!]
quantityToFulfill: Int!
unitDiscountType: DiscountValueTypeEnum unitDiscountType: DiscountValueTypeEnum
} }
@ -6146,6 +6158,8 @@ type Shop {
phonePrefixes: [String]! phonePrefixes: [String]!
headerText: String headerText: String
includeTaxesInPrices: Boolean! includeTaxesInPrices: Boolean!
fulfillmentAutoApprove: Boolean!
fulfillmentAllowUnpaid: Boolean!
displayGrossPrices: Boolean! displayGrossPrices: Boolean!
chargeTaxesOnShipping: Boolean! chargeTaxesOnShipping: Boolean!
trackInventoryByDefault: Boolean trackInventoryByDefault: Boolean
@ -6204,6 +6218,8 @@ input ShopSettingsInput {
trackInventoryByDefault: Boolean trackInventoryByDefault: Boolean
defaultWeightUnit: WeightUnitsEnum defaultWeightUnit: WeightUnitsEnum
automaticFulfillmentDigitalProducts: Boolean automaticFulfillmentDigitalProducts: Boolean
fulfillmentAutoApprove: Boolean
fulfillmentAllowUnpaid: Boolean
defaultDigitalMaxDownloads: Int defaultDigitalMaxDownloads: Int
defaultDigitalUrlValidDays: Int defaultDigitalUrlValidDays: Int
defaultMailSenderName: String defaultMailSenderName: String

View file

@ -0,0 +1,23 @@
import { Tooltip } from "@material-ui/core";
import React from "react";
interface ButtonTooltipDecoratorProps {
tooltip?: string;
}
export const ButtonTooltipDecorator: React.FC<ButtonTooltipDecoratorProps> = ({
tooltip,
children
}) => {
if (tooltip) {
return (
<Tooltip title={tooltip} placement="top">
<span>{children}</span>
</Tooltip>
);
}
return <>{children}</>;
};
ButtonTooltipDecorator.displayName = "ButtonTooltipDecorator";
export default ButtonTooltipDecorator;

View file

@ -29,7 +29,8 @@ export const useStyles = makeStyles(
textContainer: { textContainer: {
marginLeft: theme.spacing(1), marginLeft: theme.spacing(1),
display: "flex", display: "flex",
flexDirection: "column" flexDirection: "column",
width: "100%"
}, },
dotVertical: { dotVertical: {
marginTop: theme.spacing(1) marginTop: theme.spacing(1)

View file

@ -81,6 +81,7 @@ export const fragmentOrderLine = gql`
productSku productSku
quantity quantity
quantityFulfilled quantityFulfilled
quantityToFulfill
unitDiscount { unitDiscount {
amount amount
currency currency
@ -200,6 +201,7 @@ export const fragmentOrderDetails = gql`
...OrderLineFragment ...OrderLineFragment
} }
number number
isPaid
paymentStatus paymentStatus
shippingAddress { shippingAddress {
...AddressFragment ...AddressFragment
@ -280,3 +282,10 @@ export const fragmentOrderSettings = gql`
automaticallyConfirmAllNewOrders automaticallyConfirmAllNewOrders
} }
`; `;
export const fragmentShopOrderSettings = gql`
fragment ShopOrderSettingsFragment on Shop {
fulfillmentAutoApprove
fulfillmentAllowUnpaid
}
`;

View file

@ -72,6 +72,7 @@ export interface FulfillmentFragment_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: FulfillmentFragment_lines_orderLine_unitDiscount; unitDiscount: FulfillmentFragment_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;

View file

@ -216,6 +216,7 @@ export interface OrderDetailsFragment_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDetailsFragment_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDetailsFragment_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -311,6 +312,7 @@ export interface OrderDetailsFragment_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDetailsFragment_lines_unitDiscount; unitDiscount: OrderDetailsFragment_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -483,6 +485,7 @@ export interface OrderDetailsFragment {
fulfillments: (OrderDetailsFragment_fulfillments | null)[]; fulfillments: (OrderDetailsFragment_fulfillments | null)[];
lines: (OrderDetailsFragment_lines | null)[]; lines: (OrderDetailsFragment_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDetailsFragment_shippingAddress | null; shippingAddress: OrderDetailsFragment_shippingAddress | null;
shippingMethod: OrderDetailsFragment_shippingMethod | null; shippingMethod: OrderDetailsFragment_shippingMethod | null;
@ -500,5 +503,4 @@ export interface OrderDetailsFragment {
availableShippingMethods: (OrderDetailsFragment_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDetailsFragment_availableShippingMethods | null)[] | null;
invoices: (OrderDetailsFragment_invoices | null)[] | null; invoices: (OrderDetailsFragment_invoices | null)[] | null;
channel: OrderDetailsFragment_channel; channel: OrderDetailsFragment_channel;
isPaid: boolean;
} }

View file

@ -72,6 +72,7 @@ export interface OrderLineFragment {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineFragment_unitDiscount; unitDiscount: OrderLineFragment_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;

View file

@ -0,0 +1,14 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
// ====================================================
// GraphQL fragment: ShopOrderSettingsFragment
// ====================================================
export interface ShopOrderSettingsFragment {
__typename: "Shop";
fulfillmentAutoApprove: boolean;
fulfillmentAllowUnpaid: boolean;
}

View file

@ -121,6 +121,10 @@ export const commonMessages = defineMessages({
time: { time: {
defaultMessage: "Time", defaultMessage: "Time",
description: "independent of any particular day, eg. 11:35" description: "independent of any particular day, eg. 11:35"
},
cannotFullfillUnpaidOrder: {
defaultMessage: "Cant fulfill until payment is captured",
description: "disabled option description"
} }
}); });
@ -139,6 +143,10 @@ export const buttonMessages = defineMessages({
defaultMessage: "Accept", defaultMessage: "Accept",
description: "button" description: "button"
}, },
approve: {
defaultMessage: "Approve",
description: "button"
},
back: { back: {
defaultMessage: "Back", defaultMessage: "Back",
description: "button" description: "button"

View file

@ -23,7 +23,10 @@ import { defineMessages, useIntl } from "react-intl";
import { maybe } from "../../../misc"; import { maybe } from "../../../misc";
import { OrderStatus } from "../../../types/globalTypes"; import { OrderStatus } from "../../../types/globalTypes";
import { OrderDetails_order } from "../../types/OrderDetails"; import {
OrderDetails_order,
OrderDetails_shop
} from "../../types/OrderDetails";
import OrderCustomer from "../OrderCustomer"; import OrderCustomer from "../OrderCustomer";
import OrderCustomerNote from "../OrderCustomerNote"; import OrderCustomerNote from "../OrderCustomerNote";
import OrderDraftDetails from "../OrderDraftDetails/OrderDraftDetails"; import OrderDraftDetails from "../OrderDraftDetails/OrderDraftDetails";
@ -54,6 +57,7 @@ const useStyles = makeStyles(
export interface OrderDetailsPageProps extends UserPermissionProps { export interface OrderDetailsPageProps extends UserPermissionProps {
order: OrderDetails_order; order: OrderDetails_order;
shop: OrderDetails_shop;
shippingMethods?: Array<{ shippingMethods?: Array<{
id: string; id: string;
name: string; name: string;
@ -69,6 +73,7 @@ export interface OrderDetailsPageProps extends UserPermissionProps {
onShippingMethodEdit?: () => void; onShippingMethodEdit?: () => void;
onBack(); onBack();
onBillingAddressEdit(); onBillingAddressEdit();
onFulfillmentApprove(id: string);
onFulfillmentCancel(id: string); onFulfillmentCancel(id: string);
onFulfillmentTrackingNumberUpdate(id: string); onFulfillmentTrackingNumberUpdate(id: string);
onOrderFulfill(); onOrderFulfill();
@ -107,10 +112,12 @@ const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {
const { const {
disabled, disabled,
order, order,
shop,
saveButtonBarState, saveButtonBarState,
userPermissions, userPermissions,
onBack, onBack,
onBillingAddressEdit, onBillingAddressEdit,
onFulfillmentApprove,
onFulfillmentCancel, onFulfillmentCancel,
onFulfillmentTrackingNumberUpdate, onFulfillmentTrackingNumberUpdate,
onNoteAdd, onNoteAdd,
@ -146,8 +153,12 @@ const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {
const canCancel = order?.status !== OrderStatus.CANCELED; const canCancel = order?.status !== OrderStatus.CANCELED;
const canEditAddresses = order?.status !== OrderStatus.CANCELED; const canEditAddresses = order?.status !== OrderStatus.CANCELED;
const canFulfill = order?.status !== OrderStatus.CANCELED; const canFulfill = order?.status !== OrderStatus.CANCELED;
const notAllowedToFulfillUnpaid =
shop?.fulfillmentAutoApprove &&
!shop?.fulfillmentAllowUnpaid &&
!order?.isPaid;
const unfulfilled = (order?.lines || []).filter( const unfulfilled = (order?.lines || []).filter(
line => line.quantityFulfilled < line.quantity line => line.quantityToFulfill > 0
); );
const handleSubmit = async (data: MetadataFormData) => { const handleSubmit = async (data: MetadataFormData) => {
@ -229,7 +240,8 @@ const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {
<div data-test-id="orderFulfillment"> <div data-test-id="orderFulfillment">
{!isOrderUnconfirmed ? ( {!isOrderUnconfirmed ? (
<OrderUnfulfilledProductsCard <OrderUnfulfilledProductsCard
canFulfill={canFulfill} showFulfillmentAction={canFulfill}
notAllowedToFulfillUnpaid={notAllowedToFulfillUnpaid}
lines={unfulfilled} lines={unfulfilled}
onFulfill={onOrderFulfill} onFulfill={onOrderFulfill}
/> />
@ -249,7 +261,8 @@ const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {
<React.Fragment key={fulfillment.id}> <React.Fragment key={fulfillment.id}>
<OrderFulfilledProductsCard <OrderFulfilledProductsCard
fulfillment={fulfillment} fulfillment={fulfillment}
orderNumber={order.number} fulfillmentAllowUnpaid={shop?.fulfillmentAllowUnpaid}
order={order}
onOrderFulfillmentCancel={() => onOrderFulfillmentCancel={() =>
onFulfillmentCancel(fulfillment.id) onFulfillmentCancel(fulfillment.id)
} }
@ -257,6 +270,9 @@ const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {
onFulfillmentTrackingNumberUpdate(fulfillment.id) onFulfillmentTrackingNumberUpdate(fulfillment.id)
} }
onRefund={onPaymentRefund} onRefund={onPaymentRefund}
onOrderFulfillmentApprove={() =>
onFulfillmentApprove(fulfillment.id)
}
/> />
</React.Fragment> </React.Fragment>
))} ))}

View file

@ -9,6 +9,7 @@ import {
Typography Typography
} from "@material-ui/core"; } from "@material-ui/core";
import { CSSProperties } from "@material-ui/styles"; import { CSSProperties } from "@material-ui/styles";
import { drawerWidthExpanded } from "@saleor/components/AppLayout/consts";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
import Container from "@saleor/components/Container"; import Container from "@saleor/components/Container";
@ -19,8 +20,10 @@ import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Savebar from "@saleor/components/Savebar"; import Savebar from "@saleor/components/Savebar";
import Skeleton from "@saleor/components/Skeleton"; import Skeleton from "@saleor/components/Skeleton";
import TableCellAvatar from "@saleor/components/TableCellAvatar"; import TableCellAvatar from "@saleor/components/TableCellAvatar";
import { ShopOrderSettingsFragment } from "@saleor/fragments/types/ShopOrderSettingsFragment";
import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment"; import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment";
import useFormset, { FormsetData } from "@saleor/hooks/useFormset"; import useFormset, { FormsetData } from "@saleor/hooks/useFormset";
import { commonMessages } from "@saleor/intl";
import { Backlink } from "@saleor/macaw-ui"; import { Backlink } from "@saleor/macaw-ui";
import { makeStyles } from "@saleor/macaw-ui"; import { makeStyles } from "@saleor/macaw-ui";
import { renderCollection } from "@saleor/misc"; import { renderCollection } from "@saleor/misc";
@ -29,29 +32,17 @@ import {
OrderFulfillData_order, OrderFulfillData_order,
OrderFulfillData_order_lines OrderFulfillData_order_lines
} from "@saleor/orders/types/OrderFulfillData"; } from "@saleor/orders/types/OrderFulfillData";
import { import { getToFulfillOrderLines } from "@saleor/orders/utils/data";
OrderErrorCode, import { isStockError } from "@saleor/orders/utils/data";
OrderFulfillStockInput import { OrderFulfillStockInput } from "@saleor/types/globalTypes";
} from "@saleor/types/globalTypes";
import { update } from "@saleor/utils/lists"; import { update } from "@saleor/utils/lists";
import classNames from "classnames"; import classNames from "classnames";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
type ClassKey = import { messages } from "./messages";
| "actionBar"
| "table" const useStyles = makeStyles(
| "colName"
| "colQuantity"
| "colQuantityHeader"
| "colQuantityTotal"
| "colSku"
| "error"
| "full"
| "quantityInnerInput"
| "quantityInnerInputNoRemaining"
| "remainingQuantity";
const useStyles = makeStyles<OrderFulfillPageProps, ClassKey>(
theme => { theme => {
const inputPadding: CSSProperties = { const inputPadding: CSSProperties = {
paddingBottom: theme.spacing(2), paddingBottom: theme.spacing(2),
@ -59,14 +50,9 @@ const useStyles = makeStyles<OrderFulfillPageProps, ClassKey>(
}; };
return { return {
[theme.breakpoints.up("lg")]: { container: {
colName: { [theme.breakpoints.up("md")]: {
width: ({ warehouses }) => (warehouses?.length > 3 ? 250 : "auto") width: `calc(100vw - ${drawerWidthExpanded}px)`
}
},
[theme.breakpoints.only("md")]: {
colName: {
width: ({ warehouses }) => (warehouses?.length > 2 ? 250 : "auto")
} }
}, },
actionBar: { actionBar: {
@ -74,7 +60,15 @@ const useStyles = makeStyles<OrderFulfillPageProps, ClassKey>(
paddingLeft: `calc(${theme.spacing(2)} + 2px)` paddingLeft: `calc(${theme.spacing(2)} + 2px)`
}, },
colName: { colName: {
width: 250 width: 250,
[theme.breakpoints.up("lg")]: {
width: ({ warehouses }: OrderFulfillPageProps) =>
warehouses?.length > 3 ? 250 : "auto"
},
[theme.breakpoints.only("md")]: {
width: ({ warehouses }: OrderFulfillPageProps) =>
warehouses?.length > 2 ? 250 : "auto"
}
}, },
colQuantity: { colQuantity: {
textAlign: "right", textAlign: "right",
@ -131,6 +125,7 @@ export interface OrderFulfillPageProps {
order: OrderFulfillData_order; order: OrderFulfillData_order;
saveButtonBar: ConfirmButtonTransitionState; saveButtonBar: ConfirmButtonTransitionState;
warehouses: WarehouseFragment[]; warehouses: WarehouseFragment[];
shopSettings?: ShopOrderSettingsFragment;
onBack: () => void; onBack: () => void;
onSubmit: (data: OrderFulfillSubmitData) => void; onSubmit: (data: OrderFulfillSubmitData) => void;
} }
@ -139,10 +134,6 @@ const initialFormData: OrderFulfillFormData = {
sendInfo: true sendInfo: true
}; };
function getRemainingQuantity(line: OrderFulfillData_order_lines): number {
return line.quantity - line.quantityFulfilled;
}
const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => { const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
const { const {
loading, loading,
@ -150,6 +141,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
order, order,
saveButtonBar, saveButtonBar,
warehouses, warehouses,
shopSettings,
onBack, onBack,
onSubmit onSubmit
} = props; } = props;
@ -161,23 +153,21 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
null, null,
OrderFulfillStockInput[] OrderFulfillStockInput[]
>( >(
order?.lines getToFulfillOrderLines(order?.lines).map(line => ({
.filter(line => getRemainingQuantity(line) > 0) data: null,
.map(line => ({ id: line.id,
data: null, label: line.variant?.attributes
id: line.id, .map(attribute =>
label: line.variant.attributes attribute.values
.map(attribute => .map(attributeValue => attributeValue.name)
attribute.values .join(" , ")
.map(attributeValue => attributeValue.name) )
.join(" , ") .join(" / "),
) value: line.variant?.stocks?.map(stock => ({
.join(" / "), quantity: 0,
value: line.variant.stocks.map(stock => ({ warehouse: stock.warehouse.id
quantity: 0,
warehouse: stock.warehouse.id
}))
})) }))
}))
); );
const handleSubmit = (formData: OrderFulfillFormData) => const handleSubmit = (formData: OrderFulfillFormData) =>
@ -186,110 +176,71 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
items: formsetData items: formsetData
}); });
const notAllowedToFulfillUnpaid =
shopSettings?.fulfillmentAutoApprove &&
!shopSettings?.fulfillmentAllowUnpaid &&
!order?.isPaid;
const shouldEnableSave = () => { const shouldEnableSave = () => {
if (!order || loading) { if (!order || loading) {
return false; return false;
} }
const isAtLeastOneFulfilled = formsetData.some(({ value }) => if (notAllowedToFulfillUnpaid) {
value.some(({ quantity }) => quantity > 0) return false;
}
const isAtLeastOneFulfilled = formsetData?.some(({ value }) =>
value?.some(({ quantity }) => quantity > 0)
); );
const areProperlyFulfilled = formsetData.every(({ id, value }) => { const areProperlyFulfilled = formsetData?.every(({ id, value }) => {
const { lines } = order; const { lines } = order;
const { quantity, quantityFulfilled } = lines.find( const { quantityToFulfill } = lines.find(
({ id: lineId }) => lineId === id ({ id: lineId }) => lineId === id
); );
const remainingQuantity = quantity - quantityFulfilled; const formQuantityFulfilled = value?.reduce(
const formQuantityFulfilled = value.reduce(
(result, { quantity }) => result + quantity, (result, { quantity }) => result + quantity,
0 0
); );
return formQuantityFulfilled <= remainingQuantity; return formQuantityFulfilled <= quantityToFulfill;
}); });
return isAtLeastOneFulfilled && areProperlyFulfilled; return isAtLeastOneFulfilled && areProperlyFulfilled;
}; };
const isStockError = (
overfulfill: boolean,
formsetStock: { quantity: number },
availableQuantity: number,
warehouse: WarehouseFragment,
line: OrderFulfillData_order_lines,
errors: FulfillOrder_orderFulfill_errors[]
) => {
if (overfulfill) {
return true;
}
const isQuantityLargerThanAvailable =
line.variant.trackInventory && formsetStock.quantity > availableQuantity;
const isError = !!errors?.find(
err =>
err.warehouse === warehouse.id &&
err.orderLines.find((id: string) => id === line.id) &&
err.code === OrderErrorCode.INSUFFICIENT_STOCK
);
return isQuantityLargerThanAvailable || isError;
};
return ( return (
<Container> <Container className={classes.container}>
<Backlink onClick={onBack}> <Backlink onClick={onBack}>
{order?.number {order?.number
? intl.formatMessage( ? intl.formatMessage(messages.headerOrderNumber, {
{ orderNumber: order.number
defaultMessage: "Order #{orderNumber}", })
description: "page header with order number" : intl.formatMessage(messages.headerOrder)}
},
{
orderNumber: order.number
}
)
: intl.formatMessage({
defaultMessage: "Order",
description: "page header"
})}
</Backlink> </Backlink>
<PageHeader <PageHeader
title={intl.formatMessage( title={intl.formatMessage(messages.headerOrderNumberAddFulfillment, {
{ orderNumber: order?.number
defaultMessage: "Order no. {orderNumber} - Add Fulfillment", })}
description: "page header"
},
{
orderNumber: order?.number
}
)}
/> />
<Form initial={initialFormData} onSubmit={handleSubmit}> <Form initial={initialFormData} onSubmit={handleSubmit}>
{({ change, data, submit }) => ( {({ change, data, submit }) => (
<> <>
<Card> <Card>
<CardTitle <CardTitle
title={intl.formatMessage({ title={intl.formatMessage(messages.itemsReadyToShip)}
defaultMessage: "Items ready to ship",
description: "header"
})}
/> />
<ResponsiveTable className={classes.table}> <ResponsiveTable className={classes.table}>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell className={classes.colName}> <TableCell className={classes.colName}>
<FormattedMessage defaultMessage="Product name" /> <FormattedMessage {...messages.productName} />
</TableCell> </TableCell>
<TableCell className={classes.colSku}> <TableCell className={classes.colSku}>
<FormattedMessage <FormattedMessage {...messages.sku} />
defaultMessage="SKU"
description="product's sku"
/>
</TableCell> </TableCell>
{warehouses?.map(warehouse => ( {warehouses?.map(warehouse => (
<TableCell <TableCell
@ -303,16 +254,13 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
</TableCell> </TableCell>
))} ))}
<TableCell className={classes.colQuantityTotal}> <TableCell className={classes.colQuantityTotal}>
<FormattedMessage <FormattedMessage {...messages.quantityToFulfill} />
defaultMessage="Quantity to fulfill"
description="quantity of fulfilled products"
/>
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{renderCollection( {renderCollection(
order?.lines.filter(line => getRemainingQuantity(line) > 0), getToFulfillOrderLines(order?.lines),
(line: OrderFulfillData_order_lines, lineIndex) => { (line: OrderFulfillData_order_lines, lineIndex) => {
if (!line) { if (!line) {
return ( return (
@ -339,10 +287,10 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
); );
} }
const remainingQuantity = getRemainingQuantity(line); const remainingQuantity = line.quantityToFulfill;
const quantityToFulfill = formsetData[ const quantityToFulfill = formsetData[
lineIndex lineIndex
].value.reduce( ].value?.reduce(
(quantityToFulfill, lineInput) => (quantityToFulfill, lineInput) =>
quantityToFulfill + (lineInput.quantity || 0), quantityToFulfill + (lineInput.quantity || 0),
0 0
@ -357,20 +305,20 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
> >
{line.productName} {line.productName}
<Typography color="textSecondary" variant="caption"> <Typography color="textSecondary" variant="caption">
{line.variant.attributes {line.variant?.attributes
.map(attribute => ?.map(attribute =>
attribute.values attribute.values
.map(attributeValue => attributeValue.name) .map(attributeValue => attributeValue.name)
.join(", ") .join(", ")
) )
.join(" / ")} ?.join(" / ")}
</Typography> </Typography>
</TableCellAvatar> </TableCellAvatar>
<TableCell className={classes.colSku}> <TableCell className={classes.colSku}>
{line.variant.sku} {line.variant?.sku}
</TableCell> </TableCell>
{warehouses?.map(warehouse => { {warehouses?.map(warehouse => {
const warehouseStock = line.variant.stocks.find( const warehouseStock = line.variant?.stocks?.find(
stock => stock.warehouse.id === warehouse.id stock => stock.warehouse.id === warehouse.id
); );
const formsetStock = formsetData[ const formsetStock = formsetData[
@ -388,10 +336,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
classes.error classes.error
)} )}
> >
<FormattedMessage <FormattedMessage {...messages.noStock} />
defaultMessage="No Stock"
description="no variant stock in warehouse"
/>
</TableCell> </TableCell>
); );
} }
@ -491,27 +436,30 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
)} )}
</TableBody> </TableBody>
</ResponsiveTable> </ResponsiveTable>
<CardActions className={classes.actionBar}> {shopSettings?.fulfillmentAutoApprove && (
<ControlledCheckbox <CardActions className={classes.actionBar}>
checked={data.sendInfo} <ControlledCheckbox
label={intl.formatMessage({ checked={data.sendInfo}
defaultMessage: "Send shipment details to customer", label={intl.formatMessage(messages.sentShipmentDetails)}
description: "checkbox" name="sendInfo"
})} onChange={change}
name="sendInfo" />
onChange={change} </CardActions>
/> )}
</CardActions>
</Card> </Card>
<Savebar <Savebar
disabled={!shouldEnableSave()} disabled={!shouldEnableSave()}
labels={{ labels={{
confirm: intl.formatMessage({ confirm: shopSettings?.fulfillmentAutoApprove
defaultMessage: "Fulfill", ? intl.formatMessage(messages.submitFulfillment)
description: "fulfill order, button" : intl.formatMessage(messages.submitPrepareFulfillment)
})
}} }}
state={saveButtonBar} state={saveButtonBar}
tooltips={{
confirm:
notAllowedToFulfillUnpaid &&
intl.formatMessage(commonMessages.cannotFullfillUnpaidOrder)
}}
onSubmit={submit} onSubmit={submit}
onCancel={onBack} onCancel={onBack}
/> />

View file

@ -7,6 +7,7 @@ import { warehouseList } from "@saleor/warehouses/fixtures";
export const orderToFulfill: OrderFulfillData_order = { export const orderToFulfill: OrderFulfillData_order = {
__typename: "Order", __typename: "Order",
id: "T3JkZXI6Mg==", id: "T3JkZXI6Mg==",
isPaid: true,
lines: [ lines: [
{ {
__typename: "OrderLine", __typename: "OrderLine",
@ -16,6 +17,7 @@ export const orderToFulfill: OrderFulfillData_order = {
productName: "T-Shirt", productName: "T-Shirt",
quantity: 3, quantity: 3,
quantityFulfilled: 1, quantityFulfilled: 1,
quantityToFulfill: 2,
variant: { variant: {
__typename: "ProductVariant", __typename: "ProductVariant",
id: "UHJvZHVjdFZhcmlhbnQ6Mjk2", id: "UHJvZHVjdFZhcmlhbnQ6Mjk2",
@ -78,6 +80,7 @@ export const orderToFulfill: OrderFulfillData_order = {
productName: "Lemon Juice", productName: "Lemon Juice",
quantity: 4, quantity: 4,
quantityFulfilled: 0, quantityFulfilled: 0,
quantityToFulfill: 4,
variant: { variant: {
__typename: "ProductVariant", __typename: "ProductVariant",
id: "UHJvZHVjdFZhcmlhbnQ6MTgx", id: "UHJvZHVjdFZhcmlhbnQ6MTgx",
@ -133,6 +136,7 @@ export const orderToFulfill: OrderFulfillData_order = {
productName: "Orange Juice", productName: "Orange Juice",
quantity: 3, quantity: 3,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 1,
variant: { variant: {
__typename: "ProductVariant", __typename: "ProductVariant",
id: "UHJvZHVjdFZhcmlhbnQ6MTgy", id: "UHJvZHVjdFZhcmlhbnQ6MTgy",

View file

@ -0,0 +1,48 @@
import { defineMessages } from "react-intl";
export const messages = defineMessages({
headerOrder: {
defaultMessage: "Order",
description: "page header"
},
headerOrderNumber: {
defaultMessage: "Order #{orderNumber}",
description: "page header"
},
headerOrderNumberAddFulfillment: {
defaultMessage: "Order no. {orderNumber} - Add Fulfillment",
description: "page header"
},
submitFulfillment: {
defaultMessage: "Fulfill",
description: "fulfill order, button"
},
submitPrepareFulfillment: {
defaultMessage: "Prepare fulfillment",
description: "prepare order fulfillment, button"
},
itemsReadyToShip: {
defaultMessage: "Items ready to ship",
description: "header"
},
productName: {
defaultMessage: "Product name",
description: "name"
},
sku: {
defaultMessage: "SKU",
description: "product's sku"
},
quantityToFulfill: {
defaultMessage: "Quantity to fulfill",
description: "quantity of fulfilled products"
},
noStock: {
defaultMessage: "No Stock",
description: "no variant stock in warehouse"
},
sentShipmentDetails: {
defaultMessage: "Send shipment details to customer",
description: "checkbox label"
}
});

View file

@ -1,25 +1,35 @@
import { Button, CardActions } from "@material-ui/core"; import { Button, CardActions, Typography } from "@material-ui/core";
import { buttonMessages, commonMessages } from "@saleor/intl";
import { FulfillmentStatus } from "@saleor/types/globalTypes"; import { FulfillmentStatus } from "@saleor/types/globalTypes";
import React from "react"; import React from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { actionButtonsMessages } from "./messages";
interface AcionButtonsProps { interface AcionButtonsProps {
status: FulfillmentStatus; status: FulfillmentStatus;
trackingNumber?: string; trackingNumber?: string;
orderIsPaid?: boolean;
fulfillmentAllowUnpaid: boolean;
onTrackingCodeAdd(); onTrackingCodeAdd();
onRefund(); onRefund();
onApprove();
} }
const statusesToShow = [ const statusesToShow = [
FulfillmentStatus.FULFILLED, FulfillmentStatus.FULFILLED,
FulfillmentStatus.RETURNED FulfillmentStatus.RETURNED,
FulfillmentStatus.WAITING_FOR_APPROVAL
]; ];
const ActionButtons: React.FC<AcionButtonsProps> = ({ const ActionButtons: React.FC<AcionButtonsProps> = ({
status, status,
onTrackingCodeAdd,
trackingNumber, trackingNumber,
onRefund orderIsPaid,
fulfillmentAllowUnpaid,
onTrackingCodeAdd,
onRefund,
onApprove
}) => { }) => {
const hasTrackingNumber = !!trackingNumber; const hasTrackingNumber = !!trackingNumber;
@ -27,14 +37,28 @@ const ActionButtons: React.FC<AcionButtonsProps> = ({
return null; return null;
} }
if (status === FulfillmentStatus.WAITING_FOR_APPROVAL) {
const cannotFulfill = !orderIsPaid && !fulfillmentAllowUnpaid;
return (
<CardActions>
<Button color="primary" onClick={onApprove} disabled={cannotFulfill}>
<FormattedMessage {...buttonMessages.approve} />
</Button>
{cannotFulfill && (
<Typography color="error" variant="caption">
<FormattedMessage {...commonMessages.cannotFullfillUnpaidOrder} />
</Typography>
)}
</CardActions>
);
}
if (status === FulfillmentStatus.RETURNED) { if (status === FulfillmentStatus.RETURNED) {
return ( return (
<CardActions> <CardActions>
<Button color="primary" onClick={onRefund}> <Button color="primary" onClick={onRefund}>
<FormattedMessage <FormattedMessage {...actionButtonsMessages.refund} />
defaultMessage="Refund"
description="refund button"
/>
</Button> </Button>
</CardActions> </CardActions>
); );
@ -43,19 +67,13 @@ const ActionButtons: React.FC<AcionButtonsProps> = ({
return hasTrackingNumber ? ( return hasTrackingNumber ? (
<CardActions> <CardActions>
<Button color="primary" onClick={onTrackingCodeAdd}> <Button color="primary" onClick={onTrackingCodeAdd}>
<FormattedMessage <FormattedMessage {...actionButtonsMessages.editTracking} />
defaultMessage="Edit tracking"
description="edit tracking button"
/>
</Button> </Button>
</CardActions> </CardActions>
) : ( ) : (
<CardActions> <CardActions>
<Button color="primary" onClick={onTrackingCodeAdd}> <Button color="primary" onClick={onTrackingCodeAdd}>
<FormattedMessage <FormattedMessage {...actionButtonsMessages.addTracking} />
defaultMessage="Add tracking"
description="add tracking button"
/>
</Button> </Button>
</CardActions> </CardActions>
); );

View file

@ -4,10 +4,11 @@ import { getStringOrPlaceholder } from "@saleor/misc";
import { FulfillmentStatus } from "@saleor/types/globalTypes"; import { FulfillmentStatus } from "@saleor/types/globalTypes";
import classNames from "classnames"; import classNames from "classnames";
import React from "react"; import React from "react";
import { defineMessages, useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { OrderDetails_order_fulfillments } from "../../types/OrderDetails"; import { OrderDetails_order_fulfillments } from "../../types/OrderDetails";
import { extraInfoMessages } from "./messages";
const useStyles = makeStyles( const useStyles = makeStyles(
theme => ({ theme => ({
@ -24,21 +25,6 @@ const useStyles = makeStyles(
{ name: "ExtraInfoLines" } { name: "ExtraInfoLines" }
); );
const messages = defineMessages({
fulfilled: {
defaultMessage: "Fulfilled from: ",
description: "fulfillment group"
},
restocked: {
defaultMessage: "Restocked from: ",
description: "restocked group"
},
tracking: {
defaultMessage: "Tracking Number: {trackingNumber}",
description: "tracking number"
}
});
const NUMBER_OF_COLUMNS = 5; const NUMBER_OF_COLUMNS = 5;
interface ExtraInfoLinesProps { interface ExtraInfoLinesProps {
@ -63,8 +49,8 @@ const ExtraInfoLines: React.FC<ExtraInfoLinesProps> = ({ fulfillment }) => {
<> <>
{intl.formatMessage( {intl.formatMessage(
status === FulfillmentStatus.RETURNED status === FulfillmentStatus.RETURNED
? messages.restocked ? extraInfoMessages.restocked
: messages.fulfilled : extraInfoMessages.fulfilled
)} )}
<Typography <Typography
className={classNames(classes.infoLabel, { className={classNames(classes.infoLabel, {
@ -81,7 +67,7 @@ const ExtraInfoLines: React.FC<ExtraInfoLinesProps> = ({ fulfillment }) => {
<Typography color="textSecondary" variant="body2"> <Typography color="textSecondary" variant="body2">
{trackingNumber && ( {trackingNumber && (
<FormattedMessage <FormattedMessage
defaultMessage="Tracking Number: {trackingNumber}" {...extraInfoMessages.tracking}
values={{ values={{
trackingNumber: ( trackingNumber: (
<Typography <Typography

View file

@ -1,13 +1,13 @@
import { Card, TableBody } from "@material-ui/core"; import { Card, IconButton, TableBody } from "@material-ui/core";
import CardMenu from "@saleor/components/CardMenu";
import CardSpacer from "@saleor/components/CardSpacer"; import CardSpacer from "@saleor/components/CardSpacer";
import ResponsiveTable from "@saleor/components/ResponsiveTable"; import ResponsiveTable from "@saleor/components/ResponsiveTable";
import { OrderDetailsFragment } from "@saleor/fragments/types/OrderDetailsFragment";
import TrashIcon from "@saleor/icons/Trash";
import { makeStyles } from "@saleor/macaw-ui"; import { makeStyles } from "@saleor/macaw-ui";
import { mergeRepeatedOrderLines } from "@saleor/orders/utils/data"; import { mergeRepeatedOrderLines } from "@saleor/orders/utils/data";
import React from "react"; import React from "react";
import { useIntl } from "react-intl";
import { maybe, renderCollection } from "../../../misc"; import { renderCollection } from "../../../misc";
import { FulfillmentStatus } from "../../../types/globalTypes"; import { FulfillmentStatus } from "../../../types/globalTypes";
import { OrderDetails_order_fulfillments } from "../../types/OrderDetails"; import { OrderDetails_order_fulfillments } from "../../types/OrderDetails";
import TableHeader from "../OrderProductsCardElements/OrderProductsCardHeader"; import TableHeader from "../OrderProductsCardElements/OrderProductsCardHeader";
@ -17,9 +17,15 @@ import ActionButtons from "./ActionButtons";
import ExtraInfoLines from "./ExtraInfoLines"; import ExtraInfoLines from "./ExtraInfoLines";
const useStyles = makeStyles( const useStyles = makeStyles(
() => ({ theme => ({
table: { table: {
tableLayout: "fixed" tableLayout: "fixed"
},
deleteIcon: {
height: 40,
paddingRight: 0,
paddingLeft: theme.spacing(1),
width: 40
} }
}), }),
{ name: "OrderFulfillment" } { name: "OrderFulfillment" }
@ -27,36 +33,42 @@ const useStyles = makeStyles(
interface OrderFulfilledProductsCardProps { interface OrderFulfilledProductsCardProps {
fulfillment: OrderDetails_order_fulfillments; fulfillment: OrderDetails_order_fulfillments;
orderNumber?: string; fulfillmentAllowUnpaid: boolean;
order?: OrderDetailsFragment;
onOrderFulfillmentApprove: () => void;
onOrderFulfillmentCancel: () => void; onOrderFulfillmentCancel: () => void;
onTrackingCodeAdd: () => void; onTrackingCodeAdd: () => void;
onRefund: () => void; onRefund: () => void;
} }
const statusesToMergeLines = [
FulfillmentStatus.REFUNDED,
FulfillmentStatus.REFUNDED_AND_RETURNED,
FulfillmentStatus.RETURNED,
FulfillmentStatus.REPLACED
];
const cancelableStatuses = [
FulfillmentStatus.FULFILLED,
FulfillmentStatus.WAITING_FOR_APPROVAL
];
const OrderFulfilledProductsCard: React.FC<OrderFulfilledProductsCardProps> = props => { const OrderFulfilledProductsCard: React.FC<OrderFulfilledProductsCardProps> = props => {
const { const {
fulfillment, fulfillment,
orderNumber, fulfillmentAllowUnpaid,
order,
onOrderFulfillmentApprove,
onOrderFulfillmentCancel, onOrderFulfillmentCancel,
onTrackingCodeAdd, onTrackingCodeAdd,
onRefund onRefund
} = props; } = props;
const classes = useStyles(props); const classes = useStyles(props);
const intl = useIntl();
if (!fulfillment) { if (!fulfillment) {
return null; return null;
} }
const getLines = () => { const getLines = () => {
const statusesToMergeLines = [
FulfillmentStatus.REFUNDED,
FulfillmentStatus.REFUNDED_AND_RETURNED,
FulfillmentStatus.RETURNED,
FulfillmentStatus.REPLACED
];
if (statusesToMergeLines.includes(fulfillment?.status)) { if (statusesToMergeLines.includes(fulfillment?.status)) {
return mergeRepeatedOrderLines(fulfillment.lines); return mergeRepeatedOrderLines(fulfillment.lines);
} }
@ -72,21 +84,17 @@ const OrderFulfilledProductsCard: React.FC<OrderFulfilledProductsCardProps> = pr
lines={fulfillment?.lines} lines={fulfillment?.lines}
fulfillmentOrder={fulfillment?.fulfillmentOrder} fulfillmentOrder={fulfillment?.fulfillmentOrder}
status={fulfillment?.status} status={fulfillment?.status}
orderNumber={orderNumber} warehouseName={fulfillment?.warehouse?.name}
orderNumber={order?.number}
toolbar={ toolbar={
maybe(() => fulfillment.status) === FulfillmentStatus.FULFILLED && ( cancelableStatuses.includes(fulfillment?.status) && (
<CardMenu <IconButton
menuItems={[ className={classes.deleteIcon}
{ onClick={onOrderFulfillmentCancel}
label: intl.formatMessage({ data-test-id="cancelFulfillmentButton"
defaultMessage: "Cancel Fulfillment", >
description: "button" <TrashIcon />
}), </IconButton>
onSelect: onOrderFulfillmentCancel,
testId: "cancelFulfillmentButton"
}
]}
/>
) )
} }
/> />
@ -102,8 +110,11 @@ const OrderFulfilledProductsCard: React.FC<OrderFulfilledProductsCardProps> = pr
<ActionButtons <ActionButtons
status={fulfillment?.status} status={fulfillment?.status}
trackingNumber={fulfillment?.trackingNumber} trackingNumber={fulfillment?.trackingNumber}
orderIsPaid={order?.isPaid}
fulfillmentAllowUnpaid={fulfillmentAllowUnpaid}
onTrackingCodeAdd={onTrackingCodeAdd} onTrackingCodeAdd={onTrackingCodeAdd}
onRefund={onRefund} onRefund={onRefund}
onApprove={onOrderFulfillmentApprove}
/> />
</Card> </Card>
<CardSpacer /> <CardSpacer />

View file

@ -0,0 +1,31 @@
import { defineMessages } from "react-intl";
export const actionButtonsMessages = defineMessages({
refund: {
defaultMessage: "Refund",
description: "refund button"
},
editTracking: {
defaultMessage: "Edit tracking",
description: "edit tracking button"
},
addTracking: {
defaultMessage: "Add tracking",
description: "add tracking button"
}
});
export const extraInfoMessages = defineMessages({
fulfilled: {
defaultMessage: "Fulfilled from: ",
description: "fulfillment group"
},
restocked: {
defaultMessage: "Restocked from: ",
description: "restocked group"
},
tracking: {
defaultMessage: "Tracking Number: {trackingNumber}",
description: "tracking number"
}
});

View file

@ -0,0 +1,92 @@
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle
} from "@material-ui/core";
import ConfirmButton, {
ConfirmButtonTransitionState
} from "@saleor/components/ConfirmButton";
import ControlledCheckbox from "@saleor/components/ControlledCheckbox";
import Form from "@saleor/components/Form";
import FormSpacer from "@saleor/components/FormSpacer";
import { OrderErrorFragment } from "@saleor/fragments/types/OrderErrorFragment";
import { buttonMessages } from "@saleor/intl";
import getOrderErrorMessage from "@saleor/utils/errors/order";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { messages } from "./messages";
export interface OrderFulfillmentAcceptDialogFormData {
notifyCustomer: boolean;
}
export interface OrderFulfillmentAcceptDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
errors: OrderErrorFragment[];
open: boolean;
onClose();
onConfirm(data: OrderFulfillmentAcceptDialogFormData);
}
const OrderFulfillmentAcceptDialog: React.FC<OrderFulfillmentAcceptDialogProps> = props => {
const { confirmButtonState, errors, open, onConfirm, onClose } = props;
const intl = useIntl();
return (
<Dialog onClose={onClose} open={open} fullWidth maxWidth="sm">
<Form initial={{ notifyCustomer: true }} onSubmit={onConfirm}>
{({ change, data, submit }) => (
<>
<DialogTitle>
<FormattedMessage {...messages.title} />
</DialogTitle>
<DialogContent>
<DialogContentText>
<FormattedMessage {...messages.description} />
</DialogContentText>
<ControlledCheckbox
data-test="notify-customer"
name={
"notifyCustomer" as keyof OrderFulfillmentAcceptDialogFormData
}
label={intl.formatMessage(messages.notifyCustomer)}
checked={data.notifyCustomer}
onChange={change}
/>
{errors.length > 0 && (
<>
<FormSpacer />
{errors.map((err, index) => (
<DialogContentText color="error" key={index}>
{getOrderErrorMessage(err, intl)}
</DialogContentText>
))}
</>
)}
</DialogContent>
<DialogActions>
<Button onClick={onClose}>
<FormattedMessage {...buttonMessages.cancel} />
</Button>
<ConfirmButton
data-test="submit"
transitionState={confirmButtonState}
variant="contained"
onClick={submit}
>
<FormattedMessage {...buttonMessages.approve} />
</ConfirmButton>
</DialogActions>
</>
)}
</Form>
</Dialog>
);
};
OrderFulfillmentAcceptDialog.displayName = "OrderFulfillmentAcceptDialog";
export default OrderFulfillmentAcceptDialog;

View file

@ -0,0 +1,2 @@
export { default } from "./OrderFulfillmentApproveDialog";
export * from "./OrderFulfillmentApproveDialog";

View file

@ -0,0 +1,16 @@
import { defineMessages } from "react-intl";
export const messages = defineMessages({
title: {
defaultMessage: "Approve this fulfillment",
description: "dialog header"
},
description: {
defaultMessage: "Are you sure you want to approve this fullfillment?",
description: "dialog description"
},
notifyCustomer: {
defaultMessage: "Send shipment details to customer",
description: "checkbox label, fulfillment approval"
}
});

View file

@ -1,247 +0,0 @@
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
TableBody,
TableCell,
TableHead,
TableRow,
TextField
} from "@material-ui/core";
import ConfirmButton, {
ConfirmButtonTransitionState
} from "@saleor/components/ConfirmButton";
import Form from "@saleor/components/Form";
import { FormSpacer } from "@saleor/components/FormSpacer";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import TableCellAvatar from "@saleor/components/TableCellAvatar";
import { AVATAR_MARGIN } from "@saleor/components/TableCellAvatar/Avatar";
import { OrderErrorFragment } from "@saleor/fragments/types/OrderErrorFragment";
import { buttonMessages } from "@saleor/intl";
import { makeStyles } from "@saleor/macaw-ui";
import { getFormErrors } from "@saleor/utils/errors";
import getOrderErrorMessage from "@saleor/utils/errors/order";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { maybe } from "../../../misc";
import { OrderDetails_order_lines } from "../../types/OrderDetails";
export interface FormData {
lines: number[];
trackingNumber: string;
}
const useStyles = makeStyles(
theme => ({
colName: {
width: "auto"
},
colNameLabel: {
marginLeft: AVATAR_MARGIN
},
colQuantity: {
textAlign: "right",
width: 150
},
colQuantityContent: {
alignItems: "center",
display: "inline-flex"
},
colSku: {
width: 120
},
quantityInput: {
width: 100
},
remainingQuantity: {
marginLeft: theme.spacing(),
paddingTop: 14
},
table: {
tableLayout: "fixed"
}
}),
{ name: "OrderFulfillmentDialog" }
);
export interface OrderFulfillmentDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
errors: OrderErrorFragment[];
open: boolean;
lines: OrderDetails_order_lines[];
onClose();
onSubmit(data: FormData);
}
const OrderFulfillmentDialog: React.FC<OrderFulfillmentDialogProps> = props => {
const { confirmButtonState, errors, open, lines, onClose, onSubmit } = props;
const classes = useStyles(props);
const intl = useIntl();
const formFields = ["trackingNumber"];
const formErrors = getFormErrors(formFields, errors);
return (
<Dialog onClose={onClose} open={open}>
<Form
initial={{
lines: maybe(
() =>
lines.map(
product => product.quantity - product.quantityFulfilled
),
[]
),
trackingNumber: ""
}}
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>
<FormattedMessage
defaultMessage="Fulfill Products"
description="dialog header"
/>
</DialogTitle>
<ResponsiveTable className={classes.table}>
<TableHead>
<TableRow>
<TableCell className={classes.colName}>
<span className={classes.colNameLabel}>
<FormattedMessage defaultMessage="Product name" />
</span>
</TableCell>
<TableCell className={classes.colSku}>
<FormattedMessage
defaultMessage="SKU"
description="product's sku"
/>
</TableCell>
<TableCell className={classes.colQuantity}>
<FormattedMessage
defaultMessage="Quantity"
description="quantity of fulfilled products"
/>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{lines.map((product, productIndex) => {
const remainingQuantity =
product.quantity - product.quantityFulfilled;
return (
<TableRow key={product.id}>
<TableCellAvatar
className={classes.colName}
thumbnail={maybe(() => product.thumbnail.url)}
>
{product.productName}
</TableCellAvatar>
<TableCell className={classes.colSku}>
{product.productSku}
</TableCell>
<TableCell className={classes.colQuantity}>
<div className={classes.colQuantityContent}>
<TextField
type="number"
inputProps={{
max: remainingQuantity.toString(),
style: { textAlign: "right" }
}}
className={classes.quantityInput}
value={data.lines[productIndex]}
onChange={event =>
handleQuantityChange(productIndex, event)
}
error={
!!formErrors.trackingNumber ||
remainingQuantity < data.lines[productIndex]
}
helperText={getOrderErrorMessage(
formErrors.trackingNumber,
intl
)}
/>
<div className={classes.remainingQuantity}>
/ {remainingQuantity}
</div>
</div>
</TableCell>
</TableRow>
);
})}
</TableBody>
</ResponsiveTable>
<DialogContent>
<FormSpacer />
<TextField
error={!!formErrors.trackingNumber}
fullWidth
helperText={getOrderErrorMessage(
formErrors.trackingNumber,
intl
)}
label={intl.formatMessage({
defaultMessage: "Tracking number",
description: "fulfillment group"
})}
name="trackingNumber"
value={data.trackingNumber}
onChange={change}
/>
{errors.length > 0 && (
<>
<FormSpacer />
{errors
.filter(err => !formFields.includes(err.field))
.map((err, index) => (
<DialogContentText color="error" key={index}>
{getOrderErrorMessage(err, intl)}
</DialogContentText>
))}
</>
)}
</DialogContent>
<DialogActions>
<Button onClick={onClose}>
<FormattedMessage {...buttonMessages.back} />
</Button>
<ConfirmButton
transitionState={confirmButtonState}
color="primary"
variant="contained"
type="submit"
>
<FormattedMessage {...buttonMessages.confirm} />
</ConfirmButton>
</DialogActions>
</>
);
}}
</Form>
</Dialog>
);
};
OrderFulfillmentDialog.displayName = "OrderFulfillmentDialog";
export default OrderFulfillmentDialog;

View file

@ -1,2 +0,0 @@
export { default } from "./OrderFulfillmentDialog";
export * from "./OrderFulfillmentDialog";

View file

@ -0,0 +1,80 @@
import { Card, CardContent, Typography } from "@material-ui/core";
import CardTitle from "@saleor/components/CardTitle";
import ControlledCheckbox from "@saleor/components/ControlledCheckbox";
import FormSpacer from "@saleor/components/FormSpacer";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { OrderSettingsFormData } from "../OrderSettingsPage/form";
export interface OrderFulfillmentSettingsProps {
data: OrderSettingsFormData;
disabled: boolean;
onChange: (event: React.ChangeEvent<any>) => void;
}
const OrderFulfillmentSettings: React.FC<OrderFulfillmentSettingsProps> = ({
data,
disabled,
onChange
}) => {
const intl = useIntl();
return (
<Card data-test="OrderFulfillmentSettings">
<CardTitle
title={intl.formatMessage({
defaultMessage: "Fulfillment settings",
description: "section header"
})}
/>
<CardContent>
<ControlledCheckbox
name={"fulfillmentAutoApprove" as keyof OrderSettingsFormData}
label={
<>
<FormattedMessage
defaultMessage="Automatically approve all fulfillments"
description="checkbox label"
/>
<Typography variant="caption">
<FormattedMessage
defaultMessage="All fulfillments will be automatically approved"
description="checkbox label description"
/>
</Typography>
</>
}
checked={data.fulfillmentAutoApprove}
onChange={onChange}
disabled={disabled}
data-test="fulfillmentAutoApproveCheckbox"
/>
<FormSpacer />
<ControlledCheckbox
name={"fulfillmentAllowUnpaid" as keyof OrderSettingsFormData}
label={
<>
<FormattedMessage
defaultMessage="Allow fulfillment without payment"
description="checkbox label"
/>
<Typography variant="caption">
<FormattedMessage
defaultMessage="You will be able to fulfill products without capturing payment for the order."
description="checkbox label description"
/>
</Typography>
</>
}
checked={data.fulfillmentAllowUnpaid}
onChange={onChange}
disabled={disabled}
data-test="fulfillmentAllowUnpaidCheckbox"
/>
</CardContent>
</Card>
);
};
OrderFulfillmentSettings.displayName = "OrderFulfillmentSettings";
export default OrderFulfillmentSettings;

View file

@ -0,0 +1,2 @@
export { default } from "./OrderFulfillmentSettings";
export * from "./OrderFulfillmentSettings";

View file

@ -142,6 +142,11 @@ export const getEventMessage = (
sentBy: event.user ? event.user.email : null sentBy: event.user ? event.user.email : null
} }
); );
case OrderEventsEnum.FULFILLMENT_AWAITS_APPROVAL:
return intl.formatMessage({
defaultMessage: "Fulfillment awaits approval",
description: "order history message"
});
case OrderEventsEnum.FULFILLMENT_FULFILLED_ITEMS: case OrderEventsEnum.FULFILLMENT_FULFILLED_ITEMS:
return intl.formatMessage( return intl.formatMessage(
{ {

View file

@ -72,7 +72,7 @@ const TableLine: React.FC<TableLineProps> = ({
isOrderLine = false isOrderLine = false
}) => { }) => {
const classes = useStyles({}); const classes = useStyles({});
const { quantity, quantityFulfilled } = lineData as OrderDetails_order_lines; const { quantity, quantityToFulfill } = lineData as OrderDetails_order_lines;
if (!lineData) { if (!lineData) {
return <Skeleton />; return <Skeleton />;
@ -85,9 +85,7 @@ const TableLine: React.FC<TableLineProps> = ({
} as OrderDetails_order_fulfillments_lines) } as OrderDetails_order_fulfillments_lines)
: (lineData as OrderDetails_order_fulfillments_lines); : (lineData as OrderDetails_order_fulfillments_lines);
const quantityToDisplay = isOrderLine const quantityToDisplay = isOrderLine ? quantityToFulfill : quantity;
? quantity - quantityFulfilled
: quantity;
return ( return (
<TableRow className={classes.clickableRow} hover key={line.id}> <TableRow className={classes.clickableRow} hover key={line.id}>

View file

@ -18,11 +18,11 @@ import { FormsetChange } from "@saleor/hooks/useFormset";
import { makeStyles } from "@saleor/macaw-ui"; import { makeStyles } from "@saleor/macaw-ui";
import { renderCollection } from "@saleor/misc"; import { renderCollection } from "@saleor/misc";
import { OrderRefundData_order_fulfillments } from "@saleor/orders/types/OrderRefundData"; import { OrderRefundData_order_fulfillments } from "@saleor/orders/types/OrderRefundData";
import { FulfillmentStatus } from "@saleor/types/globalTypes";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { OrderRefundFormData } from "../OrderRefundPage/form"; import { OrderRefundFormData } from "../OrderRefundPage/form";
import { getTitle } from "./messages";
const useStyles = makeStyles( const useStyles = makeStyles(
theme => { theme => {
@ -93,15 +93,7 @@ const OrderRefundFulfilledProducts: React.FC<OrderRefundFulfilledProductsProps>
<CardTitle <CardTitle
title={ title={
<> <>
{fulfillment.status === FulfillmentStatus.RETURNED {getTitle(fulfillment.status, intl)}
? intl.formatMessage({
defaultMessage: "Fulfillment returned",
description: "section header returned"
})
: intl.formatMessage({
defaultMessage: "Fulfillment",
description: "section header"
})}
{fulfillment && ( {fulfillment && (
<Typography className={classes.orderNumber} variant="body1"> <Typography className={classes.orderNumber} variant="body1">
{`#${orderNumber}-${fulfillment?.fulfillmentOrder}`} {`#${orderNumber}-${fulfillment?.fulfillmentOrder}`}

View file

@ -0,0 +1,31 @@
import { FulfillmentStatus } from "@saleor/types/globalTypes";
import { defineMessages, IntlShape } from "react-intl";
export const messages = defineMessages({
fulfillment: {
defaultMessage: "Fulfillment",
description: "section header"
},
fulfillmentReturned: {
defaultMessage: "Fulfillment returned",
description: "section header returned"
},
fulfillmentWaitingForApproval: {
defaultMessage: "Fulfillment waiting for approval",
description: "section header returned"
}
});
export const getTitle = (
fulfillmentStatus: FulfillmentStatus,
intl: IntlShape
) => {
switch (fulfillmentStatus) {
case FulfillmentStatus.RETURNED:
return intl.formatMessage(messages.fulfillmentReturned);
case FulfillmentStatus.WAITING_FOR_APPROVAL:
return intl.formatMessage(messages.fulfillmentWaitingForApproval);
default:
return intl.formatMessage(messages.fulfillment);
}
};

View file

@ -26,7 +26,8 @@ import OrderRefundForm, {
export const refundFulfilledStatuses = [ export const refundFulfilledStatuses = [
FulfillmentStatus.FULFILLED, FulfillmentStatus.FULFILLED,
FulfillmentStatus.RETURNED FulfillmentStatus.RETURNED,
FulfillmentStatus.WAITING_FOR_APPROVAL
]; ];
export interface OrderRefundPageProps { export interface OrderRefundPageProps {
@ -51,7 +52,7 @@ const OrderRefundPage: React.FC<OrderRefundPageProps> = props => {
const intl = useIntl(); const intl = useIntl();
const unfulfilledLines = order?.lines.filter( const unfulfilledLines = order?.lines.filter(
line => line.quantity !== line.quantityFulfilled line => line.quantityToFulfill > 0
); );
const fulfilledFulfillemnts = const fulfilledFulfillemnts =

View file

@ -34,7 +34,7 @@ export const orderToRefund = (placeholder: string): OrderRefundData_order => ({
id: "diufhdsif", id: "diufhdsif",
productName: "Milk", productName: "Milk",
quantity: 19, quantity: 19,
quantityFulfilled: 3, quantityToFulfill: 16,
thumbnail: { thumbnail: {
__typename: "Image", __typename: "Image",
url: placeholder url: placeholder
@ -53,7 +53,7 @@ export const orderToRefund = (placeholder: string): OrderRefundData_order => ({
id: "fdsfdfdsf", id: "fdsfdfdsf",
productName: "Coffee", productName: "Coffee",
quantity: 13, quantity: 13,
quantityFulfilled: 5, quantityToFulfill: 8,
thumbnail: { thumbnail: {
__typename: "Image", __typename: "Image",
url: placeholder url: placeholder

View file

@ -78,7 +78,7 @@ function useOrderRefundForm(
const form = useForm(getOrderRefundPageFormData(defaultType)); const form = useForm(getOrderRefundPageFormData(defaultType));
const refundedProductQuantities = useFormset<null, string>( const refundedProductQuantities = useFormset<null, string>(
order?.lines order?.lines
.filter(line => line.quantityFulfilled !== line.quantity) .filter(line => line.quantityToFulfill > 0)
.map(line => ({ .map(line => ({
data: null, data: null,
id: line.id, id: line.id,
@ -132,7 +132,7 @@ function useOrderRefundForm(
data: null, data: null,
id: line.id, id: line.id,
label: null, label: null,
value: (line.quantity - line.quantityFulfilled).toString() value: line.quantityToFulfill.toString()
}; };
}); });
refundedProductQuantities.set(newQuantities); refundedProductQuantities.set(newQuantities);

View file

@ -148,7 +148,7 @@ const OrderRefundUnfulfilledProducts: React.FC<OrderRefundUnfulfilledProductsPro
const selectedLineQuantity = data.refundedProductQuantities.find( const selectedLineQuantity = data.refundedProductQuantities.find(
refundedLine => refundedLine.id === line.id refundedLine => refundedLine.id === line.id
); );
const lineQuantity = line?.quantity - line?.quantityFulfilled; const lineQuantity = line?.quantityToFulfill;
const isError = const isError =
Number(selectedLineQuantity?.value) > lineQuantity || Number(selectedLineQuantity?.value) > lineQuantity ||
Number(selectedLineQuantity?.value) < 0; Number(selectedLineQuantity?.value) < 0;

View file

@ -6,14 +6,24 @@ import { makeStyles } from "@saleor/macaw-ui";
import { FulfillmentStatus } from "@saleor/types/globalTypes"; import { FulfillmentStatus } from "@saleor/types/globalTypes";
import camelCase from "lodash/camelCase"; import camelCase from "lodash/camelCase";
import React from "react"; import React from "react";
import { FormattedMessage } from "react-intl";
import { defineMessages } from "react-intl"; import { defineMessages } from "react-intl";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
const useStyles = makeStyles( const useStyles = makeStyles(
theme => ({ theme => ({
title: {
width: "100%",
display: "flex"
},
orderNumber: { orderNumber: {
display: "inline", display: "inline",
marginLeft: theme.spacing(1) marginLeft: theme.spacing(1)
},
warehouseName: {
float: "right",
color: theme.palette.text.secondary,
margin: `auto ${theme.spacing(1)} auto auto`
} }
}), }),
{ name: "CardTitle" } { name: "CardTitle" }
@ -44,9 +54,17 @@ const messages = defineMessages({
defaultMessage: "Returned ({quantity})", defaultMessage: "Returned ({quantity})",
description: "refunded fulfillment, section header" description: "refunded fulfillment, section header"
}, },
waitingForApproval: {
defaultMessage: "Waiting for approval ({quantity})",
description: "unapproved fulfillment, section header"
},
unfulfilled: { unfulfilled: {
defaultMessage: "Unfulfilled", defaultMessage: "Unfulfilled",
description: "section header" description: "section header"
},
fulfilledFrom: {
defaultMessage: "Fulfilled from {warehouseName}",
description: "fulfilled fulfillment, section header"
} }
}); });
@ -62,6 +80,7 @@ interface CardTitleProps {
status: CardTitleStatus; status: CardTitleStatus;
toolbar?: React.ReactNode; toolbar?: React.ReactNode;
orderNumber?: string; orderNumber?: string;
warehouseName?: string;
withStatus?: boolean; withStatus?: boolean;
} }
@ -77,6 +96,8 @@ const selectStatus = (status: CardTitleStatus) => {
return StatusType.NEUTRAL; return StatusType.NEUTRAL;
case FulfillmentStatus.REFUNDED_AND_RETURNED: case FulfillmentStatus.REFUNDED_AND_RETURNED:
return StatusType.NEUTRAL; return StatusType.NEUTRAL;
case FulfillmentStatus.WAITING_FOR_APPROVAL:
return StatusType.ALERT;
case FulfillmentStatus.CANCELED: case FulfillmentStatus.CANCELED:
return StatusType.ERROR; return StatusType.ERROR;
default: default:
@ -89,6 +110,7 @@ const CardTitle: React.FC<CardTitleProps> = ({
fulfillmentOrder, fulfillmentOrder,
status, status,
orderNumber = "", orderNumber = "",
warehouseName,
withStatus = false, withStatus = false,
toolbar toolbar
}) => { }) => {
@ -108,7 +130,7 @@ const CardTitle: React.FC<CardTitleProps> = ({
); );
const title = ( const title = (
<> <div className={classes.title}>
{intl.formatMessage(messageForStatus, { {intl.formatMessage(messageForStatus, {
fulfillmentName, fulfillmentName,
quantity: totalQuantity quantity: totalQuantity
@ -116,7 +138,17 @@ const CardTitle: React.FC<CardTitleProps> = ({
<Typography className={classes.orderNumber} variant="body1"> <Typography className={classes.orderNumber} variant="body1">
{fulfillmentName} {fulfillmentName}
</Typography> </Typography>
</> {!!warehouseName && (
<Typography className={classes.warehouseName} variant="caption">
<FormattedMessage
{...messages.fulfilledFrom}
values={{
warehouseName
}}
/>
</Typography>
)}
</div>
); );
return ( return (

View file

@ -1,4 +1,7 @@
import { orderSettings as orderSettingsFixture } from "@saleor/orders/fixtures"; import {
orderSettings as orderSettingsFixture,
shopOrderSettings as shopOrderSettingsFixture
} from "@saleor/orders/fixtures";
import { storiesOf } from "@storybook/react"; import { storiesOf } from "@storybook/react";
import React from "react"; import React from "react";
@ -6,7 +9,8 @@ import Decorator from "../../../storybook/Decorator";
import OrderSettings, { OrderSettingsPageProps } from "."; import OrderSettings, { OrderSettingsPageProps } from ".";
const props: OrderSettingsPageProps = { const props: OrderSettingsPageProps = {
data: orderSettingsFixture, orderSettings: orderSettingsFixture,
shop: shopOrderSettingsFixture,
disabled: false, disabled: false,
onBack: () => undefined, onBack: () => undefined,
onSubmit: () => undefined, onSubmit: () => undefined,
@ -17,5 +21,10 @@ storiesOf("Views / Orders / Order settings", module)
.addDecorator(Decorator) .addDecorator(Decorator)
.add("default", () => <OrderSettings {...props} />) .add("default", () => <OrderSettings {...props} />)
.add("loading", () => ( .add("loading", () => (
<OrderSettings {...props} disabled={true} data={undefined} /> <OrderSettings
{...props}
disabled={true}
orderSettings={undefined}
shop={undefined}
/>
)); ));

View file

@ -5,17 +5,20 @@ import Grid from "@saleor/components/Grid";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
import Savebar from "@saleor/components/Savebar"; import Savebar from "@saleor/components/Savebar";
import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment"; import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment";
import { ShopOrderSettingsFragment } from "@saleor/fragments/types/ShopOrderSettingsFragment";
import { SubmitPromise } from "@saleor/hooks/useForm"; import { SubmitPromise } from "@saleor/hooks/useForm";
import { sectionNames } from "@saleor/intl"; import { sectionNames } from "@saleor/intl";
import { Backlink } from "@saleor/macaw-ui"; import { Backlink } from "@saleor/macaw-ui";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import OrderFulfillmentSettings from "../OrderFulfillmentSettings";
import OrderSettings from "../OrderSettings/OrderSettings"; import OrderSettings from "../OrderSettings/OrderSettings";
import OrderSettingsForm, { OrderSettingsFormData } from "./form"; import OrderSettingsForm, { OrderSettingsFormData } from "./form";
export interface OrderSettingsPageProps { export interface OrderSettingsPageProps {
data: OrderSettingsFragment; orderSettings: OrderSettingsFragment;
shop: ShopOrderSettingsFragment;
disabled: boolean; disabled: boolean;
saveButtonBarState: ConfirmButtonTransitionState; saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void; onBack: () => void;
@ -23,11 +26,22 @@ export interface OrderSettingsPageProps {
} }
const OrderSettingsPage: React.FC<OrderSettingsPageProps> = props => { const OrderSettingsPage: React.FC<OrderSettingsPageProps> = props => {
const { data, disabled, saveButtonBarState, onBack, onSubmit } = props; const {
orderSettings,
shop,
disabled,
saveButtonBarState,
onBack,
onSubmit
} = props;
const intl = useIntl(); const intl = useIntl();
return ( return (
<OrderSettingsForm orderSettings={data} onSubmit={onSubmit}> <OrderSettingsForm
orderSettings={orderSettings}
shop={shop}
onSubmit={onSubmit}
>
{({ data, submit, hasChanged, change }) => ( {({ data, submit, hasChanged, change }) => (
<Container> <Container>
<Backlink onClick={onBack}> <Backlink onClick={onBack}>
@ -46,6 +60,12 @@ const OrderSettingsPage: React.FC<OrderSettingsPageProps> = props => {
</Typography> </Typography>
</div> </div>
<OrderSettings data={data} disabled={disabled} onChange={change} /> <OrderSettings data={data} disabled={disabled} onChange={change} />
<div />
<OrderFulfillmentSettings
data={data}
disabled={disabled}
onChange={change}
/>
</Grid> </Grid>
<Savebar <Savebar
onCancel={onBack} onCancel={onBack}

View file

@ -1,10 +1,13 @@
import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment"; import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment";
import { ShopOrderSettingsFragment } from "@saleor/fragments/types/ShopOrderSettingsFragment";
import useForm, { FormChange, SubmitPromise } from "@saleor/hooks/useForm"; import useForm, { FormChange, SubmitPromise } from "@saleor/hooks/useForm";
import handleFormSubmit from "@saleor/utils/handlers/handleFormSubmit"; import handleFormSubmit from "@saleor/utils/handlers/handleFormSubmit";
import React from "react"; import React from "react";
export interface OrderSettingsFormData { export interface OrderSettingsFormData {
automaticallyConfirmAllNewOrders: boolean; automaticallyConfirmAllNewOrders: boolean;
fulfillmentAutoApprove: boolean;
fulfillmentAllowUnpaid: boolean;
} }
export interface UseOrderSettingsFormResult { export interface UseOrderSettingsFormResult {
@ -17,26 +20,31 @@ export interface UseOrderSettingsFormResult {
export interface OrderSettingsFormProps { export interface OrderSettingsFormProps {
children: (props: UseOrderSettingsFormResult) => React.ReactNode; children: (props: UseOrderSettingsFormResult) => React.ReactNode;
orderSettings: OrderSettingsFragment; orderSettings: OrderSettingsFragment;
shop: ShopOrderSettingsFragment;
onSubmit: (data: OrderSettingsFormData) => SubmitPromise; onSubmit: (data: OrderSettingsFormData) => SubmitPromise;
} }
function getOrderSeettingsFormData( function getOrderSeettingsFormData(
orderSettings: OrderSettingsFragment orderSettings: OrderSettingsFragment,
shop: ShopOrderSettingsFragment
): OrderSettingsFormData { ): OrderSettingsFormData {
return { return {
automaticallyConfirmAllNewOrders: automaticallyConfirmAllNewOrders:
orderSettings?.automaticallyConfirmAllNewOrders orderSettings?.automaticallyConfirmAllNewOrders,
fulfillmentAutoApprove: shop?.fulfillmentAutoApprove,
fulfillmentAllowUnpaid: shop?.fulfillmentAllowUnpaid
}; };
} }
function useOrderSettingsForm( function useOrderSettingsForm(
orderSettings: OrderSettingsFragment, orderSettings: OrderSettingsFragment,
shop: ShopOrderSettingsFragment,
onSubmit: (data: OrderSettingsFormData) => SubmitPromise onSubmit: (data: OrderSettingsFormData) => SubmitPromise
): UseOrderSettingsFormResult { ): UseOrderSettingsFormResult {
const [changed, setChanged] = React.useState(false); const [changed, setChanged] = React.useState(false);
const triggerChange = () => setChanged(true); const triggerChange = () => setChanged(true);
const form = useForm(getOrderSeettingsFormData(orderSettings)); const form = useForm(getOrderSeettingsFormData(orderSettings, shop));
const handleChange: FormChange = (event, cb) => { const handleChange: FormChange = (event, cb) => {
form.change(event, cb); form.change(event, cb);
@ -60,9 +68,10 @@ function useOrderSettingsForm(
const OrderSettingsForm: React.FC<OrderSettingsFormProps> = ({ const OrderSettingsForm: React.FC<OrderSettingsFormProps> = ({
children, children,
orderSettings, orderSettings,
shop,
onSubmit onSubmit
}) => { }) => {
const props = useOrderSettingsForm(orderSettings, onSubmit); const props = useOrderSettingsForm(orderSettings, shop, onSubmit);
return <form onSubmit={props.submit}>{children(props)}</form>; return <form onSubmit={props.submit}>{children(props)}</form>;
}; };

View file

@ -1,6 +1,13 @@
import { Button, Card, CardActions, TableBody } from "@material-ui/core"; import {
Button,
Card,
CardActions,
TableBody,
Typography
} from "@material-ui/core";
import CardSpacer from "@saleor/components/CardSpacer"; import CardSpacer from "@saleor/components/CardSpacer";
import ResponsiveTable from "@saleor/components/ResponsiveTable"; import ResponsiveTable from "@saleor/components/ResponsiveTable";
import { commonMessages } from "@saleor/intl";
import { makeStyles } from "@saleor/macaw-ui"; import { makeStyles } from "@saleor/macaw-ui";
import { renderCollection } from "@saleor/misc"; import { renderCollection } from "@saleor/misc";
import React from "react"; import React from "react";
@ -21,13 +28,19 @@ const useStyles = makeStyles(
); );
interface OrderUnfulfilledProductsCardProps { interface OrderUnfulfilledProductsCardProps {
canFulfill: boolean; showFulfillmentAction: boolean;
notAllowedToFulfillUnpaid: boolean;
lines: OrderDetails_order_lines[]; lines: OrderDetails_order_lines[];
onFulfill: () => void; onFulfill: () => void;
} }
const OrderUnfulfilledProductsCard: React.FC<OrderUnfulfilledProductsCardProps> = props => { const OrderUnfulfilledProductsCard: React.FC<OrderUnfulfilledProductsCardProps> = props => {
const { canFulfill, lines, onFulfill } = props; const {
showFulfillmentAction,
notAllowedToFulfillUnpaid,
lines,
onFulfill
} = props;
const classes = useStyles({}); const classes = useStyles({});
if (!lines.length) { if (!lines.length) {
@ -46,11 +59,23 @@ const OrderUnfulfilledProductsCard: React.FC<OrderUnfulfilledProductsCardProps>
))} ))}
</TableBody> </TableBody>
</ResponsiveTable> </ResponsiveTable>
{canFulfill && ( {showFulfillmentAction && (
<CardActions> <CardActions>
<Button variant="text" color="primary" onClick={onFulfill}> <Button
variant="text"
color="primary"
onClick={onFulfill}
disabled={notAllowedToFulfillUnpaid}
>
<FormattedMessage defaultMessage="Fulfill" description="button" /> <FormattedMessage defaultMessage="Fulfill" description="button" />
</Button> </Button>
{notAllowedToFulfillUnpaid && (
<Typography color="error" variant="caption">
<FormattedMessage
{...commonMessages.cannotFullfillUnpaidOrder}
/>
</Typography>
)}
</CardActions> </CardActions>
)} )}
</Card> </Card>

View file

@ -11,6 +11,7 @@ import {
TypedOrderDraftCancelMutation, TypedOrderDraftCancelMutation,
TypedOrderDraftFinalizeMutation, TypedOrderDraftFinalizeMutation,
TypedOrderDraftUpdateMutation, TypedOrderDraftUpdateMutation,
TypedOrderFulfillmentApproveMutation,
TypedOrderFulfillmentCancelMutation, TypedOrderFulfillmentCancelMutation,
TypedOrderFulfillmentUpdateTrackingMutation, TypedOrderFulfillmentUpdateTrackingMutation,
TypedOrderLineDeleteMutation, TypedOrderLineDeleteMutation,
@ -44,6 +45,10 @@ import {
OrderDraftUpdate, OrderDraftUpdate,
OrderDraftUpdateVariables OrderDraftUpdateVariables
} from "../types/OrderDraftUpdate"; } from "../types/OrderDraftUpdate";
import {
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
} from "../types/OrderFulfillmentApprove";
import { import {
OrderFulfillmentCancel, OrderFulfillmentCancel,
OrderFulfillmentCancelVariables OrderFulfillmentCancelVariables
@ -83,6 +88,10 @@ interface OrderOperationsProps {
OrderCancel, OrderCancel,
OrderCancelVariables OrderCancelVariables
>; >;
orderFulfillmentApprove: PartialMutationProviderOutput<
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
>;
orderFulfillmentCancel: PartialMutationProviderOutput< orderFulfillmentCancel: PartialMutationProviderOutput<
OrderFulfillmentCancel, OrderFulfillmentCancel,
OrderFulfillmentCancelVariables OrderFulfillmentCancelVariables
@ -141,6 +150,7 @@ interface OrderOperationsProps {
InvoiceEmailSendVariables InvoiceEmailSendVariables
>; >;
}) => React.ReactNode; }) => React.ReactNode;
onOrderFulfillmentApprove: (data: OrderFulfillmentApprove) => void;
onOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void; onOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void;
onOrderFulfillmentUpdate: (data: OrderFulfillmentUpdateTracking) => void; onOrderFulfillmentUpdate: (data: OrderFulfillmentUpdateTracking) => void;
onOrderCancel: (data: OrderCancel) => void; onOrderCancel: (data: OrderCancel) => void;
@ -174,6 +184,7 @@ const OrderOperations: React.FC<OrderOperationsProps> = ({
onUpdate, onUpdate,
onDraftCancel, onDraftCancel,
onDraftFinalize, onDraftFinalize,
onOrderFulfillmentApprove,
onOrderFulfillmentCancel, onOrderFulfillmentCancel,
onOrderFulfillmentUpdate, onOrderFulfillmentUpdate,
onOrderMarkAsPaid, onOrderMarkAsPaid,
@ -210,121 +221,138 @@ const OrderOperations: React.FC<OrderOperationsProps> = ({
onCompleted={onOrderLineUpdate} onCompleted={onOrderLineUpdate}
> >
{(...updateOrderLine) => ( {(...updateOrderLine) => (
<TypedOrderFulfillmentCancelMutation <TypedOrderFulfillmentApproveMutation
onCompleted={ onCompleted={
onOrderFulfillmentCancel onOrderFulfillmentApprove
} }
> >
{(...cancelFulfillment) => ( {(...approveFulfillment) => (
<TypedOrderFulfillmentUpdateTrackingMutation <TypedOrderFulfillmentCancelMutation
onCompleted={ onCompleted={
onOrderFulfillmentUpdate onOrderFulfillmentCancel
} }
> >
{(...updateTrackingNumber) => ( {(...cancelFulfillment) => (
<TypedOrderDraftFinalizeMutation <TypedOrderFulfillmentUpdateTrackingMutation
onCompleted={ onCompleted={
onDraftFinalize onOrderFulfillmentUpdate
} }
> >
{(...finalizeDraft) => ( {(
<TypedOrderDraftCancelMutation ...updateTrackingNumber
) => (
<TypedOrderDraftFinalizeMutation
onCompleted={ onCompleted={
onDraftCancel onDraftFinalize
} }
> >
{(...cancelDraft) => ( {(...finalizeDraft) => (
<TypedOrderMarkAsPaidMutation <TypedOrderDraftCancelMutation
onCompleted={ onCompleted={
onOrderMarkAsPaid onDraftCancel
} }
> >
{( {(
...markAsPaid ...cancelDraft
) => ( ) => (
<TypedInvoiceRequestMutation <TypedOrderMarkAsPaidMutation
onCompleted={ onCompleted={
onInvoiceRequest onOrderMarkAsPaid
} }
> >
{( {(
...invoiceRequest ...markAsPaid
) => ( ) => (
<TypedInvoiceEmailSendMutation <TypedInvoiceRequestMutation
onCompleted={ onCompleted={
onInvoiceSend onInvoiceRequest
} }
> >
{( {(
...invoiceEmailSend ...invoiceRequest
) => ) => (
children({ <TypedInvoiceEmailSendMutation
orderAddNote: getMutationProviderData( onCompleted={
...addNote onInvoiceSend
), }
orderCancel: getMutationProviderData( >
...orderCancel {(
),
orderDraftCancel: getMutationProviderData(
...cancelDraft
),
orderDraftFinalize: getMutationProviderData(
...finalizeDraft
),
orderDraftUpdate: getMutationProviderData(
...updateDraft
),
orderFulfillmentCancel: getMutationProviderData(
...cancelFulfillment
),
orderFulfillmentUpdateTracking: getMutationProviderData(
...updateTrackingNumber
),
orderInvoiceRequest: getMutationProviderData(
...invoiceRequest
),
orderInvoiceSend: getMutationProviderData(
...invoiceEmailSend ...invoiceEmailSend
), ) =>
orderLineDelete: getMutationProviderData( children(
...deleteOrderLine {
), orderAddNote: getMutationProviderData(
orderLineUpdate: getMutationProviderData( ...addNote
...updateOrderLine ),
), orderCancel: getMutationProviderData(
orderLinesAdd: getMutationProviderData( ...orderCancel
...addOrderLine ),
), orderDraftCancel: getMutationProviderData(
orderPaymentCapture: getMutationProviderData( ...cancelDraft
...paymentCapture ),
), orderDraftFinalize: getMutationProviderData(
orderPaymentMarkAsPaid: getMutationProviderData( ...finalizeDraft
...markAsPaid ),
), orderDraftUpdate: getMutationProviderData(
orderShippingMethodUpdate: getMutationProviderData( ...updateDraft
...updateShippingMethod ),
), orderFulfillmentApprove: getMutationProviderData(
orderUpdate: getMutationProviderData( ...approveFulfillment
...update ),
), orderFulfillmentCancel: getMutationProviderData(
orderVoid: getMutationProviderData( ...cancelFulfillment
...orderVoid ),
) orderFulfillmentUpdateTracking: getMutationProviderData(
}) ...updateTrackingNumber
} ),
</TypedInvoiceEmailSendMutation> orderInvoiceRequest: getMutationProviderData(
...invoiceRequest
),
orderInvoiceSend: getMutationProviderData(
...invoiceEmailSend
),
orderLineDelete: getMutationProviderData(
...deleteOrderLine
),
orderLineUpdate: getMutationProviderData(
...updateOrderLine
),
orderLinesAdd: getMutationProviderData(
...addOrderLine
),
orderPaymentCapture: getMutationProviderData(
...paymentCapture
),
orderPaymentMarkAsPaid: getMutationProviderData(
...markAsPaid
),
orderShippingMethodUpdate: getMutationProviderData(
...updateShippingMethod
),
orderUpdate: getMutationProviderData(
...update
),
orderVoid: getMutationProviderData(
...orderVoid
)
}
)
}
</TypedInvoiceEmailSendMutation>
)}
</TypedInvoiceRequestMutation>
)} )}
</TypedInvoiceRequestMutation> </TypedOrderMarkAsPaidMutation>
)} )}
</TypedOrderMarkAsPaidMutation> </TypedOrderDraftCancelMutation>
)} )}
</TypedOrderDraftCancelMutation> </TypedOrderDraftFinalizeMutation>
)} )}
</TypedOrderDraftFinalizeMutation> </TypedOrderFulfillmentUpdateTrackingMutation>
)} )}
</TypedOrderFulfillmentUpdateTrackingMutation> </TypedOrderFulfillmentCancelMutation>
)} )}
</TypedOrderFulfillmentCancelMutation> </TypedOrderFulfillmentApproveMutation>
)} )}
</TypedOrderLineUpdateMutation> </TypedOrderLineUpdateMutation>
)} )}

View file

@ -1,6 +1,7 @@
import { ShopInfo_shop_countries } from "@saleor/components/Shop/types/ShopInfo"; import { ShopInfo_shop_countries } from "@saleor/components/Shop/types/ShopInfo";
import { InvoiceFragment } from "@saleor/fragments/types/InvoiceFragment"; import { InvoiceFragment } from "@saleor/fragments/types/InvoiceFragment";
import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment"; import { OrderSettingsFragment } from "@saleor/fragments/types/OrderSettingsFragment";
import { ShopOrderSettingsFragment } from "@saleor/fragments/types/ShopOrderSettingsFragment";
import { SearchCustomers_search_edges_node } from "@saleor/searches/types/SearchCustomers"; import { SearchCustomers_search_edges_node } from "@saleor/searches/types/SearchCustomers";
import { warehouseList } from "@saleor/warehouses/fixtures"; import { warehouseList } from "@saleor/warehouses/fixtures";
import { MessageDescriptor } from "react-intl"; import { MessageDescriptor } from "react-intl";
@ -13,12 +14,28 @@ import {
OrderEventsEmailsEnum, OrderEventsEmailsEnum,
OrderEventsEnum, OrderEventsEnum,
OrderStatus, OrderStatus,
PaymentChargeStatusEnum PaymentChargeStatusEnum,
WeightUnitsEnum
} from "../types/globalTypes"; } from "../types/globalTypes";
import { OrderDetails_order } from "./types/OrderDetails"; import { OrderDetails_order, OrderDetails_shop } from "./types/OrderDetails";
import { OrderList_orders_edges_node } from "./types/OrderList"; import { OrderList_orders_edges_node } from "./types/OrderList";
import { SearchOrderVariant_search_edges_node } from "./types/SearchOrderVariant"; import { SearchOrderVariant_search_edges_node } from "./types/SearchOrderVariant";
export const countries: ShopInfo_shop_countries[] = [
{ __typename: "CountryDisplay", code: "AF", country: "Afghanistan" },
{ __typename: "CountryDisplay", code: "AX", country: "Åland Islands" },
{ __typename: "CountryDisplay", code: "AL", country: "Albania" },
{ __typename: "CountryDisplay", code: "DZ", country: "Algeria" },
{ __typename: "CountryDisplay", code: "AS", country: "American Samoa" }
];
export const shop: OrderDetails_shop = {
__typename: "Shop",
countries,
defaultWeightUnit: WeightUnitsEnum.KG,
fulfillmentAllowUnpaid: true,
fulfillmentAutoApprove: true
};
export const clients: SearchCustomers_search_edges_node[] = [ export const clients: SearchCustomers_search_edges_node[] = [
{ {
__typename: "User" as "User", __typename: "User" as "User",
@ -1024,6 +1041,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
productSku: "5-1337", productSku: "5-1337",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1092,6 +1110,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
productSku: "5-1337", productSku: "5-1337",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1167,6 +1186,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
productSku: "59-1337", productSku: "59-1337",
quantity: 3, quantity: 3,
quantityFulfilled: 0, quantityFulfilled: 0,
quantityToFulfill: 3,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1220,6 +1240,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
productSku: "5-1337", productSku: "5-1337",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1405,6 +1426,7 @@ export const draftOrder = (placeholder: string): OrderDetails_order => ({
productSku: "58-1338", productSku: "58-1338",
quantity: 2, quantity: 2,
quantityFulfilled: 0, quantityFulfilled: 0,
quantityToFulfill: 2,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1458,6 +1480,7 @@ export const draftOrder = (placeholder: string): OrderDetails_order => ({
productSku: "15-1337", productSku: "15-1337",
quantity: 2, quantity: 2,
quantityFulfilled: 0, quantityFulfilled: 0,
quantityToFulfill: 2,
thumbnail: { thumbnail: {
__typename: "Image" as "Image", __typename: "Image" as "Image",
url: placeholder url: placeholder
@ -1588,13 +1611,6 @@ export const variants = [
{ id: "p7", name: "Product 5: variant 2", sku: "14345", stockQuantity: 11 } { id: "p7", name: "Product 5: variant 2", sku: "14345", stockQuantity: 11 }
]; ];
export const prefixes = ["01", "02", "41", "49"]; export const prefixes = ["01", "02", "41", "49"];
export const countries: ShopInfo_shop_countries[] = [
{ __typename: "CountryDisplay", code: "AF", country: "Afghanistan" },
{ __typename: "CountryDisplay", code: "AX", country: "Åland Islands" },
{ __typename: "CountryDisplay", code: "AL", country: "Albania" },
{ __typename: "CountryDisplay", code: "DZ", country: "Algeria" },
{ __typename: "CountryDisplay", code: "AS", country: "American Samoa" }
];
export const shippingMethods = [ export const shippingMethods = [
{ country: "whole world", id: "s1", name: "DHL", price: {} }, { country: "whole world", id: "s1", name: "DHL", price: {} },
{ country: "Afghanistan", id: "s2", name: "UPS" } { country: "Afghanistan", id: "s2", name: "UPS" }
@ -1897,3 +1913,9 @@ export const orderSettings: OrderSettingsFragment = {
__typename: "OrderSettings", __typename: "OrderSettings",
automaticallyConfirmAllNewOrders: true automaticallyConfirmAllNewOrders: true
}; };
export const shopOrderSettings: ShopOrderSettingsFragment = {
__typename: "Shop",
fulfillmentAutoApprove: true,
fulfillmentAllowUnpaid: true
};

View file

@ -1,12 +1,14 @@
import { import {
invoiceErrorFragment, invoiceErrorFragment,
orderErrorFragment, orderErrorFragment,
orderSettingsErrorFragment orderSettingsErrorFragment,
shopErrorFragment
} from "@saleor/fragments/errors"; } from "@saleor/fragments/errors";
import { import {
fragmentOrderDetails, fragmentOrderDetails,
fragmentOrderEvent, fragmentOrderEvent,
fragmentOrderSettings, fragmentOrderSettings,
fragmentShopOrderSettings,
fulfillmentFragment, fulfillmentFragment,
invoiceFragment invoiceFragment
} from "@saleor/fragments/orders"; } from "@saleor/fragments/orders";
@ -63,6 +65,10 @@ import {
OrderDraftUpdate, OrderDraftUpdate,
OrderDraftUpdateVariables OrderDraftUpdateVariables
} from "./types/OrderDraftUpdate"; } from "./types/OrderDraftUpdate";
import {
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
} from "./types/OrderFulfillmentApprove";
import { import {
OrderFulfillmentCancel, OrderFulfillmentCancel,
OrderFulfillmentCancelVariables OrderFulfillmentCancelVariables
@ -461,6 +467,25 @@ export const TypedOrderFulfillmentUpdateTrackingMutation = TypedMutation<
OrderFulfillmentUpdateTrackingVariables OrderFulfillmentUpdateTrackingVariables
>(orderFulfillmentUpdateTrackingMutation); >(orderFulfillmentUpdateTrackingMutation);
const orderFulfillmentApproveMutation = gql`
${fragmentOrderDetails}
${orderErrorFragment}
mutation OrderFulfillmentApprove($id: ID!, $notifyCustomer: Boolean!) {
orderFulfillmentApprove(id: $id, notifyCustomer: $notifyCustomer) {
errors {
...OrderErrorFragment
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderFulfillmentApproveMutation = TypedMutation<
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
>(orderFulfillmentApproveMutation);
const orderFulfillmentCancelMutation = gql` const orderFulfillmentCancelMutation = gql`
${fragmentOrderDetails} ${fragmentOrderDetails}
${orderErrorFragment} ${orderErrorFragment}
@ -734,9 +759,14 @@ export const TypedInvoiceEmailSendMutation = TypedMutation<
const orderSettingsUpdateMutation = gql` const orderSettingsUpdateMutation = gql`
${fragmentOrderSettings} ${fragmentOrderSettings}
${fragmentShopOrderSettings}
${orderSettingsErrorFragment} ${orderSettingsErrorFragment}
mutation OrderSettingsUpdate($input: OrderSettingsUpdateInput!) { ${shopErrorFragment}
orderSettingsUpdate(input: $input) { mutation OrderSettingsUpdate(
$orderSettingsInput: OrderSettingsUpdateInput!
$shopSettingsInput: ShopSettingsInput!
) {
orderSettingsUpdate(input: $orderSettingsInput) {
errors { errors {
...OrderSettingsErrorFragment ...OrderSettingsErrorFragment
} }
@ -744,6 +774,14 @@ const orderSettingsUpdateMutation = gql`
...OrderSettingsFragment ...OrderSettingsFragment
} }
} }
shopSettingsUpdate(input: $shopSettingsInput) {
errors {
...ShopErrorFragment
}
shop {
...ShopOrderSettingsFragment
}
}
} }
`; `;
export const useOrderSettingsUpdateMutation = makeMutation< export const useOrderSettingsUpdateMutation = makeMutation<

View file

@ -2,9 +2,11 @@ import { fragmentAddress } from "@saleor/fragments/address";
import { import {
fragmentOrderDetails, fragmentOrderDetails,
fragmentOrderSettings, fragmentOrderSettings,
fragmentRefundOrderLine fragmentRefundOrderLine,
fragmentShopOrderSettings
} from "@saleor/fragments/orders"; } from "@saleor/fragments/orders";
import { fragmentMoney } from "@saleor/fragments/products"; import { fragmentMoney } from "@saleor/fragments/products";
import { warehouseFragment } from "@saleor/fragments/warehouses";
import makeQuery from "@saleor/hooks/makeQuery"; import makeQuery from "@saleor/hooks/makeQuery";
import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch";
import gql from "graphql-tag"; import gql from "graphql-tag";
@ -19,6 +21,7 @@ import {
OrderFulfillData, OrderFulfillData,
OrderFulfillDataVariables OrderFulfillDataVariables
} from "./types/OrderFulfillData"; } from "./types/OrderFulfillData";
import { OrderFulfillSettings } from "./types/OrderFulfillSettings";
import { OrderList, OrderListVariables } from "./types/OrderList"; import { OrderList, OrderListVariables } from "./types/OrderList";
import { import {
OrderRefundData, OrderRefundData,
@ -150,6 +153,8 @@ export const orderDetailsQuery = gql`
country country
} }
defaultWeightUnit defaultWeightUnit
fulfillmentAllowUnpaid
fulfillmentAutoApprove
} }
} }
`; `;
@ -217,9 +222,11 @@ export const useOrderVariantSearch = makeTopLevelSearch<
>(searchOrderVariant); >(searchOrderVariant);
const orderFulfillData = gql` const orderFulfillData = gql`
${warehouseFragment}
query OrderFulfillData($orderId: ID!) { query OrderFulfillData($orderId: ID!) {
order(id: $orderId) { order(id: $orderId) {
id id
isPaid
lines { lines {
id id
isShippingRequired isShippingRequired
@ -232,6 +239,7 @@ const orderFulfillData = gql`
} }
} }
quantityFulfilled quantityFulfilled
quantityToFulfill
variant { variant {
id id
name name
@ -245,7 +253,7 @@ const orderFulfillData = gql`
stocks { stocks {
id id
warehouse { warehouse {
id ...WarehouseFragment
} }
quantity quantity
quantityAllocated quantityAllocated
@ -265,12 +273,29 @@ export const useOrderFulfillData = makeQuery<
OrderFulfillDataVariables OrderFulfillDataVariables
>(orderFulfillData); >(orderFulfillData);
export const orderFulfillSettingsQuery = gql`
${fragmentShopOrderSettings}
query OrderFulfillSettings {
shop {
...ShopOrderSettingsFragment
}
}
`;
export const useOrderFulfillSettingsQuery = makeQuery<
OrderFulfillSettings,
never
>(orderFulfillSettingsQuery);
export const orderSettingsQuery = gql` export const orderSettingsQuery = gql`
${fragmentOrderSettings} ${fragmentOrderSettings}
${fragmentShopOrderSettings}
query OrderSettings { query OrderSettings {
orderSettings { orderSettings {
...OrderSettingsFragment ...OrderSettingsFragment
} }
shop {
...ShopOrderSettingsFragment
}
} }
`; `;
export const useOrderSettingsQuery = makeQuery<OrderSettings, never>( export const useOrderSettingsQuery = makeQuery<OrderSettings, never>(
@ -299,7 +324,7 @@ const orderRefundData = gql`
} }
lines { lines {
...RefundOrderLineFragment ...RefundOrderLineFragment
quantityFulfilled quantityToFulfill
} }
fulfillments { fulfillments {
id id

View file

@ -225,6 +225,7 @@ export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -320,6 +321,7 @@ export interface FulfillOrder_orderFulfill_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: FulfillOrder_orderFulfill_order_lines_unitDiscount; unitDiscount: FulfillOrder_orderFulfill_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -492,6 +494,7 @@ export interface FulfillOrder_orderFulfill_order {
fulfillments: (FulfillOrder_orderFulfill_order_fulfillments | null)[]; fulfillments: (FulfillOrder_orderFulfill_order_fulfillments | null)[];
lines: (FulfillOrder_orderFulfill_order_lines | null)[]; lines: (FulfillOrder_orderFulfill_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: FulfillOrder_orderFulfill_order_shippingAddress | null; shippingAddress: FulfillOrder_orderFulfill_order_shippingAddress | null;
shippingMethod: FulfillOrder_orderFulfill_order_shippingMethod | null; shippingMethod: FulfillOrder_orderFulfill_order_shippingMethod | null;
@ -509,7 +512,6 @@ export interface FulfillOrder_orderFulfill_order {
availableShippingMethods: (FulfillOrder_orderFulfill_order_availableShippingMethods | null)[] | null; availableShippingMethods: (FulfillOrder_orderFulfill_order_availableShippingMethods | null)[] | null;
invoices: (FulfillOrder_orderFulfill_order_invoices | null)[] | null; invoices: (FulfillOrder_orderFulfill_order_invoices | null)[] | null;
channel: FulfillOrder_orderFulfill_order_channel; channel: FulfillOrder_orderFulfill_order_channel;
isPaid: boolean;
} }
export interface FulfillOrder_orderFulfill { export interface FulfillOrder_orderFulfill {

View file

@ -223,6 +223,7 @@ export interface OrderCancel_orderCancel_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderCancel_orderCancel_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderCancel_orderCancel_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderCancel_orderCancel_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderCancel_orderCancel_order_lines_unitDiscount; unitDiscount: OrderCancel_orderCancel_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderCancel_orderCancel_order {
fulfillments: (OrderCancel_orderCancel_order_fulfillments | null)[]; fulfillments: (OrderCancel_orderCancel_order_fulfillments | null)[];
lines: (OrderCancel_orderCancel_order_lines | null)[]; lines: (OrderCancel_orderCancel_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderCancel_orderCancel_order_shippingAddress | null; shippingAddress: OrderCancel_orderCancel_order_shippingAddress | null;
shippingMethod: OrderCancel_orderCancel_order_shippingMethod | null; shippingMethod: OrderCancel_orderCancel_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderCancel_orderCancel_order {
availableShippingMethods: (OrderCancel_orderCancel_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderCancel_orderCancel_order_availableShippingMethods | null)[] | null;
invoices: (OrderCancel_orderCancel_order_invoices | null)[] | null; invoices: (OrderCancel_orderCancel_order_invoices | null)[] | null;
channel: OrderCancel_orderCancel_order_channel; channel: OrderCancel_orderCancel_order_channel;
isPaid: boolean;
} }
export interface OrderCancel_orderCancel { export interface OrderCancel_orderCancel {

View file

@ -223,6 +223,7 @@ export interface OrderCapture_orderCapture_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderCapture_orderCapture_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderCapture_orderCapture_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderCapture_orderCapture_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderCapture_orderCapture_order_lines_unitDiscount; unitDiscount: OrderCapture_orderCapture_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderCapture_orderCapture_order {
fulfillments: (OrderCapture_orderCapture_order_fulfillments | null)[]; fulfillments: (OrderCapture_orderCapture_order_fulfillments | null)[];
lines: (OrderCapture_orderCapture_order_lines | null)[]; lines: (OrderCapture_orderCapture_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderCapture_orderCapture_order_shippingAddress | null; shippingAddress: OrderCapture_orderCapture_order_shippingAddress | null;
shippingMethod: OrderCapture_orderCapture_order_shippingMethod | null; shippingMethod: OrderCapture_orderCapture_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderCapture_orderCapture_order {
availableShippingMethods: (OrderCapture_orderCapture_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderCapture_orderCapture_order_availableShippingMethods | null)[] | null;
invoices: (OrderCapture_orderCapture_order_invoices | null)[] | null; invoices: (OrderCapture_orderCapture_order_invoices | null)[] | null;
channel: OrderCapture_orderCapture_order_channel; channel: OrderCapture_orderCapture_order_channel;
isPaid: boolean;
} }
export interface OrderCapture_orderCapture { export interface OrderCapture_orderCapture {

View file

@ -223,6 +223,7 @@ export interface OrderConfirm_orderConfirm_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderConfirm_orderConfirm_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderConfirm_orderConfirm_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderConfirm_orderConfirm_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderConfirm_orderConfirm_order_lines_unitDiscount; unitDiscount: OrderConfirm_orderConfirm_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderConfirm_orderConfirm_order {
fulfillments: (OrderConfirm_orderConfirm_order_fulfillments | null)[]; fulfillments: (OrderConfirm_orderConfirm_order_fulfillments | null)[];
lines: (OrderConfirm_orderConfirm_order_lines | null)[]; lines: (OrderConfirm_orderConfirm_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderConfirm_orderConfirm_order_shippingAddress | null; shippingAddress: OrderConfirm_orderConfirm_order_shippingAddress | null;
shippingMethod: OrderConfirm_orderConfirm_order_shippingMethod | null; shippingMethod: OrderConfirm_orderConfirm_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderConfirm_orderConfirm_order {
availableShippingMethods: (OrderConfirm_orderConfirm_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderConfirm_orderConfirm_order_availableShippingMethods | null)[] | null;
invoices: (OrderConfirm_orderConfirm_order_invoices | null)[] | null; invoices: (OrderConfirm_orderConfirm_order_invoices | null)[] | null;
channel: OrderConfirm_orderConfirm_order_channel; channel: OrderConfirm_orderConfirm_order_channel;
isPaid: boolean;
} }
export interface OrderConfirm_orderConfirm { export interface OrderConfirm_orderConfirm {

View file

@ -216,6 +216,7 @@ export interface OrderDetails_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDetails_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDetails_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -311,6 +312,7 @@ export interface OrderDetails_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDetails_order_lines_unitDiscount; unitDiscount: OrderDetails_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -483,6 +485,7 @@ export interface OrderDetails_order {
fulfillments: (OrderDetails_order_fulfillments | null)[]; fulfillments: (OrderDetails_order_fulfillments | null)[];
lines: (OrderDetails_order_lines | null)[]; lines: (OrderDetails_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDetails_order_shippingAddress | null; shippingAddress: OrderDetails_order_shippingAddress | null;
shippingMethod: OrderDetails_order_shippingMethod | null; shippingMethod: OrderDetails_order_shippingMethod | null;
@ -500,7 +503,6 @@ export interface OrderDetails_order {
availableShippingMethods: (OrderDetails_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDetails_order_availableShippingMethods | null)[] | null;
invoices: (OrderDetails_order_invoices | null)[] | null; invoices: (OrderDetails_order_invoices | null)[] | null;
channel: OrderDetails_order_channel; channel: OrderDetails_order_channel;
isPaid: boolean;
} }
export interface OrderDetails_shop_countries { export interface OrderDetails_shop_countries {
@ -513,6 +515,8 @@ export interface OrderDetails_shop {
__typename: "Shop"; __typename: "Shop";
countries: OrderDetails_shop_countries[]; countries: OrderDetails_shop_countries[];
defaultWeightUnit: WeightUnitsEnum | null; defaultWeightUnit: WeightUnitsEnum | null;
fulfillmentAllowUnpaid: boolean;
fulfillmentAutoApprove: boolean;
} }
export interface OrderDetails { export interface OrderDetails {

View file

@ -223,6 +223,7 @@ export interface OrderDiscountAdd_orderDiscountAdd_order_fulfillments_lines_orde
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountAdd_orderDiscountAdd_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDiscountAdd_orderDiscountAdd_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDiscountAdd_orderDiscountAdd_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountAdd_orderDiscountAdd_order_lines_unitDiscount; unitDiscount: OrderDiscountAdd_orderDiscountAdd_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDiscountAdd_orderDiscountAdd_order {
fulfillments: (OrderDiscountAdd_orderDiscountAdd_order_fulfillments | null)[]; fulfillments: (OrderDiscountAdd_orderDiscountAdd_order_fulfillments | null)[];
lines: (OrderDiscountAdd_orderDiscountAdd_order_lines | null)[]; lines: (OrderDiscountAdd_orderDiscountAdd_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDiscountAdd_orderDiscountAdd_order_shippingAddress | null; shippingAddress: OrderDiscountAdd_orderDiscountAdd_order_shippingAddress | null;
shippingMethod: OrderDiscountAdd_orderDiscountAdd_order_shippingMethod | null; shippingMethod: OrderDiscountAdd_orderDiscountAdd_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDiscountAdd_orderDiscountAdd_order {
availableShippingMethods: (OrderDiscountAdd_orderDiscountAdd_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDiscountAdd_orderDiscountAdd_order_availableShippingMethods | null)[] | null;
invoices: (OrderDiscountAdd_orderDiscountAdd_order_invoices | null)[] | null; invoices: (OrderDiscountAdd_orderDiscountAdd_order_invoices | null)[] | null;
channel: OrderDiscountAdd_orderDiscountAdd_order_channel; channel: OrderDiscountAdd_orderDiscountAdd_order_channel;
isPaid: boolean;
} }
export interface OrderDiscountAdd_orderDiscountAdd { export interface OrderDiscountAdd_orderDiscountAdd {

View file

@ -223,6 +223,7 @@ export interface OrderDiscountDelete_orderDiscountDelete_order_fulfillments_line
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountDelete_orderDiscountDelete_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDiscountDelete_orderDiscountDelete_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDiscountDelete_orderDiscountDelete_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountDelete_orderDiscountDelete_order_lines_unitDiscount; unitDiscount: OrderDiscountDelete_orderDiscountDelete_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDiscountDelete_orderDiscountDelete_order {
fulfillments: (OrderDiscountDelete_orderDiscountDelete_order_fulfillments | null)[]; fulfillments: (OrderDiscountDelete_orderDiscountDelete_order_fulfillments | null)[];
lines: (OrderDiscountDelete_orderDiscountDelete_order_lines | null)[]; lines: (OrderDiscountDelete_orderDiscountDelete_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDiscountDelete_orderDiscountDelete_order_shippingAddress | null; shippingAddress: OrderDiscountDelete_orderDiscountDelete_order_shippingAddress | null;
shippingMethod: OrderDiscountDelete_orderDiscountDelete_order_shippingMethod | null; shippingMethod: OrderDiscountDelete_orderDiscountDelete_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDiscountDelete_orderDiscountDelete_order {
availableShippingMethods: (OrderDiscountDelete_orderDiscountDelete_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDiscountDelete_orderDiscountDelete_order_availableShippingMethods | null)[] | null;
invoices: (OrderDiscountDelete_orderDiscountDelete_order_invoices | null)[] | null; invoices: (OrderDiscountDelete_orderDiscountDelete_order_invoices | null)[] | null;
channel: OrderDiscountDelete_orderDiscountDelete_order_channel; channel: OrderDiscountDelete_orderDiscountDelete_order_channel;
isPaid: boolean;
} }
export interface OrderDiscountDelete_orderDiscountDelete { export interface OrderDiscountDelete_orderDiscountDelete {

View file

@ -223,6 +223,7 @@ export interface OrderDiscountUpdate_orderDiscountUpdate_order_fulfillments_line
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountUpdate_orderDiscountUpdate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDiscountUpdate_orderDiscountUpdate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDiscountUpdate_orderDiscountUpdate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDiscountUpdate_orderDiscountUpdate_order_lines_unitDiscount; unitDiscount: OrderDiscountUpdate_orderDiscountUpdate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDiscountUpdate_orderDiscountUpdate_order {
fulfillments: (OrderDiscountUpdate_orderDiscountUpdate_order_fulfillments | null)[]; fulfillments: (OrderDiscountUpdate_orderDiscountUpdate_order_fulfillments | null)[];
lines: (OrderDiscountUpdate_orderDiscountUpdate_order_lines | null)[]; lines: (OrderDiscountUpdate_orderDiscountUpdate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDiscountUpdate_orderDiscountUpdate_order_shippingAddress | null; shippingAddress: OrderDiscountUpdate_orderDiscountUpdate_order_shippingAddress | null;
shippingMethod: OrderDiscountUpdate_orderDiscountUpdate_order_shippingMethod | null; shippingMethod: OrderDiscountUpdate_orderDiscountUpdate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDiscountUpdate_orderDiscountUpdate_order {
availableShippingMethods: (OrderDiscountUpdate_orderDiscountUpdate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDiscountUpdate_orderDiscountUpdate_order_availableShippingMethods | null)[] | null;
invoices: (OrderDiscountUpdate_orderDiscountUpdate_order_invoices | null)[] | null; invoices: (OrderDiscountUpdate_orderDiscountUpdate_order_invoices | null)[] | null;
channel: OrderDiscountUpdate_orderDiscountUpdate_order_channel; channel: OrderDiscountUpdate_orderDiscountUpdate_order_channel;
isPaid: boolean;
} }
export interface OrderDiscountUpdate_orderDiscountUpdate { export interface OrderDiscountUpdate_orderDiscountUpdate {

View file

@ -223,6 +223,7 @@ export interface OrderDraftCancel_draftOrderDelete_order_fulfillments_lines_orde
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftCancel_draftOrderDelete_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDraftCancel_draftOrderDelete_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDraftCancel_draftOrderDelete_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftCancel_draftOrderDelete_order_lines_unitDiscount; unitDiscount: OrderDraftCancel_draftOrderDelete_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDraftCancel_draftOrderDelete_order {
fulfillments: (OrderDraftCancel_draftOrderDelete_order_fulfillments | null)[]; fulfillments: (OrderDraftCancel_draftOrderDelete_order_fulfillments | null)[];
lines: (OrderDraftCancel_draftOrderDelete_order_lines | null)[]; lines: (OrderDraftCancel_draftOrderDelete_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDraftCancel_draftOrderDelete_order_shippingAddress | null; shippingAddress: OrderDraftCancel_draftOrderDelete_order_shippingAddress | null;
shippingMethod: OrderDraftCancel_draftOrderDelete_order_shippingMethod | null; shippingMethod: OrderDraftCancel_draftOrderDelete_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDraftCancel_draftOrderDelete_order {
availableShippingMethods: (OrderDraftCancel_draftOrderDelete_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDraftCancel_draftOrderDelete_order_availableShippingMethods | null)[] | null;
invoices: (OrderDraftCancel_draftOrderDelete_order_invoices | null)[] | null; invoices: (OrderDraftCancel_draftOrderDelete_order_invoices | null)[] | null;
channel: OrderDraftCancel_draftOrderDelete_order_channel; channel: OrderDraftCancel_draftOrderDelete_order_channel;
isPaid: boolean;
} }
export interface OrderDraftCancel_draftOrderDelete { export interface OrderDraftCancel_draftOrderDelete {

View file

@ -223,6 +223,7 @@ export interface OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDraftFinalize_draftOrderComplete_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDraftFinalize_draftOrderComplete_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftFinalize_draftOrderComplete_order_lines_unitDiscount; unitDiscount: OrderDraftFinalize_draftOrderComplete_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDraftFinalize_draftOrderComplete_order {
fulfillments: (OrderDraftFinalize_draftOrderComplete_order_fulfillments | null)[]; fulfillments: (OrderDraftFinalize_draftOrderComplete_order_fulfillments | null)[];
lines: (OrderDraftFinalize_draftOrderComplete_order_lines | null)[]; lines: (OrderDraftFinalize_draftOrderComplete_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDraftFinalize_draftOrderComplete_order_shippingAddress | null; shippingAddress: OrderDraftFinalize_draftOrderComplete_order_shippingAddress | null;
shippingMethod: OrderDraftFinalize_draftOrderComplete_order_shippingMethod | null; shippingMethod: OrderDraftFinalize_draftOrderComplete_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDraftFinalize_draftOrderComplete_order {
availableShippingMethods: (OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods | null)[] | null;
invoices: (OrderDraftFinalize_draftOrderComplete_order_invoices | null)[] | null; invoices: (OrderDraftFinalize_draftOrderComplete_order_invoices | null)[] | null;
channel: OrderDraftFinalize_draftOrderComplete_order_channel; channel: OrderDraftFinalize_draftOrderComplete_order_channel;
isPaid: boolean;
} }
export interface OrderDraftFinalize_draftOrderComplete { export interface OrderDraftFinalize_draftOrderComplete {

View file

@ -223,6 +223,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_fulfillments_lines_orde
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftUpdate_draftOrderUpdate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderDraftUpdate_draftOrderUpdate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderDraftUpdate_draftOrderUpdate_order_lines_unitDiscount; unitDiscount: OrderDraftUpdate_draftOrderUpdate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order {
fulfillments: (OrderDraftUpdate_draftOrderUpdate_order_fulfillments | null)[]; fulfillments: (OrderDraftUpdate_draftOrderUpdate_order_fulfillments | null)[];
lines: (OrderDraftUpdate_draftOrderUpdate_order_lines | null)[]; lines: (OrderDraftUpdate_draftOrderUpdate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderDraftUpdate_draftOrderUpdate_order_shippingAddress | null; shippingAddress: OrderDraftUpdate_draftOrderUpdate_order_shippingAddress | null;
shippingMethod: OrderDraftUpdate_draftOrderUpdate_order_shippingMethod | null; shippingMethod: OrderDraftUpdate_draftOrderUpdate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderDraftUpdate_draftOrderUpdate_order {
availableShippingMethods: (OrderDraftUpdate_draftOrderUpdate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderDraftUpdate_draftOrderUpdate_order_availableShippingMethods | null)[] | null;
invoices: (OrderDraftUpdate_draftOrderUpdate_order_invoices | null)[] | null; invoices: (OrderDraftUpdate_draftOrderUpdate_order_invoices | null)[] | null;
channel: OrderDraftUpdate_draftOrderUpdate_order_channel; channel: OrderDraftUpdate_draftOrderUpdate_order_channel;
isPaid: boolean;
} }
export interface OrderDraftUpdate_draftOrderUpdate { export interface OrderDraftUpdate_draftOrderUpdate {

View file

@ -32,6 +32,7 @@ export interface OrderFulfillData_order_lines_variant_attributes {
export interface OrderFulfillData_order_lines_variant_stocks_warehouse { export interface OrderFulfillData_order_lines_variant_stocks_warehouse {
__typename: "Warehouse"; __typename: "Warehouse";
id: string; id: string;
name: string;
} }
export interface OrderFulfillData_order_lines_variant_stocks { export interface OrderFulfillData_order_lines_variant_stocks {
@ -65,6 +66,7 @@ export interface OrderFulfillData_order_lines {
quantity: number; quantity: number;
allocations: OrderFulfillData_order_lines_allocations[] | null; allocations: OrderFulfillData_order_lines_allocations[] | null;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
variant: OrderFulfillData_order_lines_variant | null; variant: OrderFulfillData_order_lines_variant | null;
thumbnail: OrderFulfillData_order_lines_thumbnail | null; thumbnail: OrderFulfillData_order_lines_thumbnail | null;
} }
@ -72,6 +74,7 @@ export interface OrderFulfillData_order_lines {
export interface OrderFulfillData_order { export interface OrderFulfillData_order {
__typename: "Order"; __typename: "Order";
id: string; id: string;
isPaid: boolean;
lines: (OrderFulfillData_order_lines | null)[]; lines: (OrderFulfillData_order_lines | null)[];
number: string | null; number: string | null;
} }

View file

@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
// ====================================================
// GraphQL query operation: OrderFulfillSettings
// ====================================================
export interface OrderFulfillSettings_shop {
__typename: "Shop";
fulfillmentAutoApprove: boolean;
fulfillmentAllowUnpaid: boolean;
}
export interface OrderFulfillSettings {
shop: OrderFulfillSettings_shop;
}

View file

@ -0,0 +1,528 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
import { OrderErrorCode, AddressTypeEnum, OrderDiscountType, DiscountValueTypeEnum, OrderEventsEmailsEnum, OrderEventsEnum, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction, JobStatusEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: OrderFulfillmentApprove
// ====================================================
export interface OrderFulfillmentApprove_orderFulfillmentApprove_errors {
__typename: "OrderError";
code: OrderErrorCode;
field: string | null;
addressType: AddressTypeEnum | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_billingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_billingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
country: OrderFulfillmentApprove_orderFulfillmentApprove_order_billingAddress_country;
countryArea: string;
firstName: string;
id: string;
lastName: string;
phone: string | null;
postalCode: string;
streetAddress1: string;
streetAddress2: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_discounts_amount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_discounts {
__typename: "OrderDiscount";
id: string;
type: OrderDiscountType;
calculationMode: DiscountValueTypeEnum;
value: any;
reason: string | null;
amount: OrderFulfillmentApprove_orderFulfillmentApprove_order_discounts_amount;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount_amount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount_oldAmount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount {
__typename: "OrderEventDiscountObject";
valueType: DiscountValueTypeEnum;
value: any;
reason: string | null;
amount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount_amount | null;
oldValueType: DiscountValueTypeEnum | null;
oldValue: any | null;
oldAmount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount_oldAmount | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_relatedOrder {
__typename: "Order";
id: string;
number: string | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_user {
__typename: "User";
id: string;
email: string;
firstName: string;
lastName: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount_amount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount_oldAmount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount {
__typename: "OrderEventDiscountObject";
valueType: DiscountValueTypeEnum;
value: any;
reason: string | null;
amount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount_amount | null;
oldValueType: DiscountValueTypeEnum | null;
oldValue: any | null;
oldAmount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount_oldAmount | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_orderLine {
__typename: "OrderLine";
id: string;
productName: string;
variantName: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines {
__typename: "OrderEventOrderLineObject";
quantity: number | null;
itemName: string | null;
discount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_discount | null;
orderLine: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines_orderLine | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_events {
__typename: "OrderEvent";
id: string;
amount: number | null;
shippingCostsIncluded: boolean | null;
date: any | null;
email: string | null;
emailType: OrderEventsEmailsEnum | null;
invoiceNumber: string | null;
discount: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_discount | null;
relatedOrder: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_relatedOrder | null;
message: string | null;
quantity: number | null;
transactionReference: string | null;
type: OrderEventsEnum | null;
user: OrderFulfillmentApprove_orderFulfillmentApprove_order_events_user | null;
lines: (OrderFulfillmentApprove_orderFulfillmentApprove_order_events_lines | null)[] | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_variant {
__typename: "ProductVariant";
id: string;
quantityAvailable: number;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitDiscount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice {
__typename: "TaxedMoney";
currency: string;
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice_net;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice {
__typename: "TaxedMoney";
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice_net;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_thumbnail {
__typename: "Image";
url: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine {
__typename: "OrderLine";
id: string;
isShippingRequired: boolean;
variant: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_variant | null;
productName: string;
productSku: string;
quantity: number;
quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any;
unitDiscountReason: string | null;
unitDiscountType: DiscountValueTypeEnum | null;
undiscountedUnitPrice: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_undiscountedUnitPrice;
unitPrice: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_unitPrice;
thumbnail: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine_thumbnail | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines {
__typename: "FulfillmentLine";
id: string;
quantity: number;
orderLine: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines_orderLine | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments {
__typename: "Fulfillment";
id: string;
lines: (OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_lines | null)[] | null;
fulfillmentOrder: number;
status: FulfillmentStatus;
trackingNumber: string;
warehouse: OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments_warehouse | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_variant {
__typename: "ProductVariant";
id: string;
quantityAvailable: number;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitDiscount {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice {
__typename: "TaxedMoney";
currency: string;
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice_net;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice {
__typename: "TaxedMoney";
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice_net;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_thumbnail {
__typename: "Image";
url: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_lines {
__typename: "OrderLine";
id: string;
isShippingRequired: boolean;
variant: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_variant | null;
productName: string;
productSku: string;
quantity: number;
quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitDiscount;
unitDiscountValue: any;
unitDiscountReason: string | null;
unitDiscountType: DiscountValueTypeEnum | null;
undiscountedUnitPrice: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_undiscountedUnitPrice;
unitPrice: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_unitPrice;
thumbnail: OrderFulfillmentApprove_orderFulfillmentApprove_order_lines_thumbnail | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
country: OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingAddress_country;
countryArea: string;
firstName: string;
id: string;
lastName: string;
phone: string | null;
postalCode: string;
streetAddress1: string;
streetAddress2: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingMethod {
__typename: "ShippingMethod";
id: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingPrice {
__typename: "TaxedMoney";
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingPrice_gross;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal {
__typename: "TaxedMoney";
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal_net;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_total_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_total_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_total_tax {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_total {
__typename: "TaxedMoney";
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_total_gross;
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_total_net;
tax: OrderFulfillmentApprove_orderFulfillmentApprove_order_total_tax;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal {
__typename: "TaxedMoney";
net: OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal_net;
gross: OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal_gross;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_user {
__typename: "User";
id: string;
email: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_availableShippingMethods_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_availableShippingMethods {
__typename: "ShippingMethod";
id: string;
name: string;
price: OrderFulfillmentApprove_orderFulfillmentApprove_order_availableShippingMethods_price | null;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_invoices {
__typename: "Invoice";
id: string;
number: string | null;
createdAt: any;
url: string | null;
status: JobStatusEnum;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order_channel {
__typename: "Channel";
isActive: boolean;
id: string;
name: string;
currencyCode: string;
slug: string;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove_order {
__typename: "Order";
id: string;
metadata: (OrderFulfillmentApprove_orderFulfillmentApprove_order_metadata | null)[];
privateMetadata: (OrderFulfillmentApprove_orderFulfillmentApprove_order_privateMetadata | null)[];
billingAddress: OrderFulfillmentApprove_orderFulfillmentApprove_order_billingAddress | null;
isShippingRequired: boolean;
canFinalize: boolean;
created: any;
customerNote: string;
discounts: OrderFulfillmentApprove_orderFulfillmentApprove_order_discounts[] | null;
events: (OrderFulfillmentApprove_orderFulfillmentApprove_order_events | null)[] | null;
fulfillments: (OrderFulfillmentApprove_orderFulfillmentApprove_order_fulfillments | null)[];
lines: (OrderFulfillmentApprove_orderFulfillmentApprove_order_lines | null)[];
number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingAddress | null;
shippingMethod: OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingMethod | null;
shippingMethodName: string | null;
shippingPrice: OrderFulfillmentApprove_orderFulfillmentApprove_order_shippingPrice;
status: OrderStatus;
subtotal: OrderFulfillmentApprove_orderFulfillmentApprove_order_subtotal;
total: OrderFulfillmentApprove_orderFulfillmentApprove_order_total;
actions: (OrderAction | null)[];
totalAuthorized: OrderFulfillmentApprove_orderFulfillmentApprove_order_totalAuthorized;
totalCaptured: OrderFulfillmentApprove_orderFulfillmentApprove_order_totalCaptured;
undiscountedTotal: OrderFulfillmentApprove_orderFulfillmentApprove_order_undiscountedTotal;
user: OrderFulfillmentApprove_orderFulfillmentApprove_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderFulfillmentApprove_orderFulfillmentApprove_order_availableShippingMethods | null)[] | null;
invoices: (OrderFulfillmentApprove_orderFulfillmentApprove_order_invoices | null)[] | null;
channel: OrderFulfillmentApprove_orderFulfillmentApprove_order_channel;
}
export interface OrderFulfillmentApprove_orderFulfillmentApprove {
__typename: "FulfillmentApprove";
errors: OrderFulfillmentApprove_orderFulfillmentApprove_errors[];
order: OrderFulfillmentApprove_orderFulfillmentApprove_order | null;
}
export interface OrderFulfillmentApprove {
orderFulfillmentApprove: OrderFulfillmentApprove_orderFulfillmentApprove | null;
}
export interface OrderFulfillmentApproveVariables {
id: string;
notifyCustomer: boolean;
}

View file

@ -223,6 +223,7 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_fulfillment
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentCancel_orderFulfillmentCancel_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderFulfillmentCancel_orderFulfillmentCancel_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentCancel_orderFulfillmentCancel_order_lines_unitDiscount; unitDiscount: OrderFulfillmentCancel_orderFulfillmentCancel_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order {
fulfillments: (OrderFulfillmentCancel_orderFulfillmentCancel_order_fulfillments | null)[]; fulfillments: (OrderFulfillmentCancel_orderFulfillmentCancel_order_fulfillments | null)[];
lines: (OrderFulfillmentCancel_orderFulfillmentCancel_order_lines | null)[]; lines: (OrderFulfillmentCancel_orderFulfillmentCancel_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderFulfillmentCancel_orderFulfillmentCancel_order_shippingAddress | null; shippingAddress: OrderFulfillmentCancel_orderFulfillmentCancel_order_shippingAddress | null;
shippingMethod: OrderFulfillmentCancel_orderFulfillmentCancel_order_shippingMethod | null; shippingMethod: OrderFulfillmentCancel_orderFulfillmentCancel_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order {
availableShippingMethods: (OrderFulfillmentCancel_orderFulfillmentCancel_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderFulfillmentCancel_orderFulfillmentCancel_order_availableShippingMethods | null)[] | null;
invoices: (OrderFulfillmentCancel_orderFulfillmentCancel_order_invoices | null)[] | null; invoices: (OrderFulfillmentCancel_orderFulfillmentCancel_order_invoices | null)[] | null;
channel: OrderFulfillmentCancel_orderFulfillmentCancel_order_channel; channel: OrderFulfillmentCancel_orderFulfillmentCancel_order_channel;
isPaid: boolean;
} }
export interface OrderFulfillmentCancel_orderFulfillmentCancel { export interface OrderFulfillmentCancel_orderFulfillmentCancel {

View file

@ -79,6 +79,7 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_f
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_fulfillment_lines_orderLine_unitDiscount; unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_fulfillment_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_o
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -413,6 +415,7 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_o
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_lines_unitDiscount; unitDiscount: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -585,6 +588,7 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_o
fulfillments: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_fulfillments | null)[]; fulfillments: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_fulfillments | null)[];
lines: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_lines | null)[]; lines: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_shippingAddress | null; shippingAddress: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_shippingAddress | null;
shippingMethod: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_shippingMethod | null; shippingMethod: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_shippingMethod | null;
@ -602,7 +606,6 @@ export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_o
availableShippingMethods: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_availableShippingMethods | null)[] | null;
invoices: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_invoices | null)[] | null; invoices: (OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_invoices | null)[] | null;
channel: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_channel; channel: OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts_order_channel;
isPaid: boolean;
} }
export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts { export interface OrderFulfillmentRefundProducts_orderFulfillmentRefundProducts {

View file

@ -223,6 +223,7 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_lines_unitDiscount; unitDiscount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
fulfillments: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_fulfillments | null)[]; fulfillments: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_fulfillments | null)[];
lines: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_lines | null)[]; lines: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_shippingAddress | null; shippingAddress: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_shippingAddress | null;
shippingMethod: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_shippingMethod | null; shippingMethod: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
availableShippingMethods: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_availableShippingMethods | null)[] | null;
invoices: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_invoices | null)[] | null; invoices: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_invoices | null)[] | null;
channel: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_channel; channel: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_channel;
isPaid: boolean;
} }
export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking { export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking {

View file

@ -223,6 +223,7 @@ export interface OrderLineDelete_orderLineDelete_order_fulfillments_lines_orderL
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDelete_orderLineDelete_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderLineDelete_orderLineDelete_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderLineDelete_orderLineDelete_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDelete_orderLineDelete_order_lines_unitDiscount; unitDiscount: OrderLineDelete_orderLineDelete_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderLineDelete_orderLineDelete_order {
fulfillments: (OrderLineDelete_orderLineDelete_order_fulfillments | null)[]; fulfillments: (OrderLineDelete_orderLineDelete_order_fulfillments | null)[];
lines: (OrderLineDelete_orderLineDelete_order_lines | null)[]; lines: (OrderLineDelete_orderLineDelete_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderLineDelete_orderLineDelete_order_shippingAddress | null; shippingAddress: OrderLineDelete_orderLineDelete_order_shippingAddress | null;
shippingMethod: OrderLineDelete_orderLineDelete_order_shippingMethod | null; shippingMethod: OrderLineDelete_orderLineDelete_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderLineDelete_orderLineDelete_order {
availableShippingMethods: (OrderLineDelete_orderLineDelete_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderLineDelete_orderLineDelete_order_availableShippingMethods | null)[] | null;
invoices: (OrderLineDelete_orderLineDelete_order_invoices | null)[] | null; invoices: (OrderLineDelete_orderLineDelete_order_invoices | null)[] | null;
channel: OrderLineDelete_orderLineDelete_order_channel; channel: OrderLineDelete_orderLineDelete_order_channel;
isPaid: boolean;
} }
export interface OrderLineDelete_orderLineDelete { export interface OrderLineDelete_orderLineDelete {

View file

@ -223,6 +223,7 @@ export interface OrderLineDiscountRemove_orderLineDiscountRemove_order_fulfillme
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDiscountRemove_orderLineDiscountRemove_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderLineDiscountRemove_orderLineDiscountRemove_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderLineDiscountRemove_orderLineDiscountRemove_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDiscountRemove_orderLineDiscountRemove_order_lines_unitDiscount; unitDiscount: OrderLineDiscountRemove_orderLineDiscountRemove_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderLineDiscountRemove_orderLineDiscountRemove_order {
fulfillments: (OrderLineDiscountRemove_orderLineDiscountRemove_order_fulfillments | null)[]; fulfillments: (OrderLineDiscountRemove_orderLineDiscountRemove_order_fulfillments | null)[];
lines: (OrderLineDiscountRemove_orderLineDiscountRemove_order_lines | null)[]; lines: (OrderLineDiscountRemove_orderLineDiscountRemove_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderLineDiscountRemove_orderLineDiscountRemove_order_shippingAddress | null; shippingAddress: OrderLineDiscountRemove_orderLineDiscountRemove_order_shippingAddress | null;
shippingMethod: OrderLineDiscountRemove_orderLineDiscountRemove_order_shippingMethod | null; shippingMethod: OrderLineDiscountRemove_orderLineDiscountRemove_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderLineDiscountRemove_orderLineDiscountRemove_order {
availableShippingMethods: (OrderLineDiscountRemove_orderLineDiscountRemove_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderLineDiscountRemove_orderLineDiscountRemove_order_availableShippingMethods | null)[] | null;
invoices: (OrderLineDiscountRemove_orderLineDiscountRemove_order_invoices | null)[] | null; invoices: (OrderLineDiscountRemove_orderLineDiscountRemove_order_invoices | null)[] | null;
channel: OrderLineDiscountRemove_orderLineDiscountRemove_order_channel; channel: OrderLineDiscountRemove_orderLineDiscountRemove_order_channel;
isPaid: boolean;
} }
export interface OrderLineDiscountRemove_orderLineDiscountRemove { export interface OrderLineDiscountRemove_orderLineDiscountRemove {

View file

@ -223,6 +223,7 @@ export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order_fulfillme
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_lines_unitDiscount; unitDiscount: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order {
fulfillments: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_fulfillments | null)[]; fulfillments: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_fulfillments | null)[];
lines: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_lines | null)[]; lines: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_shippingAddress | null; shippingAddress: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_shippingAddress | null;
shippingMethod: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_shippingMethod | null; shippingMethod: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderLineDiscountUpdate_orderLineDiscountUpdate_order {
availableShippingMethods: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_availableShippingMethods | null)[] | null;
invoices: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_invoices | null)[] | null; invoices: (OrderLineDiscountUpdate_orderLineDiscountUpdate_order_invoices | null)[] | null;
channel: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_channel; channel: OrderLineDiscountUpdate_orderLineDiscountUpdate_order_channel;
isPaid: boolean;
} }
export interface OrderLineDiscountUpdate_orderLineDiscountUpdate { export interface OrderLineDiscountUpdate_orderLineDiscountUpdate {

View file

@ -223,6 +223,7 @@ export interface OrderLineUpdate_orderLineUpdate_order_fulfillments_lines_orderL
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineUpdate_orderLineUpdate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderLineUpdate_orderLineUpdate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderLineUpdate_orderLineUpdate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLineUpdate_orderLineUpdate_order_lines_unitDiscount; unitDiscount: OrderLineUpdate_orderLineUpdate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderLineUpdate_orderLineUpdate_order {
fulfillments: (OrderLineUpdate_orderLineUpdate_order_fulfillments | null)[]; fulfillments: (OrderLineUpdate_orderLineUpdate_order_fulfillments | null)[];
lines: (OrderLineUpdate_orderLineUpdate_order_lines | null)[]; lines: (OrderLineUpdate_orderLineUpdate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderLineUpdate_orderLineUpdate_order_shippingAddress | null; shippingAddress: OrderLineUpdate_orderLineUpdate_order_shippingAddress | null;
shippingMethod: OrderLineUpdate_orderLineUpdate_order_shippingMethod | null; shippingMethod: OrderLineUpdate_orderLineUpdate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderLineUpdate_orderLineUpdate_order {
availableShippingMethods: (OrderLineUpdate_orderLineUpdate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderLineUpdate_orderLineUpdate_order_availableShippingMethods | null)[] | null;
invoices: (OrderLineUpdate_orderLineUpdate_order_invoices | null)[] | null; invoices: (OrderLineUpdate_orderLineUpdate_order_invoices | null)[] | null;
channel: OrderLineUpdate_orderLineUpdate_order_channel; channel: OrderLineUpdate_orderLineUpdate_order_channel;
isPaid: boolean;
} }
export interface OrderLineUpdate_orderLineUpdate { export interface OrderLineUpdate_orderLineUpdate {

View file

@ -223,6 +223,7 @@ export interface OrderLinesAdd_orderLinesCreate_order_fulfillments_lines_orderLi
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLinesAdd_orderLinesCreate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderLinesAdd_orderLinesCreate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderLinesAdd_orderLinesCreate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderLinesAdd_orderLinesCreate_order_lines_unitDiscount; unitDiscount: OrderLinesAdd_orderLinesCreate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderLinesAdd_orderLinesCreate_order {
fulfillments: (OrderLinesAdd_orderLinesCreate_order_fulfillments | null)[]; fulfillments: (OrderLinesAdd_orderLinesCreate_order_fulfillments | null)[];
lines: (OrderLinesAdd_orderLinesCreate_order_lines | null)[]; lines: (OrderLinesAdd_orderLinesCreate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderLinesAdd_orderLinesCreate_order_shippingAddress | null; shippingAddress: OrderLinesAdd_orderLinesCreate_order_shippingAddress | null;
shippingMethod: OrderLinesAdd_orderLinesCreate_order_shippingMethod | null; shippingMethod: OrderLinesAdd_orderLinesCreate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderLinesAdd_orderLinesCreate_order {
availableShippingMethods: (OrderLinesAdd_orderLinesCreate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderLinesAdd_orderLinesCreate_order_availableShippingMethods | null)[] | null;
invoices: (OrderLinesAdd_orderLinesCreate_order_invoices | null)[] | null; invoices: (OrderLinesAdd_orderLinesCreate_order_invoices | null)[] | null;
channel: OrderLinesAdd_orderLinesCreate_order_channel; channel: OrderLinesAdd_orderLinesCreate_order_channel;
isPaid: boolean;
} }
export interface OrderLinesAdd_orderLinesCreate { export interface OrderLinesAdd_orderLinesCreate {

View file

@ -223,6 +223,7 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order_fulfillments_lines_orderL
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderMarkAsPaid_orderMarkAsPaid_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderMarkAsPaid_orderMarkAsPaid_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderMarkAsPaid_orderMarkAsPaid_order_lines_unitDiscount; unitDiscount: OrderMarkAsPaid_orderMarkAsPaid_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order {
fulfillments: (OrderMarkAsPaid_orderMarkAsPaid_order_fulfillments | null)[]; fulfillments: (OrderMarkAsPaid_orderMarkAsPaid_order_fulfillments | null)[];
lines: (OrderMarkAsPaid_orderMarkAsPaid_order_lines | null)[]; lines: (OrderMarkAsPaid_orderMarkAsPaid_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderMarkAsPaid_orderMarkAsPaid_order_shippingAddress | null; shippingAddress: OrderMarkAsPaid_orderMarkAsPaid_order_shippingAddress | null;
shippingMethod: OrderMarkAsPaid_orderMarkAsPaid_order_shippingMethod | null; shippingMethod: OrderMarkAsPaid_orderMarkAsPaid_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order {
availableShippingMethods: (OrderMarkAsPaid_orderMarkAsPaid_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderMarkAsPaid_orderMarkAsPaid_order_availableShippingMethods | null)[] | null;
invoices: (OrderMarkAsPaid_orderMarkAsPaid_order_invoices | null)[] | null; invoices: (OrderMarkAsPaid_orderMarkAsPaid_order_invoices | null)[] | null;
channel: OrderMarkAsPaid_orderMarkAsPaid_order_channel; channel: OrderMarkAsPaid_orderMarkAsPaid_order_channel;
isPaid: boolean;
} }
export interface OrderMarkAsPaid_orderMarkAsPaid { export interface OrderMarkAsPaid_orderMarkAsPaid {

View file

@ -223,6 +223,7 @@ export interface OrderRefund_orderRefund_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderRefund_orderRefund_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderRefund_orderRefund_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderRefund_orderRefund_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderRefund_orderRefund_order_lines_unitDiscount; unitDiscount: OrderRefund_orderRefund_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderRefund_orderRefund_order {
fulfillments: (OrderRefund_orderRefund_order_fulfillments | null)[]; fulfillments: (OrderRefund_orderRefund_order_fulfillments | null)[];
lines: (OrderRefund_orderRefund_order_lines | null)[]; lines: (OrderRefund_orderRefund_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderRefund_orderRefund_order_shippingAddress | null; shippingAddress: OrderRefund_orderRefund_order_shippingAddress | null;
shippingMethod: OrderRefund_orderRefund_order_shippingMethod | null; shippingMethod: OrderRefund_orderRefund_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderRefund_orderRefund_order {
availableShippingMethods: (OrderRefund_orderRefund_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderRefund_orderRefund_order_availableShippingMethods | null)[] | null;
invoices: (OrderRefund_orderRefund_order_invoices | null)[] | null; invoices: (OrderRefund_orderRefund_order_invoices | null)[] | null;
channel: OrderRefund_orderRefund_order_channel; channel: OrderRefund_orderRefund_order_channel;
isPaid: boolean;
} }
export interface OrderRefund_orderRefund { export interface OrderRefund_orderRefund {

View file

@ -60,7 +60,7 @@ export interface OrderRefundData_order_lines {
quantity: number; quantity: number;
unitPrice: OrderRefundData_order_lines_unitPrice; unitPrice: OrderRefundData_order_lines_unitPrice;
thumbnail: OrderRefundData_order_lines_thumbnail | null; thumbnail: OrderRefundData_order_lines_thumbnail | null;
quantityFulfilled: number; quantityToFulfill: number;
} }
export interface OrderRefundData_order_fulfillments_lines_orderLine_unitPrice_gross { export interface OrderRefundData_order_fulfillments_lines_orderLine_unitPrice_gross {

View file

@ -12,6 +12,13 @@ export interface OrderSettings_orderSettings {
automaticallyConfirmAllNewOrders: boolean; automaticallyConfirmAllNewOrders: boolean;
} }
export interface OrderSettings_shop {
__typename: "Shop";
fulfillmentAutoApprove: boolean;
fulfillmentAllowUnpaid: boolean;
}
export interface OrderSettings { export interface OrderSettings {
orderSettings: OrderSettings_orderSettings | null; orderSettings: OrderSettings_orderSettings | null;
shop: OrderSettings_shop;
} }

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { OrderSettingsUpdateInput, OrderSettingsErrorCode } from "./../../types/globalTypes"; import { OrderSettingsUpdateInput, ShopSettingsInput, OrderSettingsErrorCode, ShopErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: OrderSettingsUpdate // GraphQL mutation operation: OrderSettingsUpdate
@ -26,10 +26,30 @@ export interface OrderSettingsUpdate_orderSettingsUpdate {
orderSettings: OrderSettingsUpdate_orderSettingsUpdate_orderSettings | null; orderSettings: OrderSettingsUpdate_orderSettingsUpdate_orderSettings | null;
} }
export interface OrderSettingsUpdate_shopSettingsUpdate_errors {
__typename: "ShopError";
code: ShopErrorCode;
field: string | null;
}
export interface OrderSettingsUpdate_shopSettingsUpdate_shop {
__typename: "Shop";
fulfillmentAutoApprove: boolean;
fulfillmentAllowUnpaid: boolean;
}
export interface OrderSettingsUpdate_shopSettingsUpdate {
__typename: "ShopSettingsUpdate";
errors: OrderSettingsUpdate_shopSettingsUpdate_errors[];
shop: OrderSettingsUpdate_shopSettingsUpdate_shop | null;
}
export interface OrderSettingsUpdate { export interface OrderSettingsUpdate {
orderSettingsUpdate: OrderSettingsUpdate_orderSettingsUpdate | null; orderSettingsUpdate: OrderSettingsUpdate_orderSettingsUpdate | null;
shopSettingsUpdate: OrderSettingsUpdate_shopSettingsUpdate | null;
} }
export interface OrderSettingsUpdateVariables { export interface OrderSettingsUpdateVariables {
input: OrderSettingsUpdateInput; orderSettingsInput: OrderSettingsUpdateInput;
shopSettingsInput: ShopSettingsInput;
} }

View file

@ -285,6 +285,7 @@ export interface OrderShippingMethodUpdate_orderUpdateShipping_order_fulfillment
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderShippingMethodUpdate_orderUpdateShipping_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderShippingMethodUpdate_orderUpdateShipping_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -380,6 +381,7 @@ export interface OrderShippingMethodUpdate_orderUpdateShipping_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderShippingMethodUpdate_orderUpdateShipping_order_lines_unitDiscount; unitDiscount: OrderShippingMethodUpdate_orderUpdateShipping_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -503,6 +505,7 @@ export interface OrderShippingMethodUpdate_orderUpdateShipping_order {
fulfillments: (OrderShippingMethodUpdate_orderUpdateShipping_order_fulfillments | null)[]; fulfillments: (OrderShippingMethodUpdate_orderUpdateShipping_order_fulfillments | null)[];
lines: (OrderShippingMethodUpdate_orderUpdateShipping_order_lines | null)[]; lines: (OrderShippingMethodUpdate_orderUpdateShipping_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderShippingMethodUpdate_orderUpdateShipping_order_shippingAddress | null; shippingAddress: OrderShippingMethodUpdate_orderUpdateShipping_order_shippingAddress | null;
status: OrderStatus; status: OrderStatus;
@ -515,7 +518,6 @@ export interface OrderShippingMethodUpdate_orderUpdateShipping_order {
userEmail: string | null; userEmail: string | null;
invoices: (OrderShippingMethodUpdate_orderUpdateShipping_order_invoices | null)[] | null; invoices: (OrderShippingMethodUpdate_orderUpdateShipping_order_invoices | null)[] | null;
channel: OrderShippingMethodUpdate_orderUpdateShipping_order_channel; channel: OrderShippingMethodUpdate_orderUpdateShipping_order_channel;
isPaid: boolean;
} }
export interface OrderShippingMethodUpdate_orderUpdateShipping { export interface OrderShippingMethodUpdate_orderUpdateShipping {

View file

@ -223,6 +223,7 @@ export interface OrderUpdate_orderUpdate_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderUpdate_orderUpdate_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderUpdate_orderUpdate_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderUpdate_orderUpdate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderUpdate_orderUpdate_order_lines_unitDiscount; unitDiscount: OrderUpdate_orderUpdate_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderUpdate_orderUpdate_order {
fulfillments: (OrderUpdate_orderUpdate_order_fulfillments | null)[]; fulfillments: (OrderUpdate_orderUpdate_order_fulfillments | null)[];
lines: (OrderUpdate_orderUpdate_order_lines | null)[]; lines: (OrderUpdate_orderUpdate_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderUpdate_orderUpdate_order_shippingAddress | null; shippingAddress: OrderUpdate_orderUpdate_order_shippingAddress | null;
shippingMethod: OrderUpdate_orderUpdate_order_shippingMethod | null; shippingMethod: OrderUpdate_orderUpdate_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderUpdate_orderUpdate_order {
availableShippingMethods: (OrderUpdate_orderUpdate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderUpdate_orderUpdate_order_availableShippingMethods | null)[] | null;
invoices: (OrderUpdate_orderUpdate_order_invoices | null)[] | null; invoices: (OrderUpdate_orderUpdate_order_invoices | null)[] | null;
channel: OrderUpdate_orderUpdate_order_channel; channel: OrderUpdate_orderUpdate_order_channel;
isPaid: boolean;
} }
export interface OrderUpdate_orderUpdate { export interface OrderUpdate_orderUpdate {

View file

@ -223,6 +223,7 @@ export interface OrderVoid_orderVoid_order_fulfillments_lines_orderLine {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderVoid_orderVoid_order_fulfillments_lines_orderLine_unitDiscount; unitDiscount: OrderVoid_orderVoid_order_fulfillments_lines_orderLine_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -318,6 +319,7 @@ export interface OrderVoid_orderVoid_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
quantityToFulfill: number;
unitDiscount: OrderVoid_orderVoid_order_lines_unitDiscount; unitDiscount: OrderVoid_orderVoid_order_lines_unitDiscount;
unitDiscountValue: any; unitDiscountValue: any;
unitDiscountReason: string | null; unitDiscountReason: string | null;
@ -490,6 +492,7 @@ export interface OrderVoid_orderVoid_order {
fulfillments: (OrderVoid_orderVoid_order_fulfillments | null)[]; fulfillments: (OrderVoid_orderVoid_order_fulfillments | null)[];
lines: (OrderVoid_orderVoid_order_lines | null)[]; lines: (OrderVoid_orderVoid_order_lines | null)[];
number: string | null; number: string | null;
isPaid: boolean;
paymentStatus: PaymentChargeStatusEnum; paymentStatus: PaymentChargeStatusEnum;
shippingAddress: OrderVoid_orderVoid_order_shippingAddress | null; shippingAddress: OrderVoid_orderVoid_order_shippingAddress | null;
shippingMethod: OrderVoid_orderVoid_order_shippingMethod | null; shippingMethod: OrderVoid_orderVoid_order_shippingMethod | null;
@ -507,7 +510,6 @@ export interface OrderVoid_orderVoid_order {
availableShippingMethods: (OrderVoid_orderVoid_order_availableShippingMethods | null)[] | null; availableShippingMethods: (OrderVoid_orderVoid_order_availableShippingMethods | null)[] | null;
invoices: (OrderVoid_orderVoid_order_invoices | null)[] | null; invoices: (OrderVoid_orderVoid_order_invoices | null)[] | null;
channel: OrderVoid_orderVoid_order_channel; channel: OrderVoid_orderVoid_order_channel;
isPaid: boolean;
} }
export interface OrderVoid_orderVoid { export interface OrderVoid_orderVoid {

View file

@ -97,6 +97,7 @@ export const orderPath = (id: string) => urlJoin(orderSectionUrl, id);
export type OrderUrlDialog = export type OrderUrlDialog =
| "add-order-line" | "add-order-line"
| "approve-fulfillment"
| "cancel" | "cancel"
| "cancel-fulfillment" | "cancel-fulfillment"
| "capture" | "capture"

View file

@ -22,7 +22,9 @@ import {
getRefundedLinesPriceSum, getRefundedLinesPriceSum,
getReplacedProductsAmount, getReplacedProductsAmount,
getReturnSelectedProductsAmount, getReturnSelectedProductsAmount,
getWarehousesFromOrderLines,
mergeRepeatedOrderLines, mergeRepeatedOrderLines,
OrderLineWithStockWarehouses,
OrderWithTotalAndTotalCaptured OrderWithTotalAndTotalCaptured
} from "./data"; } from "./data";
@ -67,6 +69,77 @@ const orderBase: OrderDetails_order = {
} }
}; };
describe("Get warehouses used in order", () => {
it("is able to calculate number of used warehouses from order", () => {
const lines: OrderLineWithStockWarehouses[] = [
{
variant: {
stocks: [
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-1",
name: "Warehouse 1"
}
},
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-2",
name: "Warehouse 2"
}
}
]
}
},
{
variant: {
stocks: [
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-1",
name: "Warehouse 1"
}
},
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-2",
name: "Warehouse 2"
}
}
]
}
},
{
variant: {
stocks: [
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-2",
name: "Warehouse 2"
}
},
{
warehouse: {
__typename: "Warehouse",
id: "warehouse-3",
name: "Warehouse 3"
}
}
]
}
}
];
const orderWarehouses = getWarehousesFromOrderLines(lines);
expect(orderWarehouses.length).toBe(3);
});
});
describe("Get previously refunded price", () => { describe("Get previously refunded price", () => {
it("is able to calculate refunded price from order", () => { it("is able to calculate refunded price from order", () => {
const order: OrderWithTotalAndTotalCaptured = { const order: OrderWithTotalAndTotalCaptured = {
@ -98,7 +171,7 @@ describe("Get refunded lines price sum", () => {
id: "1", id: "1",
productName: "Milk 1", productName: "Milk 1",
quantity: 1, quantity: 1,
quantityFulfilled: 1, quantityToFulfill: 0,
thumbnail: undefined, thumbnail: undefined,
unitPrice: { unitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
@ -114,7 +187,7 @@ describe("Get refunded lines price sum", () => {
id: "2", id: "2",
productName: "Milk 2", productName: "Milk 2",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityToFulfill: 0,
thumbnail: undefined, thumbnail: undefined,
unitPrice: { unitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
@ -130,7 +203,7 @@ describe("Get refunded lines price sum", () => {
id: "3", id: "3",
productName: "Milk 3", productName: "Milk 3",
quantity: 4, quantity: 4,
quantityFulfilled: 4, quantityToFulfill: 0,
thumbnail: undefined, thumbnail: undefined,
unitPrice: { unitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
@ -464,6 +537,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -518,6 +592,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 10, quantity: 10,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 8,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -572,6 +647,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "29810068", productSku: "29810068",
quantity: 6, quantity: 6,
quantityFulfilled: 1, quantityFulfilled: 1,
quantityToFulfill: 5,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -632,6 +708,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 20, quantity: 20,
quantityFulfilled: 6, quantityFulfilled: 6,
quantityToFulfill: 14,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -691,6 +768,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 25, quantity: 25,
quantityFulfilled: 8, quantityFulfilled: 8,
quantityToFulfill: 17,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -750,6 +828,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "29810068", productSku: "29810068",
quantity: 10, quantity: 10,
quantityFulfilled: 3, quantityFulfilled: 3,
quantityToFulfill: 7,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -809,6 +888,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 20, quantity: 20,
quantityFulfilled: 6, quantityFulfilled: 6,
quantityToFulfill: 14,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -868,6 +948,7 @@ describe("Get the total value of all replaced products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 25, quantity: 25,
quantityFulfilled: 8, quantityFulfilled: 8,
quantityToFulfill: 17,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1061,6 +1142,7 @@ describe("Get the total value of all selected products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1115,6 +1197,7 @@ describe("Get the total value of all selected products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 10, quantity: 10,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 8,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1169,6 +1252,7 @@ describe("Get the total value of all selected products", () => {
productSku: "29810068", productSku: "29810068",
quantity: 6, quantity: 6,
quantityFulfilled: 1, quantityFulfilled: 1,
quantityToFulfill: 5,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1229,6 +1313,7 @@ describe("Get the total value of all selected products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 20, quantity: 20,
quantityFulfilled: 6, quantityFulfilled: 6,
quantityToFulfill: 14,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1288,6 +1373,7 @@ describe("Get the total value of all selected products", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 25, quantity: 25,
quantityFulfilled: 8, quantityFulfilled: 8,
quantityToFulfill: 17,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1347,6 +1433,7 @@ describe("Get the total value of all selected products", () => {
productSku: "29810068", productSku: "29810068",
quantity: 10, quantity: 10,
quantityFulfilled: 3, quantityFulfilled: 3,
quantityToFulfill: 7,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1531,6 +1618,7 @@ describe("Merge repeated order lines of fulfillment lines", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1590,6 +1678,7 @@ describe("Merge repeated order lines of fulfillment lines", () => {
productSku: "lake-tunes-mp3", productSku: "lake-tunes-mp3",
quantity: 2, quantity: 2,
quantityFulfilled: 2, quantityFulfilled: 2,
quantityToFulfill: 0,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",
@ -1649,6 +1738,7 @@ describe("Merge repeated order lines of fulfillment lines", () => {
productSku: "29810068", productSku: "29810068",
quantity: 3, quantity: 3,
quantityFulfilled: 1, quantityFulfilled: 1,
quantityToFulfill: 2,
undiscountedUnitPrice: { undiscountedUnitPrice: {
__typename: "TaxedMoney", __typename: "TaxedMoney",
currency: "USD", currency: "USD",

View file

@ -1,5 +1,7 @@
import { IMoney, subtractMoney } from "@saleor/components/Money"; import { IMoney, subtractMoney } from "@saleor/components/Money";
import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment";
import { FormsetData } from "@saleor/hooks/useFormset"; import { FormsetData } from "@saleor/hooks/useFormset";
import { OrderErrorCode } from "@saleor/types/globalTypes";
import { import {
LineItemData, LineItemData,
@ -9,11 +11,13 @@ import {
getAllOrderFulfilledLines, getAllOrderFulfilledLines,
getById getById
} from "../components/OrderReturnPage/utils"; } from "../components/OrderReturnPage/utils";
import { FulfillOrder_orderFulfill_errors } from "../types/FulfillOrder";
import { import {
OrderDetails_order, OrderDetails_order,
OrderDetails_order_fulfillments_lines, OrderDetails_order_fulfillments_lines,
OrderDetails_order_lines OrderDetails_order_lines
} from "../types/OrderDetails"; } from "../types/OrderDetails";
import { OrderFulfillData_order_lines } from "../types/OrderFulfillData";
import { import {
OrderRefundData_order, OrderRefundData_order,
OrderRefundData_order_fulfillments, OrderRefundData_order_fulfillments,
@ -25,6 +29,32 @@ export type OrderWithTotalAndTotalCaptured = Pick<
"total" | "totalCaptured" "total" | "totalCaptured"
>; >;
export interface OrderLineWithStockWarehouses {
variant?: {
stocks: Array<{ warehouse: WarehouseFragment }>;
};
}
export function getToFulfillOrderLines(lines?: OrderFulfillData_order_lines[]) {
return lines?.filter(line => line.quantityToFulfill > 0) || [];
}
export function getWarehousesFromOrderLines<
T extends OrderLineWithStockWarehouses
>(lines?: T[]) {
return lines?.reduce(
(warehouses, line) =>
line.variant?.stocks?.reduce(
(warehouses, stock) =>
warehouses.some(getById(stock.warehouse.id))
? warehouses
: [...warehouses, stock.warehouse],
warehouses
),
[] as WarehouseFragment[]
);
}
export function getPreviouslyRefundedPrice( export function getPreviouslyRefundedPrice(
order: OrderWithTotalAndTotalCaptured order: OrderWithTotalAndTotalCaptured
): IMoney { ): IMoney {
@ -208,3 +238,28 @@ export function mergeRepeatedOrderLines(
return prev; return prev;
}, Array<OrderDetails_order_fulfillments_lines>()); }, Array<OrderDetails_order_fulfillments_lines>());
} }
export const isStockError = (
overfulfill: boolean,
formsetStock: { quantity: number },
availableQuantity: number,
warehouse: WarehouseFragment,
line: OrderFulfillData_order_lines,
errors: FulfillOrder_orderFulfill_errors[]
) => {
if (overfulfill) {
return true;
}
const isQuantityLargerThanAvailable =
line.variant.trackInventory && formsetStock.quantity > availableQuantity;
const isError = !!errors?.find(
err =>
err.warehouse === warehouse.id &&
err.orderLines.find((id: string) => id === line.id) &&
err.code === OrderErrorCode.INSUFFICIENT_STOCK
);
return isQuantityLargerThanAvailable || isError;
};

View file

@ -1,6 +1,7 @@
import messages from "@saleor/containers/BackgroundTasks/messages"; import messages from "@saleor/containers/BackgroundTasks/messages";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { OrderFulfillmentApprove } from "@saleor/orders/types/OrderFulfillmentApprove";
import getOrderErrorMessage from "@saleor/utils/errors/order"; import getOrderErrorMessage from "@saleor/utils/errors/order";
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
import React from "react"; import React from "react";
@ -32,6 +33,7 @@ interface OrderDetailsMessages {
handleDraftUpdate: (data: OrderDraftUpdate) => void; handleDraftUpdate: (data: OrderDraftUpdate) => void;
handleNoteAdd: (data: OrderAddNote) => void; handleNoteAdd: (data: OrderAddNote) => void;
handleOrderCancel: (data: OrderCancel) => void; handleOrderCancel: (data: OrderCancel) => void;
handleOrderFulfillmentApprove: (data: OrderFulfillmentApprove) => void;
handleOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void; handleOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void;
handleOrderFulfillmentUpdate: ( handleOrderFulfillmentUpdate: (
data: OrderFulfillmentUpdateTracking data: OrderFulfillmentUpdateTracking
@ -215,6 +217,18 @@ export const OrderDetailsMessages: React.FC<OrderDetailsMessages> = ({
); );
} }
}; };
const handleOrderFulfillmentApprove = (data: OrderFulfillmentApprove) => {
const errs = data.orderFulfillmentApprove?.errors;
if (errs.length === 0) {
pushMessage({
status: "success",
text: intl.formatMessage({
defaultMessage: "Fulfillment successfully approved"
})
});
closeModal();
}
};
const handleOrderFulfillmentCancel = (data: OrderFulfillmentCancel) => { const handleOrderFulfillmentCancel = (data: OrderFulfillmentCancel) => {
const errs = data.orderFulfillmentCancel?.errors; const errs = data.orderFulfillmentCancel?.errors;
if (errs.length === 0) { if (errs.length === 0) {
@ -299,6 +313,7 @@ export const OrderDetailsMessages: React.FC<OrderDetailsMessages> = ({
handleInvoiceSend, handleInvoiceSend,
handleNoteAdd, handleNoteAdd,
handleOrderCancel, handleOrderCancel,
handleOrderFulfillmentApprove,
handleOrderFulfillmentCancel, handleOrderFulfillmentCancel,
handleOrderFulfillmentUpdate, handleOrderFulfillmentUpdate,
handleOrderLineDelete, handleOrderLineDelete,

View file

@ -2,7 +2,13 @@ import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useUser from "@saleor/hooks/useUser"; import useUser from "@saleor/hooks/useUser";
import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog"; import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog";
import OrderFulfillmentApproveDialog from "@saleor/orders/components/OrderFulfillmentApproveDialog";
import OrderInvoiceEmailSendDialog from "@saleor/orders/components/OrderInvoiceEmailSendDialog"; import OrderInvoiceEmailSendDialog from "@saleor/orders/components/OrderInvoiceEmailSendDialog";
import {
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
} from "@saleor/orders/types/OrderFulfillmentApprove";
import { PartialMutationProviderOutput } from "@saleor/types";
import { mapEdgesToItems } from "@saleor/utils/maps"; import { mapEdgesToItems } from "@saleor/utils/maps";
import { useWarehouseList } from "@saleor/warehouses/queries"; import { useWarehouseList } from "@saleor/warehouses/queries";
import React from "react"; import React from "react";
@ -39,6 +45,10 @@ interface OrderNormalDetailsProps {
orderPaymentMarkAsPaid: any; orderPaymentMarkAsPaid: any;
orderVoid: any; orderVoid: any;
orderPaymentCapture: any; orderPaymentCapture: any;
orderFulfillmentApprove: PartialMutationProviderOutput<
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
>;
orderFulfillmentCancel: any; orderFulfillmentCancel: any;
orderFulfillmentUpdateTracking: any; orderFulfillmentUpdateTracking: any;
orderInvoiceSend: any; orderInvoiceSend: any;
@ -59,6 +69,7 @@ export const OrderNormalDetails: React.FC<OrderNormalDetailsProps> = ({
orderPaymentMarkAsPaid, orderPaymentMarkAsPaid,
orderVoid, orderVoid,
orderPaymentCapture, orderPaymentCapture,
orderFulfillmentApprove,
orderFulfillmentCancel, orderFulfillmentCancel,
orderFulfillmentUpdateTracking, orderFulfillmentUpdateTracking,
orderInvoiceSend, orderInvoiceSend,
@ -68,6 +79,7 @@ export const OrderNormalDetails: React.FC<OrderNormalDetailsProps> = ({
closeModal closeModal
}) => { }) => {
const order = data?.order; const order = data?.order;
const shop = data?.shop;
const navigate = useNavigator(); const navigate = useNavigator();
const { user } = useUser(); const { user } = useUser();
@ -108,6 +120,7 @@ export const OrderNormalDetails: React.FC<OrderNormalDetailsProps> = ({
} }
onBack={handleBack} onBack={handleBack}
order={order} order={order}
shop={shop}
saveButtonBarState={getMutationState( saveButtonBarState={getMutationState(
updateMetadataOpts.called || updatePrivateMetadataOpts.called, updateMetadataOpts.called || updatePrivateMetadataOpts.called,
updateMetadataOpts.loading || updatePrivateMetadataOpts.loading, updateMetadataOpts.loading || updatePrivateMetadataOpts.loading,
@ -124,6 +137,14 @@ export const OrderNormalDetails: React.FC<OrderNormalDetailsProps> = ({
userPermissions={user?.userPermissions || []} userPermissions={user?.userPermissions || []}
onOrderCancel={() => openModal("cancel")} onOrderCancel={() => openModal("cancel")}
onOrderFulfill={() => navigate(orderFulfillUrl(id))} onOrderFulfill={() => navigate(orderFulfillUrl(id))}
onFulfillmentApprove={fulfillmentId =>
navigate(
orderUrl(id, {
action: "approve-fulfillment",
id: fulfillmentId
})
)
}
onFulfillmentCancel={fulfillmentId => onFulfillmentCancel={fulfillmentId =>
navigate( navigate(
orderUrl(id, { orderUrl(id, {
@ -219,6 +240,21 @@ export const OrderNormalDetails: React.FC<OrderNormalDetailsProps> = ({
}) })
} }
/> />
<OrderFulfillmentApproveDialog
confirmButtonState={orderFulfillmentApprove.opts.status}
errors={
orderFulfillmentApprove.opts.data?.orderFulfillmentApprove.errors ||
[]
}
open={params.action === "approve-fulfillment"}
onConfirm={({ notifyCustomer }) =>
orderFulfillmentApprove.mutate({
id: params.id,
notifyCustomer
})
}
onClose={closeModal}
/>
<OrderFulfillmentCancelDialog <OrderFulfillmentCancelDialog
confirmButtonState={orderFulfillmentCancel.opts.status} confirmButtonState={orderFulfillmentCancel.opts.status}
errors={ errors={

View file

@ -3,9 +3,15 @@ import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useUser from "@saleor/hooks/useUser"; import useUser from "@saleor/hooks/useUser";
import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog"; import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog";
import OrderFulfillmentApproveDialog from "@saleor/orders/components/OrderFulfillmentApproveDialog";
import OrderInvoiceEmailSendDialog from "@saleor/orders/components/OrderInvoiceEmailSendDialog"; import OrderInvoiceEmailSendDialog from "@saleor/orders/components/OrderInvoiceEmailSendDialog";
import {
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
} from "@saleor/orders/types/OrderFulfillmentApprove";
import { OrderDiscountProvider } from "@saleor/products/components/OrderDiscountProviders/OrderDiscountProvider"; import { OrderDiscountProvider } from "@saleor/products/components/OrderDiscountProviders/OrderDiscountProvider";
import { OrderLineDiscountProvider } from "@saleor/products/components/OrderDiscountProviders/OrderLineDiscountProvider"; import { OrderLineDiscountProvider } from "@saleor/products/components/OrderDiscountProviders/OrderLineDiscountProvider";
import { PartialMutationProviderOutput } from "@saleor/types";
import { mapEdgesToItems } from "@saleor/utils/maps"; import { mapEdgesToItems } from "@saleor/utils/maps";
import { useWarehouseList } from "@saleor/warehouses/queries"; import { useWarehouseList } from "@saleor/warehouses/queries";
import React from "react"; import React from "react";
@ -49,6 +55,10 @@ interface OrderUnconfirmedDetailsProps {
orderPaymentMarkAsPaid: any; orderPaymentMarkAsPaid: any;
orderVoid: any; orderVoid: any;
orderPaymentCapture: any; orderPaymentCapture: any;
orderFulfillmentApprove: PartialMutationProviderOutput<
OrderFulfillmentApprove,
OrderFulfillmentApproveVariables
>;
orderFulfillmentCancel: any; orderFulfillmentCancel: any;
orderFulfillmentUpdateTracking: any; orderFulfillmentUpdateTracking: any;
orderInvoiceSend: any; orderInvoiceSend: any;
@ -73,6 +83,7 @@ export const OrderUnconfirmedDetails: React.FC<OrderUnconfirmedDetailsProps> = (
orderPaymentMarkAsPaid, orderPaymentMarkAsPaid,
orderVoid, orderVoid,
orderPaymentCapture, orderPaymentCapture,
orderFulfillmentApprove,
orderFulfillmentCancel, orderFulfillmentCancel,
orderFulfillmentUpdateTracking, orderFulfillmentUpdateTracking,
orderInvoiceSend, orderInvoiceSend,
@ -82,6 +93,7 @@ export const OrderUnconfirmedDetails: React.FC<OrderUnconfirmedDetailsProps> = (
closeModal closeModal
}) => { }) => {
const order = data.order; const order = data.order;
const shop = data.shop;
const navigate = useNavigator(); const navigate = useNavigator();
const { user } = useUser(); const { user } = useUser();
@ -131,6 +143,7 @@ export const OrderUnconfirmedDetails: React.FC<OrderUnconfirmedDetailsProps> = (
} }
onBack={handleBack} onBack={handleBack}
order={order} order={order}
shop={shop}
onOrderLineAdd={() => openModal("add-order-line")} onOrderLineAdd={() => openModal("add-order-line")}
onOrderLineChange={(id, data) => onOrderLineChange={(id, data) =>
orderLineUpdate.mutate({ orderLineUpdate.mutate({
@ -156,6 +169,14 @@ export const OrderUnconfirmedDetails: React.FC<OrderUnconfirmedDetailsProps> = (
userPermissions={user?.userPermissions || []} userPermissions={user?.userPermissions || []}
onOrderCancel={() => openModal("cancel")} onOrderCancel={() => openModal("cancel")}
onOrderFulfill={() => navigate(orderFulfillUrl(id))} onOrderFulfill={() => navigate(orderFulfillUrl(id))}
onFulfillmentApprove={fulfillmentId =>
navigate(
orderUrl(id, {
action: "approve-fulfillment",
id: fulfillmentId
})
)
}
onFulfillmentCancel={fulfillmentId => onFulfillmentCancel={fulfillmentId =>
navigate( navigate(
orderUrl(id, { orderUrl(id, {
@ -292,6 +313,21 @@ export const OrderUnconfirmedDetails: React.FC<OrderUnconfirmedDetailsProps> = (
}) })
} }
/> />
<OrderFulfillmentApproveDialog
confirmButtonState={orderFulfillmentApprove.opts.status}
errors={
orderFulfillmentApprove.opts.data?.orderFulfillmentApprove.errors ||
[]
}
open={params.action === "approve-fulfillment"}
onConfirm={({ notifyCustomer }) =>
orderFulfillmentApprove.mutate({
id: params.id,
notifyCustomer
})
}
onClose={closeModal}
/>
<OrderFulfillmentCancelDialog <OrderFulfillmentCancelDialog
confirmButtonState={orderFulfillmentCancel.opts.status} confirmButtonState={orderFulfillmentCancel.opts.status}
errors={ errors={

View file

@ -121,6 +121,9 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
onOrderLineDelete={orderMessages.handleOrderLineDelete} onOrderLineDelete={orderMessages.handleOrderLineDelete}
onOrderLinesAdd={orderMessages.handleOrderLinesAdd} onOrderLinesAdd={orderMessages.handleOrderLinesAdd}
onOrderLineUpdate={orderMessages.handleOrderLineUpdate} onOrderLineUpdate={orderMessages.handleOrderLineUpdate}
onOrderFulfillmentApprove={
orderMessages.handleOrderFulfillmentApprove
}
onOrderFulfillmentCancel={ onOrderFulfillmentCancel={
orderMessages.handleOrderFulfillmentCancel orderMessages.handleOrderFulfillmentCancel
} }
@ -158,6 +161,7 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
orderVoid, orderVoid,
orderShippingMethodUpdate, orderShippingMethodUpdate,
orderUpdate, orderUpdate,
orderFulfillmentApprove,
orderFulfillmentCancel, orderFulfillmentCancel,
orderFulfillmentUpdateTracking, orderFulfillmentUpdateTracking,
orderDraftCancel, orderDraftCancel,
@ -179,6 +183,7 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
orderPaymentMarkAsPaid={orderPaymentMarkAsPaid} orderPaymentMarkAsPaid={orderPaymentMarkAsPaid}
orderVoid={orderVoid} orderVoid={orderVoid}
orderPaymentCapture={orderPaymentCapture} orderPaymentCapture={orderPaymentCapture}
orderFulfillmentApprove={orderFulfillmentApprove}
orderFulfillmentCancel={orderFulfillmentCancel} orderFulfillmentCancel={orderFulfillmentCancel}
orderFulfillmentUpdateTracking={ orderFulfillmentUpdateTracking={
orderFulfillmentUpdateTracking orderFulfillmentUpdateTracking
@ -224,6 +229,7 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
orderPaymentMarkAsPaid={orderPaymentMarkAsPaid} orderPaymentMarkAsPaid={orderPaymentMarkAsPaid}
orderVoid={orderVoid} orderVoid={orderVoid}
orderPaymentCapture={orderPaymentCapture} orderPaymentCapture={orderPaymentCapture}
orderFulfillmentApprove={orderFulfillmentApprove}
orderFulfillmentCancel={orderFulfillmentCancel} orderFulfillmentCancel={orderFulfillmentCancel}
orderFulfillmentUpdateTracking={ orderFulfillmentUpdateTracking={
orderFulfillmentUpdateTracking orderFulfillmentUpdateTracking

View file

@ -3,10 +3,12 @@ import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import OrderFulfillPage from "@saleor/orders/components/OrderFulfillPage"; import OrderFulfillPage from "@saleor/orders/components/OrderFulfillPage";
import { useOrderFulfill } from "@saleor/orders/mutations"; import { useOrderFulfill } from "@saleor/orders/mutations";
import { useOrderFulfillData } from "@saleor/orders/queries"; import {
useOrderFulfillData,
useOrderFulfillSettingsQuery
} from "@saleor/orders/queries";
import { orderUrl } from "@saleor/orders/urls"; import { orderUrl } from "@saleor/orders/urls";
import { mapEdgesToItems } from "@saleor/utils/maps"; import { getWarehousesFromOrderLines } from "@saleor/orders/utils/data";
import { useWarehouseList } from "@saleor/warehouses/queries";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
@ -18,6 +20,12 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
const navigate = useNavigator(); const navigate = useNavigator();
const notify = useNotifier(); const notify = useNotifier();
const intl = useIntl(); const intl = useIntl();
const {
data: settings,
loading: settingsLoading
} = useOrderFulfillSettingsQuery({});
const { data, loading } = useOrderFulfillData({ const { data, loading } = useOrderFulfillData({
displayLoader: true, displayLoader: true,
variables: { variables: {
@ -25,12 +33,7 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
} }
}); });
const { data: warehouseData, loading: warehousesLoading } = useWarehouseList({ const orderLinesWarehouses = getWarehousesFromOrderLines(data?.order?.lines);
displayLoader: true,
variables: {
first: 20
}
});
const [fulfillOrder, fulfillOrderOpts] = useOrderFulfill({ const [fulfillOrder, fulfillOrderOpts] = useOrderFulfill({
onCompleted: data => { onCompleted: data => {
@ -68,7 +71,7 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
} }
/> />
<OrderFulfillPage <OrderFulfillPage
loading={loading || warehousesLoading || fulfillOrderOpts.loading} loading={loading || settingsLoading || fulfillOrderOpts.loading}
errors={fulfillOrderOpts.data?.orderFulfill.errors} errors={fulfillOrderOpts.data?.orderFulfill.errors}
onBack={() => navigate(orderUrl(orderId))} onBack={() => navigate(orderUrl(orderId))}
onSubmit={formData => onSubmit={formData =>
@ -79,7 +82,8 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
orderLineId: line.id, orderLineId: line.id,
stocks: line.value stocks: line.value
})), })),
notifyCustomer: formData.sendInfo notifyCustomer:
settings?.shop?.fulfillmentAutoApprove && formData.sendInfo
}, },
orderId orderId
} }
@ -87,7 +91,8 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
} }
order={data?.order} order={data?.order}
saveButtonBar="default" saveButtonBar="default"
warehouses={mapEdgesToItems(warehouseData?.warehouses)} warehouses={orderLinesWarehouses}
shopSettings={settings?.shop}
/> />
</> </>
); );

View file

@ -22,10 +22,20 @@ export const OrderSettings: React.FC = () => {
orderSettingsUpdateOpts orderSettingsUpdateOpts
] = useOrderSettingsUpdateMutation({}); ] = useOrderSettingsUpdateMutation({});
const handleSubmit = async (data: OrderSettingsFormData) => { const handleSubmit = async ({
automaticallyConfirmAllNewOrders,
fulfillmentAutoApprove,
fulfillmentAllowUnpaid
}: OrderSettingsFormData) => {
const result = await orderSettingsUpdate({ const result = await orderSettingsUpdate({
variables: { variables: {
input: data orderSettingsInput: {
automaticallyConfirmAllNewOrders
},
shopSettingsInput: {
fulfillmentAutoApprove,
fulfillmentAllowUnpaid
}
} }
}); });
@ -49,7 +59,8 @@ export const OrderSettings: React.FC = () => {
return ( return (
<OrderSettingsPage <OrderSettingsPage
data={data?.orderSettings} orderSettings={data?.orderSettings}
shop={data?.shop}
disabled={loading || orderSettingsUpdateOpts.loading} disabled={loading || orderSettingsUpdateOpts.loading}
onSubmit={handleSubmit} onSubmit={handleSubmit}
onBack={handleBack} onBack={handleBack}

File diff suppressed because it is too large Load diff

View file

@ -116,7 +116,6 @@ function loadStories() {
require("./stories/orders/OrderDraftListPage"); require("./stories/orders/OrderDraftListPage");
require("./stories/orders/OrderDraftPage/OrderDraftPage"); require("./stories/orders/OrderDraftPage/OrderDraftPage");
require("./stories/orders/OrderFulfillmentCancelDialog"); require("./stories/orders/OrderFulfillmentCancelDialog");
require("./stories/orders/OrderFulfillmentDialog");
require("./stories/orders/OrderFulfillmentTrackingDialog"); require("./stories/orders/OrderFulfillmentTrackingDialog");
require("./stories/orders/OrderHistory"); require("./stories/orders/OrderHistory");
require("./stories/orders/OrderListPage"); require("./stories/orders/OrderListPage");

View file

@ -6,7 +6,10 @@ import React from "react";
import OrderDetailsPage, { import OrderDetailsPage, {
OrderDetailsPageProps OrderDetailsPageProps
} from "../../../orders/components/OrderDetailsPage"; } from "../../../orders/components/OrderDetailsPage";
import { order as orderFixture } from "../../../orders/fixtures"; import {
order as orderFixture,
shop as shopFixture
} from "../../../orders/fixtures";
import { import {
FulfillmentStatus, FulfillmentStatus,
OrderStatus, OrderStatus,
@ -20,6 +23,7 @@ const props: Omit<OrderDetailsPageProps, "classes"> = {
disabled: false, disabled: false,
onBack: () => undefined, onBack: () => undefined,
onBillingAddressEdit: undefined, onBillingAddressEdit: undefined,
onFulfillmentApprove: () => undefined,
onFulfillmentCancel: () => undefined, onFulfillmentCancel: () => undefined,
onFulfillmentTrackingNumberUpdate: () => undefined, onFulfillmentTrackingNumberUpdate: () => undefined,
onInvoiceClick: () => undefined, onInvoiceClick: () => undefined,
@ -38,6 +42,7 @@ const props: Omit<OrderDetailsPageProps, "classes"> = {
onShippingAddressEdit: undefined, onShippingAddressEdit: undefined,
onSubmit: () => undefined, onSubmit: () => undefined,
order, order,
shop: shopFixture,
saveButtonBarState: "default", saveButtonBarState: "default",
userPermissions: adminUserPermissions userPermissions: adminUserPermissions
}; };

View file

@ -1,44 +0,0 @@
import placeholderImage from "@assets/images/placeholder60x60.png";
import { OrderErrorCode } from "@saleor/types/globalTypes";
import { storiesOf } from "@storybook/react";
import React from "react";
import OrderFulfillmentDialog, {
OrderFulfillmentDialogProps
} from "../../../orders/components/OrderFulfillmentDialog";
import { order as orderFixture } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
const order = orderFixture(placeholderImage);
const props: Omit<OrderFulfillmentDialogProps, "classes"> = {
confirmButtonState: "default",
errors: [],
lines: order.lines,
onClose: undefined,
onSubmit: undefined,
open: true
};
storiesOf("Orders / OrderFulfillmentDialog", module)
.addDecorator(Decorator)
.add("default", () => <OrderFulfillmentDialog {...props} />)
.add("errors", () => (
<OrderFulfillmentDialog
{...props}
errors={[
{
__typename: "OrderError",
code: OrderErrorCode.FULFILL_ORDER_LINE,
field: null,
addressType: null
},
{
__typename: "OrderError",
code: OrderErrorCode.INVALID,
field: "trackingNumber",
addressType: null
}
]}
/>
));

View file

@ -480,6 +480,7 @@ export enum FulfillmentStatus {
REFUNDED_AND_RETURNED = "REFUNDED_AND_RETURNED", REFUNDED_AND_RETURNED = "REFUNDED_AND_RETURNED",
REPLACED = "REPLACED", REPLACED = "REPLACED",
RETURNED = "RETURNED", RETURNED = "RETURNED",
WAITING_FOR_APPROVAL = "WAITING_FOR_APPROVAL",
} }
export enum GiftCardErrorCode { export enum GiftCardErrorCode {
@ -1388,6 +1389,7 @@ export enum OrderErrorCode {
CANNOT_CANCEL_ORDER = "CANNOT_CANCEL_ORDER", CANNOT_CANCEL_ORDER = "CANNOT_CANCEL_ORDER",
CANNOT_DELETE = "CANNOT_DELETE", CANNOT_DELETE = "CANNOT_DELETE",
CANNOT_DISCOUNT = "CANNOT_DISCOUNT", CANNOT_DISCOUNT = "CANNOT_DISCOUNT",
CANNOT_FULFILL_UNPAID_ORDER = "CANNOT_FULFILL_UNPAID_ORDER",
CANNOT_REFUND = "CANNOT_REFUND", CANNOT_REFUND = "CANNOT_REFUND",
CAPTURE_INACTIVE_PAYMENT = "CAPTURE_INACTIVE_PAYMENT", CAPTURE_INACTIVE_PAYMENT = "CAPTURE_INACTIVE_PAYMENT",
CHANNEL_INACTIVE = "CHANNEL_INACTIVE", CHANNEL_INACTIVE = "CHANNEL_INACTIVE",
@ -1434,6 +1436,7 @@ export enum OrderEventsEnum {
DRAFT_CREATED_FROM_REPLACE = "DRAFT_CREATED_FROM_REPLACE", DRAFT_CREATED_FROM_REPLACE = "DRAFT_CREATED_FROM_REPLACE",
EMAIL_SENT = "EMAIL_SENT", EMAIL_SENT = "EMAIL_SENT",
EXTERNAL_SERVICE_NOTIFICATION = "EXTERNAL_SERVICE_NOTIFICATION", EXTERNAL_SERVICE_NOTIFICATION = "EXTERNAL_SERVICE_NOTIFICATION",
FULFILLMENT_AWAITS_APPROVAL = "FULFILLMENT_AWAITS_APPROVAL",
FULFILLMENT_CANCELED = "FULFILLMENT_CANCELED", FULFILLMENT_CANCELED = "FULFILLMENT_CANCELED",
FULFILLMENT_FULFILLED_ITEMS = "FULFILLMENT_FULFILLED_ITEMS", FULFILLMENT_FULFILLED_ITEMS = "FULFILLMENT_FULFILLED_ITEMS",
FULFILLMENT_REFUNDED = "FULFILLMENT_REFUNDED", FULFILLMENT_REFUNDED = "FULFILLMENT_REFUNDED",
@ -2709,6 +2712,8 @@ export interface ShopSettingsInput {
trackInventoryByDefault?: boolean | null; trackInventoryByDefault?: boolean | null;
defaultWeightUnit?: WeightUnitsEnum | null; defaultWeightUnit?: WeightUnitsEnum | null;
automaticFulfillmentDigitalProducts?: boolean | null; automaticFulfillmentDigitalProducts?: boolean | null;
fulfillmentAutoApprove?: boolean | null;
fulfillmentAllowUnpaid?: boolean | null;
defaultDigitalMaxDownloads?: number | null; defaultDigitalMaxDownloads?: number | null;
defaultDigitalUrlValidDays?: number | null; defaultDigitalUrlValidDays?: number | null;
defaultMailSenderName?: string | null; defaultMailSenderName?: string | null;