2020-07-07 10:14:12 +00:00
|
|
|
import { fragmentAddress } from "@saleor/fragments/address";
|
2020-06-23 12:27:44 +00:00
|
|
|
import {
|
|
|
|
invoiceErrorFragment,
|
|
|
|
orderErrorFragment
|
|
|
|
} from "@saleor/fragments/errors";
|
2020-07-07 10:14:12 +00:00
|
|
|
import {
|
|
|
|
fragmentOrderDetails,
|
2020-07-07 14:01:16 +00:00
|
|
|
fragmentOrderEvent,
|
|
|
|
invoiceFragment
|
2020-07-07 10:14:12 +00:00
|
|
|
} from "@saleor/fragments/orders";
|
2020-05-14 09:30:32 +00:00
|
|
|
import makeMutation from "@saleor/hooks/makeMutation";
|
2019-06-19 14:40:52 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
|
|
|
import { TypedMutation } from "../mutations";
|
2020-05-14 09:30:32 +00:00
|
|
|
import { FulfillOrder, FulfillOrderVariables } from "./types/FulfillOrder";
|
2020-06-23 14:44:34 +00:00
|
|
|
import {
|
|
|
|
InvoiceEmailSend,
|
|
|
|
InvoiceEmailSendVariables
|
|
|
|
} from "./types/InvoiceEmailSend";
|
2020-06-23 12:27:44 +00:00
|
|
|
import {
|
|
|
|
InvoiceRequest,
|
|
|
|
InvoiceRequestVariables
|
|
|
|
} from "./types/InvoiceRequest";
|
2019-06-19 14:40:52 +00:00
|
|
|
import { OrderAddNote, OrderAddNoteVariables } from "./types/OrderAddNote";
|
|
|
|
import { OrderCancel, OrderCancelVariables } from "./types/OrderCancel";
|
|
|
|
import { OrderCapture, OrderCaptureVariables } from "./types/OrderCapture";
|
|
|
|
import {
|
|
|
|
OrderDraftBulkCancel,
|
|
|
|
OrderDraftBulkCancelVariables
|
|
|
|
} from "./types/OrderDraftBulkCancel";
|
|
|
|
import {
|
|
|
|
OrderDraftCancel,
|
|
|
|
OrderDraftCancelVariables
|
|
|
|
} from "./types/OrderDraftCancel";
|
|
|
|
import { OrderDraftCreate } from "./types/OrderDraftCreate";
|
|
|
|
import {
|
|
|
|
OrderDraftFinalize,
|
|
|
|
OrderDraftFinalizeVariables
|
|
|
|
} from "./types/OrderDraftFinalize";
|
|
|
|
import {
|
|
|
|
OrderDraftUpdate,
|
|
|
|
OrderDraftUpdateVariables
|
|
|
|
} from "./types/OrderDraftUpdate";
|
|
|
|
import {
|
|
|
|
OrderFulfillmentCancel,
|
|
|
|
OrderFulfillmentCancelVariables
|
|
|
|
} from "./types/OrderFulfillmentCancel";
|
|
|
|
import {
|
|
|
|
OrderFulfillmentUpdateTracking,
|
|
|
|
OrderFulfillmentUpdateTrackingVariables
|
|
|
|
} from "./types/OrderFulfillmentUpdateTracking";
|
|
|
|
import {
|
|
|
|
OrderLineDelete,
|
|
|
|
OrderLineDeleteVariables
|
|
|
|
} from "./types/OrderLineDelete";
|
|
|
|
import { OrderLinesAdd, OrderLinesAddVariables } from "./types/OrderLinesAdd";
|
|
|
|
import {
|
|
|
|
OrderLineUpdate,
|
|
|
|
OrderLineUpdateVariables
|
|
|
|
} from "./types/OrderLineUpdate";
|
|
|
|
import {
|
|
|
|
OrderMarkAsPaid,
|
|
|
|
OrderMarkAsPaidVariables
|
|
|
|
} from "./types/OrderMarkAsPaid";
|
|
|
|
import { OrderRefund, OrderRefundVariables } from "./types/OrderRefund";
|
|
|
|
import {
|
|
|
|
OrderShippingMethodUpdate,
|
|
|
|
OrderShippingMethodUpdateVariables
|
|
|
|
} from "./types/OrderShippingMethodUpdate";
|
|
|
|
import { OrderUpdate, OrderUpdateVariables } from "./types/OrderUpdate";
|
|
|
|
import { OrderVoid, OrderVoidVariables } from "./types/OrderVoid";
|
|
|
|
|
|
|
|
const orderCancelMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2020-04-28 01:09:31 +00:00
|
|
|
mutation OrderCancel($id: ID!) {
|
|
|
|
orderCancel(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderCancelMutation = TypedMutation<
|
|
|
|
OrderCancel,
|
|
|
|
OrderCancelVariables
|
|
|
|
>(orderCancelMutation);
|
|
|
|
|
|
|
|
const orderDraftCancelMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderDraftCancel($id: ID!) {
|
|
|
|
draftOrderDelete(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderDraftCancelMutation = TypedMutation<
|
|
|
|
OrderDraftCancel,
|
|
|
|
OrderDraftCancelVariables
|
|
|
|
>(orderDraftCancelMutation);
|
|
|
|
|
|
|
|
const orderDraftBulkCancelMutation = gql`
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderDraftBulkCancel($ids: [ID]!) {
|
|
|
|
draftOrderBulkDelete(ids: $ids) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderDraftBulkCancelMutation = TypedMutation<
|
|
|
|
OrderDraftBulkCancel,
|
|
|
|
OrderDraftBulkCancelVariables
|
|
|
|
>(orderDraftBulkCancelMutation);
|
|
|
|
|
|
|
|
const orderDraftFinalizeMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderDraftFinalize($id: ID!) {
|
|
|
|
draftOrderComplete(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderDraftFinalizeMutation = TypedMutation<
|
|
|
|
OrderDraftFinalize,
|
|
|
|
OrderDraftFinalizeVariables
|
|
|
|
>(orderDraftFinalizeMutation);
|
|
|
|
|
|
|
|
const orderRefundMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2020-09-07 10:48:19 +00:00
|
|
|
mutation OrderRefund($id: ID!, $amount: PositiveDecimal!) {
|
2019-06-19 14:40:52 +00:00
|
|
|
orderRefund(id: $id, amount: $amount) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderRefundMutation = TypedMutation<
|
|
|
|
OrderRefund,
|
|
|
|
OrderRefundVariables
|
|
|
|
>(orderRefundMutation);
|
|
|
|
|
|
|
|
const orderVoidMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderVoid($id: ID!) {
|
|
|
|
orderVoid(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderVoidMutation = TypedMutation<
|
|
|
|
OrderVoid,
|
|
|
|
OrderVoidVariables
|
|
|
|
>(orderVoidMutation);
|
|
|
|
|
|
|
|
const orderMarkAsPaidMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderMarkAsPaid($id: ID!) {
|
|
|
|
orderMarkAsPaid(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderMarkAsPaidMutation = TypedMutation<
|
|
|
|
OrderMarkAsPaid,
|
|
|
|
OrderMarkAsPaidVariables
|
|
|
|
>(orderMarkAsPaidMutation);
|
|
|
|
|
|
|
|
const orderCaptureMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2020-09-07 10:48:19 +00:00
|
|
|
mutation OrderCapture($id: ID!, $amount: PositiveDecimal!) {
|
2019-06-19 14:40:52 +00:00
|
|
|
orderCapture(id: $id, amount: $amount) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderCaptureMutation = TypedMutation<
|
|
|
|
OrderCapture,
|
|
|
|
OrderCaptureVariables
|
|
|
|
>(orderCaptureMutation);
|
|
|
|
|
|
|
|
const orderFulfillmentUpdateTrackingMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderFulfillmentUpdateTracking(
|
|
|
|
$id: ID!
|
|
|
|
$input: FulfillmentUpdateTrackingInput!
|
|
|
|
) {
|
|
|
|
orderFulfillmentUpdateTracking(id: $id, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderFulfillmentUpdateTrackingMutation = TypedMutation<
|
|
|
|
OrderFulfillmentUpdateTracking,
|
|
|
|
OrderFulfillmentUpdateTrackingVariables
|
|
|
|
>(orderFulfillmentUpdateTrackingMutation);
|
|
|
|
|
|
|
|
const orderFulfillmentCancelMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderFulfillmentCancel($id: ID!, $input: FulfillmentCancelInput!) {
|
|
|
|
orderFulfillmentCancel(id: $id, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderFulfillmentCancelMutation = TypedMutation<
|
|
|
|
OrderFulfillmentCancel,
|
|
|
|
OrderFulfillmentCancelVariables
|
|
|
|
>(orderFulfillmentCancelMutation);
|
|
|
|
|
|
|
|
const orderAddNoteMutation = gql`
|
|
|
|
${fragmentOrderEvent}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderAddNote($order: ID!, $input: OrderAddNoteInput!) {
|
|
|
|
orderAddNote(order: $order, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
id
|
|
|
|
events {
|
|
|
|
...OrderEventFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderAddNoteMutation = TypedMutation<
|
|
|
|
OrderAddNote,
|
|
|
|
OrderAddNoteVariables
|
|
|
|
>(orderAddNoteMutation);
|
|
|
|
|
|
|
|
const orderUpdateMutation = gql`
|
|
|
|
${fragmentAddress}
|
2020-03-11 09:55:14 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderUpdate($id: ID!, $input: OrderUpdateInput!) {
|
|
|
|
orderUpdate(id: $id, input: $input) {
|
2020-03-11 09:55:14 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
id
|
|
|
|
userEmail
|
|
|
|
billingAddress {
|
|
|
|
...AddressFragment
|
|
|
|
}
|
|
|
|
shippingAddress {
|
|
|
|
...AddressFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderUpdateMutation = TypedMutation<
|
|
|
|
OrderUpdate,
|
|
|
|
OrderUpdateVariables
|
|
|
|
>(orderUpdateMutation);
|
|
|
|
|
|
|
|
const orderDraftUpdateMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderDraftUpdate($id: ID!, $input: DraftOrderInput!) {
|
|
|
|
draftOrderUpdate(id: $id, input: $input) {
|
2020-03-11 09:55:14 +00:00
|
|
|
errors: orderErrors {
|
2020-03-11 16:03:41 +00:00
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderDraftUpdateMutation = TypedMutation<
|
|
|
|
OrderDraftUpdate,
|
|
|
|
OrderDraftUpdateVariables
|
|
|
|
>(orderDraftUpdateMutation);
|
|
|
|
|
|
|
|
const orderShippingMethodUpdateMutation = gql`
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderShippingMethodUpdate(
|
|
|
|
$id: ID!
|
|
|
|
$input: OrderUpdateShippingInput!
|
|
|
|
) {
|
|
|
|
orderUpdateShipping(order: $id, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
availableShippingMethods {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
id
|
|
|
|
shippingMethod {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
price {
|
|
|
|
amount
|
|
|
|
currency
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shippingMethodName
|
|
|
|
shippingPrice {
|
|
|
|
gross {
|
|
|
|
amount
|
|
|
|
currency
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderShippingMethodUpdateMutation = TypedMutation<
|
|
|
|
OrderShippingMethodUpdate,
|
|
|
|
OrderShippingMethodUpdateVariables
|
|
|
|
>(orderShippingMethodUpdateMutation);
|
|
|
|
|
|
|
|
const orderDraftCreateMutation = gql`
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderDraftCreate {
|
|
|
|
draftOrderCreate(input: {}) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2019-11-22 15:39:20 +00:00
|
|
|
export const useOrderDraftCreateMutation = makeMutation<OrderDraftCreate, {}>(
|
|
|
|
orderDraftCreateMutation
|
|
|
|
);
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
const orderLineDeleteMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderLineDelete($id: ID!) {
|
|
|
|
draftOrderLineDelete(id: $id) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderLineDeleteMutation = TypedMutation<
|
|
|
|
OrderLineDelete,
|
|
|
|
OrderLineDeleteVariables
|
|
|
|
>(orderLineDeleteMutation);
|
|
|
|
|
|
|
|
const orderLinesAddMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderLinesAdd($id: ID!, $input: [OrderLineCreateInput]!) {
|
|
|
|
draftOrderLinesCreate(id: $id, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderLinesAddMutation = TypedMutation<
|
|
|
|
OrderLinesAdd,
|
|
|
|
OrderLinesAddVariables
|
|
|
|
>(orderLinesAddMutation);
|
|
|
|
|
|
|
|
const orderLineUpdateMutation = gql`
|
|
|
|
${fragmentOrderDetails}
|
2020-03-11 16:03:41 +00:00
|
|
|
${orderErrorFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
mutation OrderLineUpdate($id: ID!, $input: OrderLineInput!) {
|
|
|
|
draftOrderLineUpdate(id: $id, input: $input) {
|
2020-03-11 16:03:41 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedOrderLineUpdateMutation = TypedMutation<
|
|
|
|
OrderLineUpdate,
|
|
|
|
OrderLineUpdateVariables
|
|
|
|
>(orderLineUpdateMutation);
|
2020-04-21 22:03:23 +00:00
|
|
|
|
|
|
|
const fulfillOrder = gql`
|
2020-04-24 11:56:28 +00:00
|
|
|
${fragmentOrderDetails}
|
|
|
|
${orderErrorFragment}
|
|
|
|
mutation FulfillOrder($orderId: ID!, $input: OrderFulfillInput!) {
|
|
|
|
orderFulfill(order: $orderId, input: $input) {
|
2020-04-21 22:03:23 +00:00
|
|
|
errors: orderErrors {
|
|
|
|
...OrderErrorFragment
|
2020-04-27 13:42:56 +00:00
|
|
|
warehouse
|
|
|
|
orderLine
|
2020-04-21 22:03:23 +00:00
|
|
|
}
|
|
|
|
order {
|
|
|
|
...OrderDetailsFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const useOrderFulfill = makeMutation<
|
|
|
|
FulfillOrder,
|
|
|
|
FulfillOrderVariables
|
|
|
|
>(fulfillOrder);
|
2020-06-23 12:27:44 +00:00
|
|
|
|
|
|
|
const invoiceRequestMutation = gql`
|
|
|
|
${invoiceErrorFragment}
|
2020-07-03 10:05:44 +00:00
|
|
|
${invoiceFragment}
|
2020-06-23 12:27:44 +00:00
|
|
|
mutation InvoiceRequest($orderId: ID!) {
|
2020-06-25 11:36:43 +00:00
|
|
|
invoiceRequest(orderId: $orderId) {
|
2020-06-23 12:27:44 +00:00
|
|
|
errors: invoiceErrors {
|
|
|
|
...InvoiceErrorFragment
|
|
|
|
}
|
|
|
|
invoice {
|
|
|
|
...InvoiceFragment
|
|
|
|
}
|
2020-07-08 07:45:25 +00:00
|
|
|
order {
|
|
|
|
id
|
|
|
|
invoices {
|
|
|
|
...InvoiceFragment
|
|
|
|
}
|
|
|
|
}
|
2020-06-23 12:27:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedInvoiceRequestMutation = TypedMutation<
|
|
|
|
InvoiceRequest,
|
|
|
|
InvoiceRequestVariables
|
|
|
|
>(invoiceRequestMutation);
|
2020-06-23 14:44:34 +00:00
|
|
|
|
|
|
|
const invoiceEmailSendMutation = gql`
|
|
|
|
${invoiceErrorFragment}
|
2020-07-03 10:05:44 +00:00
|
|
|
${invoiceFragment}
|
2020-06-23 14:44:34 +00:00
|
|
|
mutation InvoiceEmailSend($id: ID!) {
|
2020-06-25 11:36:43 +00:00
|
|
|
invoiceSendEmail(id: $id) {
|
2020-06-23 14:44:34 +00:00
|
|
|
errors: invoiceErrors {
|
|
|
|
...InvoiceErrorFragment
|
|
|
|
}
|
|
|
|
invoice {
|
|
|
|
...InvoiceFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
export const TypedInvoiceEmailSendMutation = TypedMutation<
|
|
|
|
InvoiceEmailSend,
|
|
|
|
InvoiceEmailSendVariables
|
|
|
|
>(invoiceEmailSendMutation);
|