2020-12-01 13:13:05 +00:00
|
|
|
/* eslint-disable sort-keys */
|
|
|
|
import { FormsetData } from "@saleor/hooks/useFormset";
|
2021-01-20 16:16:43 +00:00
|
|
|
import {
|
|
|
|
FulfillmentStatus,
|
|
|
|
OrderStatus,
|
|
|
|
PaymentChargeStatusEnum
|
|
|
|
} from "@saleor/types/globalTypes";
|
2020-12-01 13:13:05 +00:00
|
|
|
|
2021-01-20 16:16:43 +00:00
|
|
|
import { LineItemData } from "../components/OrderReturnPage/form";
|
|
|
|
import {
|
|
|
|
OrderDetails_order,
|
|
|
|
OrderDetails_order_fulfillments_lines,
|
|
|
|
OrderDetails_order_lines
|
|
|
|
} from "../types/OrderDetails";
|
2020-12-01 13:13:05 +00:00
|
|
|
import {
|
|
|
|
OrderRefundData_order_fulfillments,
|
|
|
|
OrderRefundData_order_lines
|
|
|
|
} from "../types/OrderRefundData";
|
|
|
|
import {
|
|
|
|
getAllFulfillmentLinesPriceSum,
|
|
|
|
getPreviouslyRefundedPrice,
|
|
|
|
getRefundedLinesPriceSum,
|
2021-01-20 16:16:43 +00:00
|
|
|
getReplacedProductsAmount,
|
|
|
|
getReturnSelectedProductsAmount,
|
2021-08-20 14:36:05 +00:00
|
|
|
getWarehousesFromOrderLines,
|
2020-12-01 13:13:05 +00:00
|
|
|
mergeRepeatedOrderLines,
|
2021-08-20 14:36:05 +00:00
|
|
|
OrderLineWithStockWarehouses,
|
2020-12-01 13:13:05 +00:00
|
|
|
OrderWithTotalAndTotalCaptured
|
|
|
|
} from "./data";
|
|
|
|
|
2021-01-20 16:16:43 +00:00
|
|
|
const orderBase: OrderDetails_order = {
|
|
|
|
__typename: "Order",
|
|
|
|
actions: [],
|
|
|
|
availableShippingMethods: [],
|
|
|
|
canFinalize: true,
|
|
|
|
channel: null,
|
|
|
|
billingAddress: {
|
|
|
|
__typename: "Address",
|
|
|
|
city: "Port Danielshire",
|
|
|
|
cityArea: "",
|
|
|
|
companyName: "",
|
|
|
|
country: {
|
|
|
|
__typename: "CountryDisplay",
|
|
|
|
code: "SE",
|
|
|
|
country: "Szwecja"
|
|
|
|
},
|
|
|
|
countryArea: "",
|
|
|
|
firstName: "Elizabeth",
|
|
|
|
id: "QWRkcmVzczoy",
|
|
|
|
lastName: "Vaughn",
|
|
|
|
phone: "",
|
|
|
|
postalCode: "52203",
|
|
|
|
streetAddress1: "419 Ruiz Orchard Apt. 199",
|
|
|
|
streetAddress2: ""
|
|
|
|
},
|
|
|
|
created: "2018-09-11T09:37:30.124154+00:00",
|
|
|
|
id: "T3JkZXI6MTk=",
|
|
|
|
number: "19",
|
|
|
|
paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
|
|
|
|
status: OrderStatus.FULFILLED,
|
|
|
|
// @ts-ignore
|
|
|
|
total: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 1215.89,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-08-20 14:36:05 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-12-01 13:13:05 +00:00
|
|
|
describe("Get previously refunded price", () => {
|
|
|
|
it("is able to calculate refunded price from order", () => {
|
|
|
|
const order: OrderWithTotalAndTotalCaptured = {
|
|
|
|
total: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 160,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
totalCaptured: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 100,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const refundedPrice = getPreviouslyRefundedPrice(order);
|
|
|
|
|
|
|
|
expect(refundedPrice.amount).toBe(-60);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Get refunded lines price sum", () => {
|
|
|
|
const lines: OrderRefundData_order_lines[] = [
|
|
|
|
{
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "1",
|
|
|
|
productName: "Milk 1",
|
|
|
|
quantity: 1,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 10,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "2",
|
|
|
|
productName: "Milk 2",
|
|
|
|
quantity: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 6,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "3",
|
|
|
|
productName: "Milk 3",
|
|
|
|
quantity: 4,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 4,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
it("is able to sum lines prices", () => {
|
|
|
|
const refundedProductQuantities: FormsetData<null, string> = [
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const refundedLinesPriceSum = getRefundedLinesPriceSum(
|
|
|
|
lines,
|
|
|
|
refundedProductQuantities
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(refundedLinesPriceSum).toBe(20);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("is able to sum lines prices multiplied by different quantities", () => {
|
|
|
|
const refundedProductQuantities: FormsetData<null, string> = [
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: "0"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: "2"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: "4"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const refundedLinesPriceSum = getRefundedLinesPriceSum(
|
|
|
|
lines,
|
|
|
|
refundedProductQuantities
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(refundedLinesPriceSum).toBe(28);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Get get all fulfillment lines price sum", () => {
|
|
|
|
const fulfillments: OrderRefundData_order_fulfillments[] = [
|
|
|
|
{
|
|
|
|
__typename: "Fulfillment",
|
|
|
|
fulfillmentOrder: 1,
|
|
|
|
id: "1",
|
|
|
|
lines: [
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "1-fulfillment-1",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "1-line-1",
|
|
|
|
productName: "Milk 1",
|
|
|
|
quantity: 1,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 10,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
status: FulfillmentStatus.FULFILLED
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "Fulfillment",
|
|
|
|
fulfillmentOrder: 2,
|
|
|
|
id: "2",
|
|
|
|
lines: [
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "2-fulfillment-1",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "2-line-1",
|
|
|
|
productName: "Milk 1",
|
|
|
|
quantity: 2,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 6,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "2-fulfillment-2",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "2-line-2",
|
|
|
|
productName: "Milk 2",
|
|
|
|
quantity: 2,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 6,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
status: FulfillmentStatus.FULFILLED
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "Fulfillment",
|
|
|
|
fulfillmentOrder: 1,
|
|
|
|
id: "3",
|
|
|
|
lines: [
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "3-fulfillment-1",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "3-line-1",
|
|
|
|
productName: "Milk 1",
|
|
|
|
quantity: 4,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 4,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "3-fulfillment-2",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "3-line-2",
|
|
|
|
productName: "Milk 2",
|
|
|
|
quantity: 4,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 4,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
__typename: "FulfillmentLine",
|
|
|
|
id: "3-fulfillment-3",
|
|
|
|
orderLine: {
|
|
|
|
__typename: "OrderLine",
|
|
|
|
id: "3-line-3",
|
|
|
|
productName: "Milk 3",
|
|
|
|
quantity: 4,
|
|
|
|
thumbnail: undefined,
|
|
|
|
unitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 4,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
quantity: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
status: FulfillmentStatus.FULFILLED
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
it("is able to sum fulfillment lines prices", () => {
|
|
|
|
const refundedFulfilledProductQuantities: FormsetData<null, string> = [
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "1-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2-fulfillment-2",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-2",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-3",
|
|
|
|
label: null,
|
|
|
|
value: "1"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const allFulfillmentLinesPriceSum = getAllFulfillmentLinesPriceSum(
|
|
|
|
fulfillments,
|
|
|
|
refundedFulfilledProductQuantities
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(allFulfillmentLinesPriceSum).toBe(34);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("is able to sum fulfillment lines prices multiplied by different quantities", () => {
|
|
|
|
const refundedFulfilledProductQuantities: FormsetData<null, string> = [
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "1-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "0"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "2"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "2-fulfillment-2",
|
|
|
|
label: null,
|
|
|
|
value: "2"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-1",
|
|
|
|
label: null,
|
|
|
|
value: "4"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-2",
|
|
|
|
label: null,
|
|
|
|
value: "4"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
id: "3-fulfillment-3",
|
|
|
|
label: null,
|
|
|
|
value: "4"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const allFulfillmentLinesPriceSum = getAllFulfillmentLinesPriceSum(
|
|
|
|
fulfillments,
|
|
|
|
refundedFulfilledProductQuantities
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(allFulfillmentLinesPriceSum).toBe(72);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-01-20 16:16:43 +00:00
|
|
|
describe("Get the total value of all replaced products", () => {
|
|
|
|
it("sums up correctly", () => {
|
|
|
|
const unfulfilledLines: OrderDetails_order_lines[] = [
|
|
|
|
{
|
|
|
|
id: "1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 2,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "2",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 10,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 8,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "3",
|
|
|
|
isShippingRequired: true,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6Mjg2",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "T-shirt",
|
|
|
|
productSku: "29810068",
|
|
|
|
quantity: 6,
|
|
|
|
quantityFulfilled: 1,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 5,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const fulfilledLines: OrderDetails_order_fulfillments_lines[] = [
|
|
|
|
{
|
|
|
|
id: "4",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 20,
|
|
|
|
quantityFulfilled: 6,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 14,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "5",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 25,
|
|
|
|
quantityFulfilled: 8,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 17,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "6",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ3",
|
|
|
|
isShippingRequired: true,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6Mjg2",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "T-shirt",
|
|
|
|
productSku: "29810068",
|
|
|
|
quantity: 10,
|
|
|
|
quantityFulfilled: 3,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 7,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "7",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 20,
|
|
|
|
quantityFulfilled: 6,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 14,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "8",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 25,
|
|
|
|
quantityFulfilled: 8,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 17,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-01-21 13:21:58 +00:00
|
|
|
const unfulfilledItemsQuantities: FormsetData<LineItemData, number> = [
|
2021-01-20 16:16:43 +00:00
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: 1
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-01-21 13:21:58 +00:00
|
|
|
const fulfilledItemsQuantities: FormsetData<LineItemData, number> = [
|
2021-01-20 16:16:43 +00:00
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "4",
|
|
|
|
label: null,
|
|
|
|
value: 4
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "5",
|
|
|
|
label: null,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "6",
|
|
|
|
label: null,
|
|
|
|
value: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "7",
|
|
|
|
label: null,
|
|
|
|
value: 4
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "8",
|
|
|
|
label: null,
|
|
|
|
value: 3
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const itemsToBeReplaced: FormsetData<LineItemData, boolean> = [
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "4",
|
|
|
|
label: null,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "5",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "6",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "7",
|
|
|
|
label: null,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "8",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const totalValue = getReplacedProductsAmount(
|
|
|
|
{
|
|
|
|
...orderBase,
|
|
|
|
lines: unfulfilledLines,
|
|
|
|
fulfillments: [
|
|
|
|
{
|
|
|
|
id: "#1",
|
|
|
|
fulfillmentOrder: 1,
|
|
|
|
status: FulfillmentStatus.FULFILLED,
|
|
|
|
warehouse: null,
|
|
|
|
trackingNumber: "",
|
|
|
|
lines: fulfilledLines,
|
|
|
|
__typename: "Fulfillment"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
itemsToBeReplaced,
|
2021-01-21 13:21:58 +00:00
|
|
|
unfulfilledItemsQuantities,
|
|
|
|
fulfilledItemsQuantities
|
2021-01-20 16:16:43 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(totalValue).toBe(10);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Get the total value of all selected products", () => {
|
|
|
|
it("sums up correctly", () => {
|
|
|
|
const unfulfilledLines: OrderDetails_order_lines[] = [
|
|
|
|
{
|
|
|
|
id: "1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 2,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "2",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 10,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 8,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "3",
|
|
|
|
isShippingRequired: true,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6Mjg2",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "T-shirt",
|
|
|
|
productSku: "29810068",
|
|
|
|
quantity: 6,
|
|
|
|
quantityFulfilled: 1,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 5,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const fulfilledLines: OrderDetails_order_fulfillments_lines[] = [
|
|
|
|
{
|
|
|
|
id: "4",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 20,
|
|
|
|
quantityFulfilled: 6,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 14,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "5",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 25,
|
|
|
|
quantityFulfilled: 8,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 17,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "6",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ3",
|
|
|
|
isShippingRequired: true,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6Mjg2",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2021-01-20 16:16:43 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "T-shirt",
|
|
|
|
productSku: "29810068",
|
|
|
|
quantity: 10,
|
|
|
|
quantityFulfilled: 3,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 7,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2021-01-20 16:16:43 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-01-21 13:25:00 +00:00
|
|
|
const unfulfilledItemsQuantities: FormsetData<LineItemData, number> = [
|
2021-01-20 16:16:43 +00:00
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: 2
|
|
|
|
},
|
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: 1
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-01-21 13:25:00 +00:00
|
|
|
const fulfilledItemsQuantities: FormsetData<LineItemData, number> = [
|
2021-01-20 16:16:43 +00:00
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "4",
|
|
|
|
label: null,
|
|
|
|
value: 4
|
|
|
|
},
|
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "5",
|
|
|
|
label: null,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
2021-01-21 13:21:58 +00:00
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
2021-01-20 16:16:43 +00:00
|
|
|
id: "6",
|
|
|
|
label: null,
|
|
|
|
value: 3
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-09-09 10:59:37 +00:00
|
|
|
const waitingItemsQuantities: FormsetData<LineItemData, number> = [];
|
|
|
|
|
2021-01-20 16:16:43 +00:00
|
|
|
const itemsToBeReplaced: FormsetData<LineItemData, boolean> = [
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "1",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "2",
|
|
|
|
label: null,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: false, isRefunded: false },
|
|
|
|
id: "3",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "4",
|
|
|
|
label: null,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "5",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: false },
|
|
|
|
id: "6",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "7",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: { isFulfillment: true, isRefunded: true },
|
|
|
|
id: "8",
|
|
|
|
label: null,
|
|
|
|
value: true
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const totalValue = getReturnSelectedProductsAmount(
|
|
|
|
{
|
|
|
|
...orderBase,
|
|
|
|
lines: unfulfilledLines,
|
|
|
|
fulfillments: [
|
|
|
|
{
|
|
|
|
id: "#1",
|
|
|
|
fulfillmentOrder: 1,
|
|
|
|
status: FulfillmentStatus.FULFILLED,
|
|
|
|
warehouse: null,
|
|
|
|
trackingNumber: "",
|
|
|
|
lines: fulfilledLines,
|
|
|
|
__typename: "Fulfillment"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
itemsToBeReplaced,
|
2021-09-09 10:59:37 +00:00
|
|
|
waitingItemsQuantities,
|
2021-01-21 13:25:00 +00:00
|
|
|
unfulfilledItemsQuantities,
|
|
|
|
fulfilledItemsQuantities
|
2021-01-20 16:16:43 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(totalValue).toBe(59.94);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-12-01 13:13:05 +00:00
|
|
|
describe("Merge repeated order lines of fulfillment lines", () => {
|
|
|
|
it("is able to merge repeated order lines and sum their quantities", () => {
|
|
|
|
const lines: OrderDetails_order_fulfillments_lines[] = [
|
|
|
|
{
|
|
|
|
id: "RnVsZmlsbG1lbnRMaW5lOjMx",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2020-12-01 13:13:05 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 2,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "RnVsZmlsbG1lbnRMaW5lOjMy",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ1",
|
|
|
|
isShippingRequired: false,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6MzE3",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2020-12-01 13:13:05 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "Lake Tunes",
|
|
|
|
productSku: "lake-tunes-mp3",
|
|
|
|
quantity: 2,
|
|
|
|
quantityFulfilled: 2,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 0,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 9.99,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "RnVsZmlsbG1lbnRMaW5lOjMz",
|
|
|
|
quantity: 1,
|
|
|
|
orderLine: {
|
|
|
|
id: "T3JkZXJMaW5lOjQ3",
|
|
|
|
isShippingRequired: true,
|
|
|
|
variant: {
|
|
|
|
id: "UHJvZHVjdFZhcmlhbnQ6Mjg2",
|
|
|
|
quantityAvailable: 50,
|
2021-10-01 12:41:31 +00:00
|
|
|
preorder: null,
|
2020-12-01 13:13:05 +00:00
|
|
|
__typename: "ProductVariant"
|
|
|
|
},
|
|
|
|
productName: "T-shirt",
|
|
|
|
productSku: "29810068",
|
|
|
|
quantity: 3,
|
|
|
|
quantityFulfilled: 1,
|
2021-08-20 14:36:05 +00:00
|
|
|
quantityToFulfill: 2,
|
Saleor 1856/implement discount modal 2 (#978)
* Add currency to orderline unitprice and update hella lots of types
* wip
* Add diiscount modal component
* Refactor action dialog - move buttons to separate component so they can be reused
* Add discount provider to keep logic of discounts separated and wrap proper components
* Add discount ccalculator util class, and make draft details summary use it, along with discounts data, modal etc
* UUpdate lots of types, fragments, schema etc
* Update quries and mutations
* ARename OrderLineDiscountModal -> OrderDiscountCommonModal, add types etc
* Add order line discount provider + consumer, same for order discount
* Fix ts wip
* Update schema and types
* Update order discount provider
* Add nnetto price to order details fragment and update lots of types
* Adjust fixtures to order details containing net total
* Move both order and order line provider to same dir to make types and utils more accessible
* Update schema to match master
* Update schema and types
* Update order history, add some related components, add events etc.
* Fix types
* Fix schema to match master
* Update messages
* Update changelog
* Retrigger build
* Add stories and update common modal to display floats properly
* Add and update stories and tests
* Add optional displaying of reason in case it's empty
* Make user name label for history events return email if last name and first name are absent
* Update schema, types, and mutations to properly refresh
* Remove unnecessary imports
* Add discounts decorator to draft details page storybook
* Fixs after review
* Update messages
* Small fixes to timeline events
* Update types for order shipping price to use net as well, fix labels in draft summary and add colors to theme palette
* Updaste tests, messages
* Fixs after review
* Add theme highlighted active and inactive color text, add valuue conversion to discount modal when changing calculation mode
* Add change to changelog
* Add extra options to select employee display name for order event when some data is missing. Also add filtering null elements in event header when data missing alltogether and element is null
* Refactor selecting employee name in utils
* Add conditional to extended timeline event when orderline is null
2021-03-05 14:52:02 +00:00
|
|
|
undiscountedUnitPrice: {
|
|
|
|
__typename: "TaxedMoney",
|
|
|
|
currency: "USD",
|
|
|
|
gross: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
unitDiscount: {
|
|
|
|
__typename: "Money",
|
|
|
|
amount: 79.71,
|
|
|
|
currency: "USD"
|
|
|
|
},
|
|
|
|
unitDiscountReason: null,
|
|
|
|
unitDiscountType: null,
|
|
|
|
unitDiscountValue: 0,
|
2020-12-01 13:13:05 +00:00
|
|
|
unitPrice: {
|
|
|
|
gross: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
net: {
|
|
|
|
amount: 2.5,
|
|
|
|
currency: "USD",
|
|
|
|
__typename: "Money"
|
|
|
|
},
|
|
|
|
__typename: "TaxedMoney"
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
url:
|
|
|
|
"http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png",
|
|
|
|
__typename: "Image"
|
|
|
|
},
|
|
|
|
__typename: "OrderLine"
|
|
|
|
},
|
|
|
|
__typename: "FulfillmentLine"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const mergedLines = mergeRepeatedOrderLines(lines);
|
|
|
|
|
|
|
|
expect(mergedLines).toHaveLength(2);
|
|
|
|
expect(
|
|
|
|
mergedLines.find(
|
|
|
|
fulfillmentLine => fulfillmentLine.orderLine.id === "T3JkZXJMaW5lOjQ1"
|
|
|
|
).quantity
|
|
|
|
).toBe(2);
|
|
|
|
});
|
|
|
|
});
|