Hook up components with API

This commit is contained in:
dominik-zeglen 2020-04-24 13:56:28 +02:00
parent 0c09d4b11d
commit 3922b315d5
9 changed files with 375 additions and 688 deletions

View file

@ -11,7 +11,7 @@ import classNames from "classnames";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import useFormset, { FormsetData } from "@saleor/hooks/useFormset"; import useFormset, { FormsetData } from "@saleor/hooks/useFormset";
import { StockInput } from "@saleor/types/globalTypes"; import { OrderFulfillStockInput } from "@saleor/types/globalTypes";
import { WarehouseFragment } from "@saleor/warehouses/types/WarehouseFragment"; import { WarehouseFragment } from "@saleor/warehouses/types/WarehouseFragment";
import TableCellAvatar from "@saleor/components/TableCellAvatar"; import TableCellAvatar from "@saleor/components/TableCellAvatar";
import Container from "@saleor/components/Container"; import Container from "@saleor/components/Container";
@ -19,7 +19,10 @@ import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar"; import SaveButtonBar from "@saleor/components/SaveButtonBar";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
import Form from "@saleor/components/Form"; import Form from "@saleor/components/Form";
import { OrderFulfillData_order } from "@saleor/orders/types/OrderFulfillData"; import {
OrderFulfillData_order,
OrderFulfillData_order_lines
} from "@saleor/orders/types/OrderFulfillData";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import ResponsiveTable from "@saleor/components/ResponsiveTable"; import ResponsiveTable from "@saleor/components/ResponsiveTable";
import makeStyles from "@material-ui/core/styles/makeStyles"; import makeStyles from "@material-ui/core/styles/makeStyles";
@ -36,23 +39,25 @@ const useStyles = makeStyles(
paddingLeft: theme.spacing(2) + 2 paddingLeft: theme.spacing(2) + 2
}, },
colName: { colName: {
width: 300 width: 250
}, },
colQuantity: { colQuantity: {
textAlign: "right",
width: 210 width: 210
}, },
colQuantityContent: { colQuantityContent: {
alignItems: "center", alignItems: "center",
display: "inline-flex" display: "inline-flex"
}, },
colQuantityHeader: {
textAlign: "right"
},
colQuantityTotal: { colQuantityTotal: {
textAlign: "right", textAlign: "right",
width: 180 width: 180
}, },
colSku: { colSku: {
textAlign: "right", textAlign: "right",
width: 120 width: 150
}, },
error: { error: {
color: theme.palette.error.main color: theme.palette.error.main
@ -82,7 +87,7 @@ interface OrderFulfillFormData {
sendInfo: boolean; sendInfo: boolean;
} }
interface OrderFulfillSubmitData extends OrderFulfillFormData { interface OrderFulfillSubmitData extends OrderFulfillFormData {
items: FormsetData<null, StockInput[]>; items: FormsetData<null, OrderFulfillStockInput[]>;
} }
export interface OrderFulfillPageProps { export interface OrderFulfillPageProps {
disabled: boolean; disabled: boolean;
@ -97,6 +102,10 @@ const initialFormData: OrderFulfillFormData = {
sendInfo: true sendInfo: true
}; };
function getRemainingQuantity(line: OrderFulfillData_order_lines): number {
return line.quantity - line.quantityFulfilled;
}
const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
disabled, disabled,
order, order,
@ -110,23 +119,25 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
const { change: formsetChange, data: formsetData } = useFormset< const { change: formsetChange, data: formsetData } = useFormset<
null, null,
StockInput[] OrderFulfillStockInput[]
>( >(
order?.lines.map(line => ({ order?.lines
data: null, .filter(line => getRemainingQuantity(line) > 0)
id: line.id, .map(line => ({
label: line.variant.attributes data: null,
.map(attribute => id: line.id,
attribute.values label: line.variant.attributes
.map(attributeValue => attributeValue.name) .map(attribute =>
.join(" , ") attribute.values
) .map(attributeValue => attributeValue.name)
.join(" / "), .join(" , ")
value: line.variant.stocks.map(stock => ({ )
quantity: 0, .join(" / "),
warehouse: stock.warehouse.id value: line.variant.stocks.map(stock => ({
quantity: 0,
warehouse: stock.warehouse.id
}))
})) }))
}))
); );
const handleSubmit = (formData: OrderFulfillFormData) => const handleSubmit = (formData: OrderFulfillFormData) =>
@ -189,7 +200,10 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
{warehouses?.map(warehouse => ( {warehouses?.map(warehouse => (
<TableCell <TableCell
key={warehouse.id} key={warehouse.id}
className={classes.colQuantity} className={classNames(
classes.colQuantity,
classes.colQuantityHeader
)}
> >
{warehouse.name} {warehouse.name}
</TableCell> </TableCell>
@ -203,144 +217,151 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{renderCollection(order?.lines, (line, lineIndex) => { {renderCollection(
if (!line) { order?.lines.filter(line => getRemainingQuantity(line) > 0),
return ( (line, lineIndex) => {
<TableRow> if (!line) {
<TableCellAvatar className={classes.colName}> return (
<Skeleton /> <TableRow>
</TableCellAvatar> <TableCellAvatar className={classes.colName}>
<TableCell className={classes.colSku}> <Skeleton />
<Skeleton /> </TableCellAvatar>
</TableCell> <TableCell className={classes.colSku}>
{warehouses?.map(() => (
<TableCell className={classes.colQuantity}>
<Skeleton /> <Skeleton />
</TableCell> </TableCell>
))} {warehouses?.map(warehouse => (
<TableCell
className={classes.colQuantity}
key={warehouse.id}
>
<Skeleton />
</TableCell>
))}
<TableCell className={classes.colQuantityTotal}>
{" "}
<Skeleton />
</TableCell>
</TableRow>
);
}
const remainingQuantity = getRemainingQuantity(line);
const quantityToFulfill = formsetData[
lineIndex
].value.reduce(
(quantityToFulfill, lineInput) =>
quantityToFulfill + (lineInput.quantity || 0),
0
);
const overfulfill = remainingQuantity < quantityToFulfill;
return (
<TableRow key={line.id}>
<TableCellAvatar
className={classes.colName}
thumbnail={line?.thumbnail?.url}
>
{line.productName}
<Typography color="textSecondary" variant="caption">
{line.variant.attributes
.map(attribute =>
attribute.values
.map(attributeValue => attributeValue.name)
.join(", ")
)
.join(" / ")}
</Typography>
</TableCellAvatar>
<TableCell className={classes.colSku}>
{line.variant.sku}
</TableCell>
{warehouses?.map(warehouse => {
const warehouseStock = line.variant.stocks.find(
stock => stock.warehouse.id === warehouse.id
);
const formsetStock = formsetData[
lineIndex
].value.find(
line => line.warehouse === warehouse.id
);
if (!warehouseStock) {
return (
<TableCell
className={classNames(
classes.colQuantity,
classes.error
)}
>
<FormattedMessage
defaultMessage="No Stock"
description="no variant stock in warehouse"
/>
</TableCell>
);
}
const availableQuantity =
warehouseStock.quantity -
warehouseStock.quantityAllocated;
return (
<TableCell className={classes.colQuantity}>
<div className={classes.colQuantityContent}>
<TextField
type="number"
inputProps={{
className: classes.quantityInnerInput,
max: warehouseStock.quantity,
min: 0,
style: { textAlign: "right" }
}}
className={classes.quantityInput}
value={formsetStock.quantity}
onChange={event =>
formsetChange(
line.id,
update(
{
quantity: parseInt(
event.target.value,
10
),
warehouse: warehouse.id
},
formsetData[lineIndex].value,
(a, b) => a.warehouse === b.warehouse
)
)
}
error={
overfulfill ||
formsetStock.quantity > availableQuantity
}
/>
<div className={classes.remainingQuantity}>
/ {availableQuantity}
</div>
</div>
</TableCell>
);
})}
<TableCell className={classes.colQuantityTotal}> <TableCell className={classes.colQuantityTotal}>
{" "} <span
<Skeleton /> className={classNames({
[classes.error]: overfulfill,
[classes.full]:
remainingQuantity <= quantityToFulfill
})}
>
{quantityToFulfill}
</span>{" "}
/ {remainingQuantity}
</TableCell> </TableCell>
</TableRow> </TableRow>
); );
} }
)}
const remainingQuantity =
line.quantity - line.quantityFulfilled;
const quantityToFulfill = formsetData[
lineIndex
].value.reduce(
(quantityToFulfill, lineInput) =>
quantityToFulfill + (lineInput.quantity || 0),
0
);
const overfulfill = remainingQuantity < quantityToFulfill;
return (
<TableRow key={line.id}>
<TableCellAvatar
className={classes.colName}
thumbnail={line?.thumbnail?.url}
>
{line.productName}
<Typography color="textSecondary" variant="caption">
{line.variant.attributes
.map(attribute =>
attribute.values
.map(attributeValue => attributeValue.name)
.join(", ")
)
.join(" / ")}
</Typography>
</TableCellAvatar>
<TableCell className={classes.colSku}>
{line.variant.sku}
</TableCell>
{warehouses?.map(warehouse => {
const warehouseStock = line.variant.stocks.find(
stock => stock.warehouse.id === warehouse.id
);
const formsetStock = formsetData[
lineIndex
].value.find(line => line.warehouse === warehouse.id);
if (!warehouseStock) {
return (
<TableCell
className={classNames(
classes.colQuantity,
classes.error
)}
>
<FormattedMessage
defaultMessage="No Stock"
description="no variant stock in warehouse"
/>
</TableCell>
);
}
const availableQuantity =
warehouseStock.quantity -
warehouseStock.quantityAllocated;
return (
<TableCell className={classes.colQuantity}>
<div className={classes.colQuantityContent}>
<TextField
type="number"
inputProps={{
className: classes.quantityInnerInput,
max: warehouseStock.quantity,
min: 0,
style: { textAlign: "right" }
}}
className={classes.quantityInput}
value={formsetStock.quantity}
onChange={event =>
formsetChange(
line.id,
update(
{
quantity: parseInt(
event.target.value,
10
),
warehouse: warehouse.id
},
formsetData[lineIndex].value,
(a, b) => a.warehouse === b.warehouse
)
)
}
error={
overfulfill ||
formsetStock.quantity > availableQuantity
}
/>
<div className={classes.remainingQuantity}>
/ {availableQuantity}
</div>
</div>
</TableCell>
);
})}
<TableCell className={classes.colQuantityTotal}>
<span
className={classNames({
[classes.error]: overfulfill,
[classes.full]:
remainingQuantity <= quantityToFulfill
})}
>
{quantityToFulfill}
</span>{" "}
/ {remainingQuantity}
</TableCell>
</TableRow>
);
})}
</TableBody> </TableBody>
</ResponsiveTable> </ResponsiveTable>
<CardActions className={classes.actionBar}> <CardActions className={classes.actionBar}>

View file

@ -6,7 +6,6 @@ import {
TypedOrderAddNoteMutation, TypedOrderAddNoteMutation,
TypedOrderCancelMutation, TypedOrderCancelMutation,
TypedOrderCaptureMutation, TypedOrderCaptureMutation,
TypedOrderCreateFulfillmentMutation,
TypedOrderDraftCancelMutation, TypedOrderDraftCancelMutation,
TypedOrderDraftFinalizeMutation, TypedOrderDraftFinalizeMutation,
TypedOrderDraftUpdateMutation, TypedOrderDraftUpdateMutation,
@ -24,10 +23,6 @@ import {
import { OrderAddNote, OrderAddNoteVariables } from "../types/OrderAddNote"; import { OrderAddNote, OrderAddNoteVariables } from "../types/OrderAddNote";
import { OrderCancel, OrderCancelVariables } from "../types/OrderCancel"; import { OrderCancel, OrderCancelVariables } from "../types/OrderCancel";
import { OrderCapture, OrderCaptureVariables } from "../types/OrderCapture"; import { OrderCapture, OrderCaptureVariables } from "../types/OrderCapture";
import {
OrderCreateFulfillment,
OrderCreateFulfillmentVariables
} from "../types/OrderCreateFulfillment";
import { import {
OrderDraftCancel, OrderDraftCancel,
OrderDraftCancelVariables OrderDraftCancelVariables
@ -80,10 +75,6 @@ interface OrderOperationsProps {
OrderCancel, OrderCancel,
OrderCancelVariables OrderCancelVariables
>; >;
orderCreateFulfillment: PartialMutationProviderOutput<
OrderCreateFulfillment,
OrderCreateFulfillmentVariables
>;
orderFulfillmentCancel: PartialMutationProviderOutput< orderFulfillmentCancel: PartialMutationProviderOutput<
OrderFulfillmentCancel, OrderFulfillmentCancel,
OrderFulfillmentCancelVariables OrderFulfillmentCancelVariables
@ -139,7 +130,6 @@ interface OrderOperationsProps {
>; >;
}) => React.ReactNode; }) => React.ReactNode;
onOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void; onOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void;
onOrderFulfillmentCreate: (data: OrderCreateFulfillment) => void;
onOrderFulfillmentUpdate: (data: OrderFulfillmentUpdateTracking) => void; onOrderFulfillmentUpdate: (data: OrderFulfillmentUpdateTracking) => void;
onOrderCancel: (data: OrderCancel) => void; onOrderCancel: (data: OrderCancel) => void;
onOrderVoid: (data: OrderVoid) => void; onOrderVoid: (data: OrderVoid) => void;
@ -160,7 +150,6 @@ interface OrderOperationsProps {
const OrderOperations: React.FC<OrderOperationsProps> = ({ const OrderOperations: React.FC<OrderOperationsProps> = ({
children, children,
onDraftUpdate, onDraftUpdate,
onOrderFulfillmentCreate,
onNoteAdd, onNoteAdd,
onOrderCancel, onOrderCancel,
onOrderLinesAdd, onOrderLinesAdd,
@ -185,151 +174,140 @@ const OrderOperations: React.FC<OrderOperationsProps> = ({
{(...paymentCapture) => ( {(...paymentCapture) => (
<TypedOrderRefundMutation onCompleted={onPaymentRefund}> <TypedOrderRefundMutation onCompleted={onPaymentRefund}>
{(...paymentRefund) => ( {(...paymentRefund) => (
<TypedOrderCreateFulfillmentMutation <TypedOrderAddNoteMutation onCompleted={onNoteAdd}>
onCompleted={onOrderFulfillmentCreate} {(...addNote) => (
> <TypedOrderUpdateMutation onCompleted={onUpdate}>
{(...createFulfillment) => ( {(...update) => (
<TypedOrderAddNoteMutation onCompleted={onNoteAdd}> <TypedOrderDraftUpdateMutation
{(...addNote) => ( onCompleted={onDraftUpdate}
<TypedOrderUpdateMutation onCompleted={onUpdate}> >
{(...update) => ( {(...updateDraft) => (
<TypedOrderDraftUpdateMutation <TypedOrderShippingMethodUpdateMutation
onCompleted={onDraftUpdate} onCompleted={onShippingMethodUpdate}
> >
{(...updateDraft) => ( {(...updateShippingMethod) => (
<TypedOrderShippingMethodUpdateMutation <TypedOrderLineDeleteMutation
onCompleted={onShippingMethodUpdate} onCompleted={onOrderLineDelete}
> >
{(...updateShippingMethod) => ( {(...deleteOrderLine) => (
<TypedOrderLineDeleteMutation <TypedOrderLinesAddMutation
onCompleted={onOrderLineDelete} onCompleted={onOrderLinesAdd}
> >
{(...deleteOrderLine) => ( {(...addOrderLine) => (
<TypedOrderLinesAddMutation <TypedOrderLineUpdateMutation
onCompleted={onOrderLinesAdd} onCompleted={onOrderLineUpdate}
> >
{(...addOrderLine) => ( {(...updateOrderLine) => (
<TypedOrderLineUpdateMutation <TypedOrderFulfillmentCancelMutation
onCompleted={onOrderLineUpdate} onCompleted={
onOrderFulfillmentCancel
}
> >
{(...updateOrderLine) => ( {(...cancelFulfillment) => (
<TypedOrderFulfillmentCancelMutation <TypedOrderFulfillmentUpdateTrackingMutation
onCompleted={ onCompleted={
onOrderFulfillmentCancel onOrderFulfillmentUpdate
} }
> >
{(...cancelFulfillment) => ( {(
<TypedOrderFulfillmentUpdateTrackingMutation ...updateTrackingNumber
) => (
<TypedOrderDraftFinalizeMutation
onCompleted={ onCompleted={
onOrderFulfillmentUpdate onDraftFinalize
} }
> >
{( {(...finalizeDraft) => (
...updateTrackingNumber <TypedOrderDraftCancelMutation
) => (
<TypedOrderDraftFinalizeMutation
onCompleted={ onCompleted={
onDraftFinalize onDraftCancel
} }
> >
{( {(
...finalizeDraft ...cancelDraft
) => ( ) => (
<TypedOrderDraftCancelMutation <TypedOrderMarkAsPaidMutation
onCompleted={ onCompleted={
onDraftCancel onOrderMarkAsPaid
} }
> >
{( {(
...cancelDraft ...markAsPaid
) => ( ) =>
<TypedOrderMarkAsPaidMutation children({
onCompleted={ orderAddNote: getMutationProviderData(
onOrderMarkAsPaid ...addNote
} ),
> orderCancel: getMutationProviderData(
{( ...orderCancel
),
orderDraftCancel: getMutationProviderData(
...cancelDraft
),
orderDraftFinalize: getMutationProviderData(
...finalizeDraft
),
orderDraftUpdate: getMutationProviderData(
...updateDraft
),
orderFulfillmentCancel: getMutationProviderData(
...cancelFulfillment
),
orderFulfillmentUpdateTracking: getMutationProviderData(
...updateTrackingNumber
),
orderLineDelete: getMutationProviderData(
...deleteOrderLine
),
orderLineUpdate: getMutationProviderData(
...updateOrderLine
),
orderLinesAdd: getMutationProviderData(
...addOrderLine
),
orderPaymentCapture: getMutationProviderData(
...paymentCapture
),
orderPaymentMarkAsPaid: getMutationProviderData(
...markAsPaid ...markAsPaid
) => ),
children({ orderPaymentRefund: getMutationProviderData(
orderAddNote: getMutationProviderData( ...paymentRefund
...addNote ),
), orderShippingMethodUpdate: getMutationProviderData(
orderCancel: getMutationProviderData( ...updateShippingMethod
...orderCancel ),
), orderUpdate: getMutationProviderData(
orderCreateFulfillment: getMutationProviderData( ...update
...createFulfillment ),
), orderVoid: getMutationProviderData(
orderDraftCancel: getMutationProviderData( ...orderVoid
...cancelDraft )
), })
orderDraftFinalize: getMutationProviderData( }
...finalizeDraft </TypedOrderMarkAsPaidMutation>
),
orderDraftUpdate: getMutationProviderData(
...updateDraft
),
orderFulfillmentCancel: getMutationProviderData(
...cancelFulfillment
),
orderFulfillmentUpdateTracking: getMutationProviderData(
...updateTrackingNumber
),
orderLineDelete: getMutationProviderData(
...deleteOrderLine
),
orderLineUpdate: getMutationProviderData(
...updateOrderLine
),
orderLinesAdd: getMutationProviderData(
...addOrderLine
),
orderPaymentCapture: getMutationProviderData(
...paymentCapture
),
orderPaymentMarkAsPaid: getMutationProviderData(
...markAsPaid
),
orderPaymentRefund: getMutationProviderData(
...paymentRefund
),
orderShippingMethodUpdate: getMutationProviderData(
...updateShippingMethod
),
orderUpdate: getMutationProviderData(
...update
),
orderVoid: getMutationProviderData(
...orderVoid
)
})
}
</TypedOrderMarkAsPaidMutation>
)}
</TypedOrderDraftCancelMutation>
)} )}
</TypedOrderDraftFinalizeMutation> </TypedOrderDraftCancelMutation>
)} )}
</TypedOrderFulfillmentUpdateTrackingMutation> </TypedOrderDraftFinalizeMutation>
)} )}
</TypedOrderFulfillmentCancelMutation> </TypedOrderFulfillmentUpdateTrackingMutation>
)} )}
</TypedOrderLineUpdateMutation> </TypedOrderFulfillmentCancelMutation>
)} )}
</TypedOrderLinesAddMutation> </TypedOrderLineUpdateMutation>
)} )}
</TypedOrderLineDeleteMutation> </TypedOrderLinesAddMutation>
)} )}
</TypedOrderShippingMethodUpdateMutation> </TypedOrderLineDeleteMutation>
)} )}
</TypedOrderDraftUpdateMutation> </TypedOrderShippingMethodUpdateMutation>
)} )}
</TypedOrderUpdateMutation> </TypedOrderDraftUpdateMutation>
)} )}
</TypedOrderAddNoteMutation> </TypedOrderUpdateMutation>
)} )}
</TypedOrderCreateFulfillmentMutation> </TypedOrderAddNoteMutation>
)} )}
</TypedOrderRefundMutation> </TypedOrderRefundMutation>
)} )}

View file

@ -14,10 +14,6 @@ import {
} from "./types/OrderBulkCancel"; } from "./types/OrderBulkCancel";
import { OrderCancel, OrderCancelVariables } from "./types/OrderCancel"; import { OrderCancel, OrderCancelVariables } from "./types/OrderCancel";
import { OrderCapture, OrderCaptureVariables } from "./types/OrderCapture"; import { OrderCapture, OrderCaptureVariables } from "./types/OrderCapture";
import {
OrderCreateFulfillment,
OrderCreateFulfillmentVariables
} from "./types/OrderCreateFulfillment";
import { import {
OrderDraftBulkCancel, OrderDraftBulkCancel,
OrderDraftBulkCancelVariables OrderDraftBulkCancelVariables
@ -235,28 +231,6 @@ export const TypedOrderCaptureMutation = TypedMutation<
OrderCaptureVariables OrderCaptureVariables
>(orderCaptureMutation); >(orderCaptureMutation);
const orderCreateFulfillmentMutation = gql`
${fragmentOrderDetails}
${orderErrorFragment}
mutation OrderCreateFulfillment(
$order: ID!
$input: FulfillmentCreateInput!
) {
orderFulfillmentCreate(order: $order, input: $input) {
errors: orderErrors {
...OrderErrorFragment
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderCreateFulfillmentMutation = TypedMutation<
OrderCreateFulfillment,
OrderCreateFulfillmentVariables
>(orderCreateFulfillmentMutation);
const orderFulfillmentUpdateTrackingMutation = gql` const orderFulfillmentUpdateTrackingMutation = gql`
${fragmentOrderDetails} ${fragmentOrderDetails}
${orderErrorFragment} ${orderErrorFragment}
@ -480,8 +454,10 @@ export const TypedOrderLineUpdateMutation = TypedMutation<
>(orderLineUpdateMutation); >(orderLineUpdateMutation);
const fulfillOrder = gql` const fulfillOrder = gql`
mutation FulfillOrder($orderId: ID!, $input: FulfillmentCreateInput!) { ${fragmentOrderDetails}
orderFulfillmentCreate(order: $orderId, input: $input) { ${orderErrorFragment}
mutation FulfillOrder($orderId: ID!, $input: OrderFulfillInput!) {
orderFulfill(order: $orderId, input: $input) {
errors: orderErrors { errors: orderErrors {
...OrderErrorFragment ...OrderErrorFragment
} }

View file

@ -2,30 +2,30 @@
/* eslint-disable */ /* eslint-disable */
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { FulfillmentCreateInput, OrderErrorCode, OrderEventsEmailsEnum, OrderEventsEnum, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction } from "./../../types/globalTypes"; import { OrderFulfillInput, OrderErrorCode, OrderEventsEmailsEnum, OrderEventsEnum, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: FulfillOrder // GraphQL mutation operation: FulfillOrder
// ==================================================== // ====================================================
export interface FulfillOrder_orderFulfillmentCreate_errors { export interface FulfillOrder_orderFulfill_errors {
__typename: "OrderError"; __typename: "OrderError";
code: OrderErrorCode; code: OrderErrorCode;
field: string | null; field: string | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_billingAddress_country { export interface FulfillOrder_orderFulfill_order_billingAddress_country {
__typename: "CountryDisplay"; __typename: "CountryDisplay";
code: string; code: string;
country: string; country: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_billingAddress { export interface FulfillOrder_orderFulfill_order_billingAddress {
__typename: "Address"; __typename: "Address";
city: string; city: string;
cityArea: string; cityArea: string;
companyName: string; companyName: string;
country: FulfillOrder_orderFulfillmentCreate_order_billingAddress_country; country: FulfillOrder_orderFulfill_order_billingAddress_country;
countryArea: string; countryArea: string;
firstName: string; firstName: string;
id: string; id: string;
@ -36,13 +36,13 @@ export interface FulfillOrder_orderFulfillmentCreate_order_billingAddress {
streetAddress2: string; streetAddress2: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_events_user { export interface FulfillOrder_orderFulfill_order_events_user {
__typename: "User"; __typename: "User";
id: string; id: string;
email: string; email: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_events { export interface FulfillOrder_orderFulfill_order_events {
__typename: "OrderEvent"; __typename: "OrderEvent";
id: string; id: string;
amount: number | null; amount: number | null;
@ -52,33 +52,33 @@ export interface FulfillOrder_orderFulfillmentCreate_order_events {
message: string | null; message: string | null;
quantity: number | null; quantity: number | null;
type: OrderEventsEnum | null; type: OrderEventsEnum | null;
user: FulfillOrder_orderFulfillmentCreate_order_events_user | null; user: FulfillOrder_orderFulfill_order_events_user | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_gross { export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice_gross {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_net { export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice_net {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice { export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice {
__typename: "TaxedMoney"; __typename: "TaxedMoney";
gross: FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_gross; gross: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice_gross;
net: FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_net; net: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice_net;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_thumbnail { export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_thumbnail {
__typename: "Image"; __typename: "Image";
url: string; url: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine { export interface FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine {
__typename: "OrderLine"; __typename: "OrderLine";
id: string; id: string;
isShippingRequired: boolean; isShippingRequired: boolean;
@ -86,50 +86,50 @@ export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_or
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
unitPrice: FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice | null; unitPrice: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_unitPrice | null;
thumbnail: FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine_thumbnail | null; thumbnail: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine_thumbnail | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines { export interface FulfillOrder_orderFulfill_order_fulfillments_lines {
__typename: "FulfillmentLine"; __typename: "FulfillmentLine";
id: string; id: string;
quantity: number; quantity: number;
orderLine: FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines_orderLine | null; orderLine: FulfillOrder_orderFulfill_order_fulfillments_lines_orderLine | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_fulfillments { export interface FulfillOrder_orderFulfill_order_fulfillments {
__typename: "Fulfillment"; __typename: "Fulfillment";
id: string; id: string;
lines: (FulfillOrder_orderFulfillmentCreate_order_fulfillments_lines | null)[] | null; lines: (FulfillOrder_orderFulfill_order_fulfillments_lines | null)[] | null;
fulfillmentOrder: number; fulfillmentOrder: number;
status: FulfillmentStatus; status: FulfillmentStatus;
trackingNumber: string; trackingNumber: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice_gross { export interface FulfillOrder_orderFulfill_order_lines_unitPrice_gross {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice_net { export interface FulfillOrder_orderFulfill_order_lines_unitPrice_net {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice { export interface FulfillOrder_orderFulfill_order_lines_unitPrice {
__typename: "TaxedMoney"; __typename: "TaxedMoney";
gross: FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice_gross; gross: FulfillOrder_orderFulfill_order_lines_unitPrice_gross;
net: FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice_net; net: FulfillOrder_orderFulfill_order_lines_unitPrice_net;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_lines_thumbnail { export interface FulfillOrder_orderFulfill_order_lines_thumbnail {
__typename: "Image"; __typename: "Image";
url: string; url: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_lines { export interface FulfillOrder_orderFulfill_order_lines {
__typename: "OrderLine"; __typename: "OrderLine";
id: string; id: string;
isShippingRequired: boolean; isShippingRequired: boolean;
@ -137,22 +137,22 @@ export interface FulfillOrder_orderFulfillmentCreate_order_lines {
productSku: string; productSku: string;
quantity: number; quantity: number;
quantityFulfilled: number; quantityFulfilled: number;
unitPrice: FulfillOrder_orderFulfillmentCreate_order_lines_unitPrice | null; unitPrice: FulfillOrder_orderFulfill_order_lines_unitPrice | null;
thumbnail: FulfillOrder_orderFulfillmentCreate_order_lines_thumbnail | null; thumbnail: FulfillOrder_orderFulfill_order_lines_thumbnail | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_shippingAddress_country { export interface FulfillOrder_orderFulfill_order_shippingAddress_country {
__typename: "CountryDisplay"; __typename: "CountryDisplay";
code: string; code: string;
country: string; country: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_shippingAddress { export interface FulfillOrder_orderFulfill_order_shippingAddress {
__typename: "Address"; __typename: "Address";
city: string; city: string;
cityArea: string; cityArea: string;
companyName: string; companyName: string;
country: FulfillOrder_orderFulfillmentCreate_order_shippingAddress_country; country: FulfillOrder_orderFulfill_order_shippingAddress_country;
countryArea: string; countryArea: string;
firstName: string; firstName: string;
id: string; id: string;
@ -163,120 +163,120 @@ export interface FulfillOrder_orderFulfillmentCreate_order_shippingAddress {
streetAddress2: string; streetAddress2: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_shippingMethod { export interface FulfillOrder_orderFulfill_order_shippingMethod {
__typename: "ShippingMethod"; __typename: "ShippingMethod";
id: string; id: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_shippingPrice_gross { export interface FulfillOrder_orderFulfill_order_shippingPrice_gross {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_shippingPrice { export interface FulfillOrder_orderFulfill_order_shippingPrice {
__typename: "TaxedMoney"; __typename: "TaxedMoney";
gross: FulfillOrder_orderFulfillmentCreate_order_shippingPrice_gross; gross: FulfillOrder_orderFulfill_order_shippingPrice_gross;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_subtotal_gross { export interface FulfillOrder_orderFulfill_order_subtotal_gross {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_subtotal { export interface FulfillOrder_orderFulfill_order_subtotal {
__typename: "TaxedMoney"; __typename: "TaxedMoney";
gross: FulfillOrder_orderFulfillmentCreate_order_subtotal_gross; gross: FulfillOrder_orderFulfill_order_subtotal_gross;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_total_gross { export interface FulfillOrder_orderFulfill_order_total_gross {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_total_tax { export interface FulfillOrder_orderFulfill_order_total_tax {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_total { export interface FulfillOrder_orderFulfill_order_total {
__typename: "TaxedMoney"; __typename: "TaxedMoney";
gross: FulfillOrder_orderFulfillmentCreate_order_total_gross; gross: FulfillOrder_orderFulfill_order_total_gross;
tax: FulfillOrder_orderFulfillmentCreate_order_total_tax; tax: FulfillOrder_orderFulfill_order_total_tax;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_totalAuthorized { export interface FulfillOrder_orderFulfill_order_totalAuthorized {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_totalCaptured { export interface FulfillOrder_orderFulfill_order_totalCaptured {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_user { export interface FulfillOrder_orderFulfill_order_user {
__typename: "User"; __typename: "User";
id: string; id: string;
email: string; email: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_availableShippingMethods_price { export interface FulfillOrder_orderFulfill_order_availableShippingMethods_price {
__typename: "Money"; __typename: "Money";
amount: number; amount: number;
currency: string; currency: string;
} }
export interface FulfillOrder_orderFulfillmentCreate_order_availableShippingMethods { export interface FulfillOrder_orderFulfill_order_availableShippingMethods {
__typename: "ShippingMethod"; __typename: "ShippingMethod";
id: string; id: string;
name: string; name: string;
price: FulfillOrder_orderFulfillmentCreate_order_availableShippingMethods_price | null; price: FulfillOrder_orderFulfill_order_availableShippingMethods_price | null;
} }
export interface FulfillOrder_orderFulfillmentCreate_order { export interface FulfillOrder_orderFulfill_order {
__typename: "Order"; __typename: "Order";
id: string; id: string;
billingAddress: FulfillOrder_orderFulfillmentCreate_order_billingAddress | null; billingAddress: FulfillOrder_orderFulfill_order_billingAddress | null;
canFinalize: boolean; canFinalize: boolean;
created: any; created: any;
customerNote: string; customerNote: string;
events: (FulfillOrder_orderFulfillmentCreate_order_events | null)[] | null; events: (FulfillOrder_orderFulfill_order_events | null)[] | null;
fulfillments: (FulfillOrder_orderFulfillmentCreate_order_fulfillments | null)[]; fulfillments: (FulfillOrder_orderFulfill_order_fulfillments | null)[];
lines: (FulfillOrder_orderFulfillmentCreate_order_lines | null)[]; lines: (FulfillOrder_orderFulfill_order_lines | null)[];
number: string | null; number: string | null;
paymentStatus: PaymentChargeStatusEnum | null; paymentStatus: PaymentChargeStatusEnum | null;
shippingAddress: FulfillOrder_orderFulfillmentCreate_order_shippingAddress | null; shippingAddress: FulfillOrder_orderFulfill_order_shippingAddress | null;
shippingMethod: FulfillOrder_orderFulfillmentCreate_order_shippingMethod | null; shippingMethod: FulfillOrder_orderFulfill_order_shippingMethod | null;
shippingMethodName: string | null; shippingMethodName: string | null;
shippingPrice: FulfillOrder_orderFulfillmentCreate_order_shippingPrice | null; shippingPrice: FulfillOrder_orderFulfill_order_shippingPrice | null;
status: OrderStatus; status: OrderStatus;
subtotal: FulfillOrder_orderFulfillmentCreate_order_subtotal | null; subtotal: FulfillOrder_orderFulfill_order_subtotal | null;
total: FulfillOrder_orderFulfillmentCreate_order_total | null; total: FulfillOrder_orderFulfill_order_total | null;
actions: (OrderAction | null)[]; actions: (OrderAction | null)[];
totalAuthorized: FulfillOrder_orderFulfillmentCreate_order_totalAuthorized | null; totalAuthorized: FulfillOrder_orderFulfill_order_totalAuthorized | null;
totalCaptured: FulfillOrder_orderFulfillmentCreate_order_totalCaptured | null; totalCaptured: FulfillOrder_orderFulfill_order_totalCaptured | null;
user: FulfillOrder_orderFulfillmentCreate_order_user | null; user: FulfillOrder_orderFulfill_order_user | null;
userEmail: string | null; userEmail: string | null;
availableShippingMethods: (FulfillOrder_orderFulfillmentCreate_order_availableShippingMethods | null)[] | null; availableShippingMethods: (FulfillOrder_orderFulfill_order_availableShippingMethods | null)[] | null;
} }
export interface FulfillOrder_orderFulfillmentCreate { export interface FulfillOrder_orderFulfill {
__typename: "FulfillmentCreate"; __typename: "OrderFulfill";
errors: FulfillOrder_orderFulfillmentCreate_errors[]; errors: FulfillOrder_orderFulfill_errors[];
order: FulfillOrder_orderFulfillmentCreate_order | null; order: FulfillOrder_orderFulfill_order | null;
} }
export interface FulfillOrder { export interface FulfillOrder {
orderFulfillmentCreate: FulfillOrder_orderFulfillmentCreate | null; orderFulfill: FulfillOrder_orderFulfill | null;
} }
export interface FulfillOrderVariables { export interface FulfillOrderVariables {
orderId: string; orderId: string;
input: FulfillmentCreateInput; input: OrderFulfillInput;
} }

View file

@ -1,282 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { FulfillmentCreateInput, OrderErrorCode, OrderEventsEmailsEnum, OrderEventsEnum, FulfillmentStatus, PaymentChargeStatusEnum, OrderStatus, OrderAction } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: OrderCreateFulfillment
// ====================================================
export interface OrderCreateFulfillment_orderFulfillmentCreate_errors {
__typename: "OrderError";
code: OrderErrorCode;
field: string | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_billingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_billingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
country: OrderCreateFulfillment_orderFulfillmentCreate_order_billingAddress_country;
countryArea: string;
firstName: string;
id: string;
lastName: string;
phone: string | null;
postalCode: string;
streetAddress1: string;
streetAddress2: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_events_user {
__typename: "User";
id: string;
email: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_events {
__typename: "OrderEvent";
id: string;
amount: number | null;
date: any | null;
email: string | null;
emailType: OrderEventsEmailsEnum | null;
message: string | null;
quantity: number | null;
type: OrderEventsEnum | null;
user: OrderCreateFulfillment_orderFulfillmentCreate_order_events_user | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice {
__typename: "TaxedMoney";
gross: OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_gross;
net: OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice_net;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_thumbnail {
__typename: "Image";
url: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine {
__typename: "OrderLine";
id: string;
isShippingRequired: boolean;
productName: string;
productSku: string;
quantity: number;
quantityFulfilled: number;
unitPrice: OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_unitPrice | null;
thumbnail: OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine_thumbnail | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines {
__typename: "FulfillmentLine";
id: string;
quantity: number;
orderLine: OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines_orderLine | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments {
__typename: "Fulfillment";
id: string;
lines: (OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments_lines | null)[] | null;
fulfillmentOrder: number;
status: FulfillmentStatus;
trackingNumber: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice {
__typename: "TaxedMoney";
gross: OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice_gross;
net: OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice_net;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_lines_thumbnail {
__typename: "Image";
url: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_lines {
__typename: "OrderLine";
id: string;
isShippingRequired: boolean;
productName: string;
productSku: string;
quantity: number;
quantityFulfilled: number;
unitPrice: OrderCreateFulfillment_orderFulfillmentCreate_order_lines_unitPrice | null;
thumbnail: OrderCreateFulfillment_orderFulfillmentCreate_order_lines_thumbnail | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_shippingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_shippingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
country: OrderCreateFulfillment_orderFulfillmentCreate_order_shippingAddress_country;
countryArea: string;
firstName: string;
id: string;
lastName: string;
phone: string | null;
postalCode: string;
streetAddress1: string;
streetAddress2: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_shippingMethod {
__typename: "ShippingMethod";
id: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_shippingPrice_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_shippingPrice {
__typename: "TaxedMoney";
gross: OrderCreateFulfillment_orderFulfillmentCreate_order_shippingPrice_gross;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_subtotal_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_subtotal {
__typename: "TaxedMoney";
gross: OrderCreateFulfillment_orderFulfillmentCreate_order_subtotal_gross;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_total_gross {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_total_tax {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_total {
__typename: "TaxedMoney";
gross: OrderCreateFulfillment_orderFulfillmentCreate_order_total_gross;
tax: OrderCreateFulfillment_orderFulfillmentCreate_order_total_tax;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_user {
__typename: "User";
id: string;
email: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_availableShippingMethods_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order_availableShippingMethods {
__typename: "ShippingMethod";
id: string;
name: string;
price: OrderCreateFulfillment_orderFulfillmentCreate_order_availableShippingMethods_price | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate_order {
__typename: "Order";
id: string;
billingAddress: OrderCreateFulfillment_orderFulfillmentCreate_order_billingAddress | null;
canFinalize: boolean;
created: any;
customerNote: string;
events: (OrderCreateFulfillment_orderFulfillmentCreate_order_events | null)[] | null;
fulfillments: (OrderCreateFulfillment_orderFulfillmentCreate_order_fulfillments | null)[];
lines: (OrderCreateFulfillment_orderFulfillmentCreate_order_lines | null)[];
number: string | null;
paymentStatus: PaymentChargeStatusEnum | null;
shippingAddress: OrderCreateFulfillment_orderFulfillmentCreate_order_shippingAddress | null;
shippingMethod: OrderCreateFulfillment_orderFulfillmentCreate_order_shippingMethod | null;
shippingMethodName: string | null;
shippingPrice: OrderCreateFulfillment_orderFulfillmentCreate_order_shippingPrice | null;
status: OrderStatus;
subtotal: OrderCreateFulfillment_orderFulfillmentCreate_order_subtotal | null;
total: OrderCreateFulfillment_orderFulfillmentCreate_order_total | null;
actions: (OrderAction | null)[];
totalAuthorized: OrderCreateFulfillment_orderFulfillmentCreate_order_totalAuthorized | null;
totalCaptured: OrderCreateFulfillment_orderFulfillmentCreate_order_totalCaptured | null;
user: OrderCreateFulfillment_orderFulfillmentCreate_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderCreateFulfillment_orderFulfillmentCreate_order_availableShippingMethods | null)[] | null;
}
export interface OrderCreateFulfillment_orderFulfillmentCreate {
__typename: "FulfillmentCreate";
errors: OrderCreateFulfillment_orderFulfillmentCreate_errors[];
order: OrderCreateFulfillment_orderFulfillmentCreate_order | null;
}
export interface OrderCreateFulfillment {
orderFulfillmentCreate: OrderCreateFulfillment_orderFulfillmentCreate | null;
}
export interface OrderCreateFulfillmentVariables {
order: string;
input: FulfillmentCreateInput;
}

View file

@ -7,7 +7,6 @@ import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandl
import { OrderAddNote } from "../../types/OrderAddNote"; import { OrderAddNote } from "../../types/OrderAddNote";
import { OrderCancel } from "../../types/OrderCancel"; import { OrderCancel } from "../../types/OrderCancel";
import { OrderCapture } from "../../types/OrderCapture"; import { OrderCapture } from "../../types/OrderCapture";
import { OrderCreateFulfillment } from "../../types/OrderCreateFulfillment";
import { OrderDraftCancel } from "../../types/OrderDraftCancel"; import { OrderDraftCancel } from "../../types/OrderDraftCancel";
import { OrderDraftFinalize } from "../../types/OrderDraftFinalize"; import { OrderDraftFinalize } from "../../types/OrderDraftFinalize";
import { OrderDraftUpdate } from "../../types/OrderDraftUpdate"; import { OrderDraftUpdate } from "../../types/OrderDraftUpdate";
@ -31,7 +30,6 @@ interface OrderDetailsMessages {
handleNoteAdd: (data: OrderAddNote) => void; handleNoteAdd: (data: OrderAddNote) => void;
handleOrderCancel: (data: OrderCancel) => void; handleOrderCancel: (data: OrderCancel) => void;
handleOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void; handleOrderFulfillmentCancel: (data: OrderFulfillmentCancel) => void;
handleOrderFulfillmentCreate: (data: OrderCreateFulfillment) => void;
handleOrderFulfillmentUpdate: ( handleOrderFulfillmentUpdate: (
data: OrderFulfillmentUpdateTracking data: OrderFulfillmentUpdateTracking
) => void; ) => void;
@ -86,17 +84,6 @@ export const OrderDetailsMessages: React.FC<OrderDetailsMessages> = ({
closeModal(); closeModal();
} }
}; };
const handleOrderFulfillmentCreate = (data: OrderCreateFulfillment) => {
const errs = data.orderFulfillmentCreate?.errors;
if (errs.length === 0) {
pushMessage({
text: intl.formatMessage({
defaultMessage: "Items successfully fulfilled"
})
});
closeModal();
}
};
const handleOrderMarkAsPaid = (data: OrderMarkAsPaid) => { const handleOrderMarkAsPaid = (data: OrderMarkAsPaid) => {
const errs = data.orderMarkAsPaid?.errors; const errs = data.orderMarkAsPaid?.errors;
if (errs.length === 0) { if (errs.length === 0) {
@ -256,7 +243,6 @@ export const OrderDetailsMessages: React.FC<OrderDetailsMessages> = ({
handleNoteAdd, handleNoteAdd,
handleOrderCancel, handleOrderCancel,
handleOrderFulfillmentCancel, handleOrderFulfillmentCancel,
handleOrderFulfillmentCreate,
handleOrderFulfillmentUpdate, handleOrderFulfillmentUpdate,
handleOrderLineDelete, handleOrderLineDelete,
handleOrderLineUpdate, handleOrderLineUpdate,

View file

@ -125,9 +125,6 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
{orderMessages => ( {orderMessages => (
<OrderOperations <OrderOperations
order={id} order={id}
onOrderFulfillmentCreate={
orderMessages.handleOrderFulfillmentCreate
}
onNoteAdd={orderMessages.handleNoteAdd} onNoteAdd={orderMessages.handleNoteAdd}
onOrderCancel={orderMessages.handleOrderCancel} onOrderCancel={orderMessages.handleOrderCancel}
onOrderVoid={orderMessages.handleOrderVoid} onOrderVoid={orderMessages.handleOrderVoid}

View file

@ -32,7 +32,7 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
}); });
const [fulfillOrder, fulfillOrderOpts] = useOrderFulfill({ const [fulfillOrder, fulfillOrderOpts] = useOrderFulfill({
onCompleted: data => { onCompleted: data => {
if (data.orderFulfillmentCreate.errors.length === 0) { if (data.orderFulfill.errors.length === 0) {
navigate(orderUrl(orderId)); navigate(orderUrl(orderId));
notify({ notify({
text: intl.formatMessage({ text: intl.formatMessage({
@ -71,7 +71,10 @@ const OrderFulfill: React.FC<OrderFulfillProps> = ({ orderId }) => {
fulfillOrder({ fulfillOrder({
variables: { variables: {
input: { input: {
lines: formData.items.map(line => line.value), lines: formData.items.map(line => ({
orderLineId: line.id,
stocks: line.value
})),
notifyCustomer: formData.sendInfo notifyCustomer: formData.sendInfo
}, },
orderId orderId

View file

@ -456,6 +456,7 @@ export enum OrderErrorCode {
CANNOT_DELETE = "CANNOT_DELETE", CANNOT_DELETE = "CANNOT_DELETE",
CANNOT_REFUND = "CANNOT_REFUND", CANNOT_REFUND = "CANNOT_REFUND",
CAPTURE_INACTIVE_PAYMENT = "CAPTURE_INACTIVE_PAYMENT", CAPTURE_INACTIVE_PAYMENT = "CAPTURE_INACTIVE_PAYMENT",
DUPLICATED_INPUT_ITEM = "DUPLICATED_INPUT_ITEM",
FULFILL_ORDER_LINE = "FULFILL_ORDER_LINE", FULFILL_ORDER_LINE = "FULFILL_ORDER_LINE",
GRAPHQL_ERROR = "GRAPHQL_ERROR", GRAPHQL_ERROR = "GRAPHQL_ERROR",
INSUFFICIENT_STOCK = "INSUFFICIENT_STOCK", INSUFFICIENT_STOCK = "INSUFFICIENT_STOCK",
@ -790,6 +791,7 @@ export enum WebhookEventTypeEnum {
} }
export enum WebhookSortField { export enum WebhookSortField {
APP = "APP",
NAME = "NAME", NAME = "NAME",
SERVICE_ACCOUNT = "SERVICE_ACCOUNT", SERVICE_ACCOUNT = "SERVICE_ACCOUNT",
TARGET_URL = "TARGET_URL", TARGET_URL = "TARGET_URL",
@ -997,17 +999,6 @@ export interface FulfillmentCancelInput {
restock?: boolean | null; restock?: boolean | null;
} }
export interface FulfillmentCreateInput {
trackingNumber?: string | null;
notifyCustomer?: boolean | null;
lines: (FulfillmentLineInput | null)[];
}
export interface FulfillmentLineInput {
orderLineId?: string | null;
quantity?: number | null;
}
export interface FulfillmentUpdateTrackingInput { export interface FulfillmentUpdateTrackingInput {
trackingNumber?: string | null; trackingNumber?: string | null;
notifyCustomer?: boolean | null; notifyCustomer?: boolean | null;
@ -1074,6 +1065,21 @@ export interface OrderFilterInput {
search?: string | null; search?: string | null;
} }
export interface OrderFulfillInput {
lines: OrderFulfillLineInput[];
notifyCustomer?: boolean | null;
}
export interface OrderFulfillLineInput {
orderLineId?: string | null;
stocks: OrderFulfillStockInput[];
}
export interface OrderFulfillStockInput {
quantity?: number | null;
warehouse?: string | null;
}
export interface OrderLineCreateInput { export interface OrderLineCreateInput {
quantity: number; quantity: number;
variantId: string; variantId: string;
@ -1478,6 +1484,7 @@ export interface WebhookCreateInput {
targetUrl?: string | null; targetUrl?: string | null;
events?: (WebhookEventTypeEnum | null)[] | null; events?: (WebhookEventTypeEnum | null)[] | null;
serviceAccount?: string | null; serviceAccount?: string | null;
app?: string | null;
isActive?: boolean | null; isActive?: boolean | null;
secretKey?: string | null; secretKey?: string | null;
} }
@ -1497,6 +1504,7 @@ export interface WebhookUpdateInput {
targetUrl?: string | null; targetUrl?: string | null;
events?: (WebhookEventTypeEnum | null)[] | null; events?: (WebhookEventTypeEnum | null)[] | null;
serviceAccount?: string | null; serviceAccount?: string | null;
app?: string | null;
isActive?: boolean | null; isActive?: boolean | null;
secretKey?: string | null; secretKey?: string | null;
} }