saleor-dashboard/src/fragments/orders.ts
Dawid Tarasiuk eb351b396a
Refunds (#870)
* 1721 - add refunds miscellaneous view (#860)

* Create new page for Miscellaneous Refunds

* Replace refund order dialog with dedicated page

* Add data test ids

* Update order details view for refunds (#874)

* 1719 - add refund entry to order history (#875)

* Add refund order history entry

* Update refund event with the right query

* 1722 - add refunds product view (#873)

* Create new page for Miscellaneous Refunds

* Replace refund order dialog with dedicated page

* Add data test ids

* Create refund products table

* Implement refund products view

* Update refund mutation with product lines input

* Fix products quantities on refund page

* Fix order refund submission

* Fix products refund submission input variables

* Filter out fulfillments on refund page

* Update refund page in storybook

* Fix test snapshots after wrong refunds rebase

* Set max refund as captured amount

* Refund queries adjustments

* Display refund values with nullish coalescing operator

* Update test snapshots with refunds

* Refactor order refund values calculation

* Create and use refund order line fragment

* Use old simple refund mutation for miscellaneous refund

* Submit for refund only lines with non-zero quantity set

* Fix showing refund error

* Fix refund details on order details page (#879)

* Update order details view for refunds (#874)

* 1719 - add refund entry to order history (#875)

* Add refund order history entry

* Update refund event with the right query

* 1722 - add refunds product view (#873)

* Create new page for Miscellaneous Refunds

* Replace refund order dialog with dedicated page

* Add data test ids

* Create refund products table

* Implement refund products view

* Update refund mutation with product lines input

* Fix products quantities on refund page

* Fix order refund submission

* Fix products refund submission input variables

* Filter out fulfillments on refund page

* Update refund page in storybook

* Fix test snapshots after wrong refunds rebase

* Set max refund as captured amount

* Refund queries adjustments

* Display refund values with nullish coalescing operator

* Update test snapshots with refunds

* Refactor order refund values calculation

* Create and use refund order line fragment

* Use old simple refund mutation for miscellaneous refund

* Submit for refund only lines with non-zero quantity set

* Fix showing refund error

* Add missing refund amount to order history

* Merge repeated order lines in fulfillment lines

* Update order history events types and test snapshots

* Update changelog with refunds changes
2020-12-01 14:13:05 +01:00

209 lines
3.1 KiB
TypeScript

import gql from "graphql-tag";
import { fragmentAddress } from "./address";
import { metadataFragment } from "./metadata";
export const fragmentOrderEvent = gql`
fragment OrderEventFragment on OrderEvent {
id
amount
shippingCostsIncluded
date
email
emailType
invoiceNumber
message
quantity
transactionReference
type
user {
id
email
}
lines {
quantity
orderLine {
id
productName
variantName
}
}
}
`;
export const fragmentOrderLine = gql`
fragment OrderLineFragment on OrderLine {
id
isShippingRequired
variant {
id
quantityAvailable
}
productName
productSku
quantity
quantityFulfilled
unitPrice {
gross {
amount
currency
}
net {
amount
currency
}
}
thumbnail {
url
}
}
`;
export const fragmentRefundOrderLine = gql`
fragment RefundOrderLineFragment on OrderLine {
id
productName
quantity
unitPrice {
gross {
...Money
}
}
thumbnail(size: 64) {
url
}
}
`;
export const fulfillmentFragment = gql`
${fragmentOrderLine}
fragment FulfillmentFragment on Fulfillment {
id
lines {
id
quantity
orderLine {
...OrderLineFragment
}
}
fulfillmentOrder
status
trackingNumber
warehouse {
id
name
}
}
`;
export const invoiceFragment = gql`
fragment InvoiceFragment on Invoice {
id
number
createdAt
url
status
}
`;
export const fragmentOrderDetails = gql`
${fragmentAddress}
${fragmentOrderEvent}
${fragmentOrderLine}
${fulfillmentFragment}
${invoiceFragment}
${metadataFragment}
fragment OrderDetailsFragment on Order {
id
...MetadataFragment
billingAddress {
...AddressFragment
}
canFinalize
created
customerNote
events {
...OrderEventFragment
}
fulfillments {
...FulfillmentFragment
}
lines {
...OrderLineFragment
}
number
paymentStatus
shippingAddress {
...AddressFragment
}
shippingMethod {
id
}
shippingMethodName
shippingPrice {
gross {
amount
currency
}
}
status
subtotal {
gross {
amount
currency
}
}
total {
gross {
amount
currency
}
tax {
amount
currency
}
}
actions
totalAuthorized {
amount
currency
}
totalCaptured {
amount
currency
}
user {
id
email
}
userEmail
availableShippingMethods {
id
name
price {
amount
currency
}
}
discount {
amount
currency
}
invoices {
...InvoiceFragment
}
channel {
isActive
id
name
currencyCode
}
isPaid
}
`;
export const fragmentOrderSettings = gql`
fragment OrderSettingsFragment on OrderSettings {
automaticallyConfirmAllNewOrders
}
`;