|
|
@@ -34,15 +34,19 @@ import {
|
|
|
SettlePayment,
|
|
|
SettleRefund,
|
|
|
StockMovementType,
|
|
|
+ TransitFulfillment,
|
|
|
UpdateOrderNote,
|
|
|
UpdateProductVariants,
|
|
|
} from './graphql/generated-e2e-admin-types';
|
|
|
import { AddItemToOrder, DeletionResult, GetActiveOrder } from './graphql/generated-e2e-shop-types';
|
|
|
import {
|
|
|
+ CREATE_FULFILLMENT,
|
|
|
GET_CUSTOMER_LIST,
|
|
|
GET_ORDER,
|
|
|
+ GET_ORDER_FULFILLMENTS,
|
|
|
GET_PRODUCT_WITH_VARIANTS,
|
|
|
GET_STOCK_MOVEMENT,
|
|
|
+ TRANSIT_FULFILLMENT,
|
|
|
UPDATE_PRODUCT_VARIANTS,
|
|
|
} from './graphql/shared-definitions';
|
|
|
import { ADD_ITEM_TO_ORDER, GET_ACTIVE_ORDER } from './graphql/shop-definitions';
|
|
|
@@ -107,7 +111,7 @@ describe('Orders resolver', () => {
|
|
|
|
|
|
it('orders', async () => {
|
|
|
const result = await adminClient.query<GetOrderList.Query>(GET_ORDERS_LIST);
|
|
|
- expect(result.orders.items.map((o) => o.id)).toEqual(['T_1', 'T_2']);
|
|
|
+ expect(result.orders.items.map(o => o.id)).toEqual(['T_1', 'T_2']);
|
|
|
});
|
|
|
|
|
|
it('order', async () => {
|
|
|
@@ -248,7 +252,7 @@ describe('Orders resolver', () => {
|
|
|
CREATE_FULFILLMENT,
|
|
|
{
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
method: 'Test',
|
|
|
},
|
|
|
},
|
|
|
@@ -286,7 +290,7 @@ describe('Orders resolver', () => {
|
|
|
CREATE_FULFILLMENT,
|
|
|
{
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
method: 'Test',
|
|
|
},
|
|
|
},
|
|
|
@@ -294,7 +298,7 @@ describe('Orders resolver', () => {
|
|
|
}, 'Nothing to fulfill'),
|
|
|
);
|
|
|
|
|
|
- it('creates a partial fulfillment', async () => {
|
|
|
+ it('creates the first fulfillment', async () => {
|
|
|
const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
@@ -306,58 +310,60 @@ describe('Orders resolver', () => {
|
|
|
CreateFulfillment.Variables
|
|
|
>(CREATE_FULFILLMENT, {
|
|
|
input: {
|
|
|
- lines: lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: [{ orderLineId: lines[0].id, quantity: lines[0].quantity }],
|
|
|
method: 'Test1',
|
|
|
trackingCode: '111',
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ expect(fulfillOrder!.id).toBe('T_1');
|
|
|
expect(fulfillOrder!.method).toBe('Test1');
|
|
|
expect(fulfillOrder!.trackingCode).toBe('111');
|
|
|
- expect(fulfillOrder!.orderItems).toEqual([
|
|
|
- { id: lines[0].items[0].id },
|
|
|
- { id: lines[1].items[0].id },
|
|
|
- ]);
|
|
|
+ expect(fulfillOrder!.state).toBe('Pending');
|
|
|
+ expect(fulfillOrder!.orderItems).toEqual([{ id: lines[0].items[0].id }]);
|
|
|
|
|
|
const result = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
|
|
|
- expect(result.order!.state).toBe('PartiallyFulfilled');
|
|
|
-
|
|
|
expect(result.order!.lines[0].items[0].fulfillment!.id).toBe(fulfillOrder!.id);
|
|
|
expect(
|
|
|
result.order!.lines[1].items.filter(
|
|
|
- (i) => i.fulfillment && i.fulfillment.id === fulfillOrder.id,
|
|
|
+ i => i.fulfillment && i.fulfillment.id === fulfillOrder.id,
|
|
|
).length,
|
|
|
- ).toBe(1);
|
|
|
- expect(result.order!.lines[1].items.filter((i) => i.fulfillment == null).length).toBe(2);
|
|
|
+ ).toBe(0);
|
|
|
+ expect(result.order!.lines[1].items.filter(i => i.fulfillment == null).length).toBe(3);
|
|
|
});
|
|
|
|
|
|
- it('creates a second partial fulfillment', async () => {
|
|
|
+ it('creates the second fulfillment', async () => {
|
|
|
const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
- expect(order!.state).toBe('PartiallyFulfilled');
|
|
|
- const lines = order!.lines;
|
|
|
+
|
|
|
+ const unfulfilledItems =
|
|
|
+ order?.lines.filter(l => {
|
|
|
+ const items = l.items.filter(i => i.fulfillment === null);
|
|
|
+ return items.length > 0 ? true : false;
|
|
|
+ }) || [];
|
|
|
|
|
|
const { fulfillOrder } = await adminClient.query<
|
|
|
CreateFulfillment.Mutation,
|
|
|
CreateFulfillment.Variables
|
|
|
>(CREATE_FULFILLMENT, {
|
|
|
input: {
|
|
|
- lines: [{ orderLineId: lines[1].id, quantity: 1 }],
|
|
|
+ lines: unfulfilledItems.map(l => ({
|
|
|
+ orderLineId: l.id,
|
|
|
+ quantity: l.items.length,
|
|
|
+ })),
|
|
|
method: 'Test2',
|
|
|
trackingCode: '222',
|
|
|
},
|
|
|
});
|
|
|
|
|
|
- const result = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
- id: 'T_2',
|
|
|
- });
|
|
|
- expect(result.order!.state).toBe('PartiallyFulfilled');
|
|
|
- expect(result.order!.lines[1].items.filter((i) => i.fulfillment != null).length).toBe(2);
|
|
|
- expect(result.order!.lines[1].items.filter((i) => i.fulfillment == null).length).toBe(1);
|
|
|
+ expect(fulfillOrder!.id).toBe('T_2');
|
|
|
+ expect(fulfillOrder!.method).toBe('Test2');
|
|
|
+ expect(fulfillOrder!.trackingCode).toBe('222');
|
|
|
+ expect(fulfillOrder!.state).toBe('Pending');
|
|
|
});
|
|
|
|
|
|
it(
|
|
|
@@ -366,7 +372,6 @@ describe('Orders resolver', () => {
|
|
|
const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
- expect(order!.state).toBe('PartiallyFulfilled');
|
|
|
await adminClient.query<CreateFulfillment.Mutation, CreateFulfillment.Variables>(
|
|
|
CREATE_FULFILLMENT,
|
|
|
{
|
|
|
@@ -383,43 +388,69 @@ describe('Orders resolver', () => {
|
|
|
);
|
|
|
}, 'One or more OrderItems have already been fulfilled'),
|
|
|
);
|
|
|
+ it('transits the first fulfillment from created to Shipped and automatically change the order state to PartiallyShipped', async () => {
|
|
|
+ const fulfillment = await adminClient.query<
|
|
|
+ TransitFulfillment.Mutation,
|
|
|
+ TransitFulfillment.Variables
|
|
|
+ >(TRANSIT_FULFILLMENT, {
|
|
|
+ id: 'T_1',
|
|
|
+ state: 'Shipped',
|
|
|
+ });
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.id).toBe('T_1');
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.state).toBe('Shipped');
|
|
|
|
|
|
- it('completes fulfillment', async () => {
|
|
|
const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
- expect(order!.state).toBe('PartiallyFulfilled');
|
|
|
-
|
|
|
- const orderItems = order!.lines.reduce(
|
|
|
- (items, line) => [...items, ...line.items],
|
|
|
- [] as OrderItemFragment[],
|
|
|
- );
|
|
|
- const unfulfilledItem = order!.lines[1].items.find((i) => i.fulfillment == null)!;
|
|
|
+ expect(order?.state).toBe('PartiallyShipped');
|
|
|
+ });
|
|
|
+ it('transits the second fulfillment from created to Shipped and automatically change the order state to Shipped', async () => {
|
|
|
+ const fulfillment = await adminClient.query<
|
|
|
+ TransitFulfillment.Mutation,
|
|
|
+ TransitFulfillment.Variables
|
|
|
+ >(TRANSIT_FULFILLMENT, {
|
|
|
+ id: 'T_2',
|
|
|
+ state: 'Shipped',
|
|
|
+ });
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.id).toBe('T_2');
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.state).toBe('Shipped');
|
|
|
|
|
|
- const { fulfillOrder } = await adminClient.query<
|
|
|
- CreateFulfillment.Mutation,
|
|
|
- CreateFulfillment.Variables
|
|
|
- >(CREATE_FULFILLMENT, {
|
|
|
- input: {
|
|
|
- lines: [
|
|
|
- {
|
|
|
- orderLineId: order!.lines[1].id,
|
|
|
- quantity: 1,
|
|
|
- },
|
|
|
- ],
|
|
|
- method: 'Test3',
|
|
|
- trackingCode: '333',
|
|
|
- },
|
|
|
+ const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
+ id: 'T_2',
|
|
|
});
|
|
|
+ expect(order?.state).toBe('Shipped');
|
|
|
+ });
|
|
|
+ it('transits the first fulfillment from Shipped to Delivered and change the order state to PartiallyDelivered', async () => {
|
|
|
+ const fulfillment = await adminClient.query<
|
|
|
+ TransitFulfillment.Mutation,
|
|
|
+ TransitFulfillment.Variables
|
|
|
+ >(TRANSIT_FULFILLMENT, {
|
|
|
+ id: 'T_1',
|
|
|
+ state: 'Delivered',
|
|
|
+ });
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.id).toBe('T_1');
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.state).toBe('Delivered');
|
|
|
|
|
|
- expect(fulfillOrder!.method).toBe('Test3');
|
|
|
- expect(fulfillOrder!.trackingCode).toBe('333');
|
|
|
- expect(fulfillOrder!.orderItems).toEqual([{ id: unfulfilledItem.id }]);
|
|
|
+ const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
+ id: 'T_2',
|
|
|
+ });
|
|
|
+ expect(order?.state).toBe('PartiallyDelivered');
|
|
|
+ });
|
|
|
+ it('transits the second fulfillment from Shipped to Delivered and change the order state to Delivered', async () => {
|
|
|
+ const fulfillment = await adminClient.query<
|
|
|
+ TransitFulfillment.Mutation,
|
|
|
+ TransitFulfillment.Variables
|
|
|
+ >(TRANSIT_FULFILLMENT, {
|
|
|
+ id: 'T_2',
|
|
|
+ state: 'Delivered',
|
|
|
+ });
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.id).toBe('T_2');
|
|
|
+ expect(fulfillment.transitionFulfillmentToState?.state).toBe('Delivered');
|
|
|
|
|
|
- const result = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
+ const { order } = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
- expect(result.order!.state).toBe('Fulfilled');
|
|
|
+ expect(order?.state).toBe('Delivered');
|
|
|
});
|
|
|
|
|
|
it('order history contains expected entries', async () => {
|
|
|
@@ -434,49 +465,81 @@ describe('Orders resolver', () => {
|
|
|
);
|
|
|
expect(order!.history.items.map(pick(['type', 'data']))).toEqual([
|
|
|
{
|
|
|
- type: HistoryEntryType.ORDER_FULLFILLMENT,
|
|
|
data: {
|
|
|
fulfillmentId: 'T_1',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ fulfillmentId: 'T_2',
|
|
|
+ },
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ from: 'Pending',
|
|
|
+ fulfillmentId: 'T_1',
|
|
|
+ to: 'Shipped',
|
|
|
+ },
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION,
|
|
|
},
|
|
|
{
|
|
|
- type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
data: {
|
|
|
from: 'PaymentSettled',
|
|
|
- to: 'PartiallyFulfilled',
|
|
|
+ to: 'PartiallyShipped',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
- type: HistoryEntryType.ORDER_FULLFILLMENT,
|
|
|
data: {
|
|
|
+ from: 'Pending',
|
|
|
fulfillmentId: 'T_2',
|
|
|
+ to: 'Shipped',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION,
|
|
|
},
|
|
|
{
|
|
|
- type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
data: {
|
|
|
- from: 'PartiallyFulfilled',
|
|
|
- to: 'PartiallyFulfilled',
|
|
|
+ from: 'PartiallyShipped',
|
|
|
+ to: 'Shipped',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
},
|
|
|
{
|
|
|
- type: HistoryEntryType.ORDER_FULLFILLMENT,
|
|
|
data: {
|
|
|
- fulfillmentId: 'T_3',
|
|
|
+ from: 'Shipped',
|
|
|
+ fulfillmentId: 'T_1',
|
|
|
+ to: 'Delivered',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION,
|
|
|
},
|
|
|
{
|
|
|
+ data: {
|
|
|
+ from: 'Shipped',
|
|
|
+ to: 'PartiallyDelivered',
|
|
|
+ },
|
|
|
type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ from: 'Shipped',
|
|
|
+ fulfillmentId: 'T_2',
|
|
|
+ to: 'Delivered',
|
|
|
+ },
|
|
|
+ type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION,
|
|
|
+ },
|
|
|
+ {
|
|
|
data: {
|
|
|
- from: 'PartiallyFulfilled',
|
|
|
- to: 'Fulfilled',
|
|
|
+ from: 'PartiallyDelivered',
|
|
|
+ to: 'Delivered',
|
|
|
},
|
|
|
+ type: HistoryEntryType.ORDER_STATE_TRANSITION,
|
|
|
},
|
|
|
]);
|
|
|
});
|
|
|
|
|
|
- it('order.fullfillments resolver for single order', async () => {
|
|
|
+ it('order.fulfillments resolver for single order', async () => {
|
|
|
const { order } = await adminClient.query<
|
|
|
GetOrderFulfillments.Query,
|
|
|
GetOrderFulfillments.Variables
|
|
|
@@ -485,26 +548,24 @@ describe('Orders resolver', () => {
|
|
|
});
|
|
|
|
|
|
expect(order!.fulfillments).toEqual([
|
|
|
- { id: 'T_1', method: 'Test1' },
|
|
|
- { id: 'T_2', method: 'Test2' },
|
|
|
- { id: 'T_3', method: 'Test3' },
|
|
|
+ { id: 'T_1', method: 'Test1', state: 'Delivered', nextStates: ['Cancelled'] },
|
|
|
+ { id: 'T_2', method: 'Test2', state: 'Delivered', nextStates: ['Cancelled'] },
|
|
|
]);
|
|
|
});
|
|
|
|
|
|
- it('order.fullfillments resolver for order list', async () => {
|
|
|
+ it('order.fulfillments resolver for order list', async () => {
|
|
|
const { orders } = await adminClient.query<GetOrderListFulfillments.Query>(
|
|
|
GET_ORDER_LIST_FULFILLMENTS,
|
|
|
);
|
|
|
|
|
|
expect(orders.items[0].fulfillments).toEqual([]);
|
|
|
expect(orders.items[1].fulfillments).toEqual([
|
|
|
- { id: 'T_1', method: 'Test1' },
|
|
|
- { id: 'T_2', method: 'Test2' },
|
|
|
- { id: 'T_3', method: 'Test3' },
|
|
|
+ { id: 'T_1', method: 'Test1', state: 'Delivered', nextStates: ['Cancelled'] },
|
|
|
+ { id: 'T_2', method: 'Test2', state: 'Delivered', nextStates: ['Cancelled'] },
|
|
|
]);
|
|
|
});
|
|
|
|
|
|
- it('order.fullfillments.orderItems resolver', async () => {
|
|
|
+ it('order.fulfillments.orderItems resolver', async () => {
|
|
|
const { order } = await adminClient.query<
|
|
|
GetOrderFulfillmentItems.Query,
|
|
|
GetOrderFulfillmentItems.Variables
|
|
|
@@ -512,8 +573,8 @@ describe('Orders resolver', () => {
|
|
|
id: 'T_2',
|
|
|
});
|
|
|
|
|
|
- expect(order!.fulfillments![0].orderItems).toEqual([{ id: 'T_3' }, { id: 'T_4' }]);
|
|
|
- expect(order!.fulfillments![1].orderItems).toEqual([{ id: 'T_5' }]);
|
|
|
+ expect(order!.fulfillments![0].orderItems).toEqual([{ id: 'T_3' }]);
|
|
|
+ expect(order!.fulfillments![1].orderItems).toEqual([{ id: 'T_4' }, { id: 'T_5' }, { id: 'T_6' }]);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
@@ -605,7 +666,7 @@ describe('Orders resolver', () => {
|
|
|
},
|
|
|
},
|
|
|
);
|
|
|
- expect(cancelOrder.lines.map((l) => l.items.map(pick(['id', 'cancelled'])))).toEqual([
|
|
|
+ expect(cancelOrder.lines.map(l => l.items.map(pick(['id', 'cancelled'])))).toEqual([
|
|
|
[
|
|
|
{ id: 'T_11', cancelled: true },
|
|
|
{ id: 'T_12', cancelled: true },
|
|
|
@@ -675,7 +736,7 @@ describe('Orders resolver', () => {
|
|
|
await adminClient.query<CancelOrder.Mutation, CancelOrder.Variables>(CANCEL_ORDER, {
|
|
|
input: {
|
|
|
orderId,
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
},
|
|
|
});
|
|
|
}, 'Cannot cancel OrderLines from an Order in the "AddingItems" state'),
|
|
|
@@ -692,7 +753,7 @@ describe('Orders resolver', () => {
|
|
|
await adminClient.query<CancelOrder.Mutation, CancelOrder.Variables>(CANCEL_ORDER, {
|
|
|
input: {
|
|
|
orderId,
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
},
|
|
|
});
|
|
|
}, 'Cannot cancel OrderLines from an Order in the "ArrangingPayment" state'),
|
|
|
@@ -722,7 +783,7 @@ describe('Orders resolver', () => {
|
|
|
await adminClient.query<CancelOrder.Mutation, CancelOrder.Variables>(CANCEL_ORDER, {
|
|
|
input: {
|
|
|
orderId,
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
},
|
|
|
});
|
|
|
}, 'Nothing to cancel'),
|
|
|
@@ -754,7 +815,7 @@ describe('Orders resolver', () => {
|
|
|
{
|
|
|
input: {
|
|
|
orderId,
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
reason: 'cancel reason 1',
|
|
|
},
|
|
|
},
|
|
|
@@ -798,7 +859,7 @@ describe('Orders resolver', () => {
|
|
|
await adminClient.query<CancelOrder.Mutation, CancelOrder.Variables>(CANCEL_ORDER, {
|
|
|
input: {
|
|
|
orderId,
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
reason: 'cancel reason 2',
|
|
|
},
|
|
|
});
|
|
|
@@ -914,7 +975,7 @@ describe('Orders resolver', () => {
|
|
|
|
|
|
await adminClient.query<RefundOrder.Mutation, RefundOrder.Variables>(REFUND_ORDER, {
|
|
|
input: {
|
|
|
- lines: order.lines.map((l) => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
+ lines: order.lines.map(l => ({ orderLineId: l.id, quantity: 1 })),
|
|
|
shipping: 0,
|
|
|
adjustment: 0,
|
|
|
paymentId,
|
|
|
@@ -940,7 +1001,7 @@ describe('Orders resolver', () => {
|
|
|
|
|
|
await adminClient.query<RefundOrder.Mutation, RefundOrder.Variables>(REFUND_ORDER, {
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })),
|
|
|
shipping: 0,
|
|
|
adjustment: 0,
|
|
|
paymentId,
|
|
|
@@ -979,7 +1040,7 @@ describe('Orders resolver', () => {
|
|
|
REFUND_ORDER,
|
|
|
{
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
shipping: 100,
|
|
|
adjustment: 0,
|
|
|
paymentId: 'T_1',
|
|
|
@@ -997,7 +1058,7 @@ describe('Orders resolver', () => {
|
|
|
REFUND_ORDER,
|
|
|
{
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
shipping: order!.shipping,
|
|
|
adjustment: 0,
|
|
|
reason: 'foo',
|
|
|
@@ -1024,7 +1085,7 @@ describe('Orders resolver', () => {
|
|
|
REFUND_ORDER,
|
|
|
{
|
|
|
input: {
|
|
|
- lines: order!.lines.map((l) => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
+ lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })),
|
|
|
shipping: order!.shipping,
|
|
|
adjustment: 0,
|
|
|
paymentId,
|
|
|
@@ -1318,38 +1379,16 @@ export const SETTLE_PAYMENT = gql`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
-export const CREATE_FULFILLMENT = gql`
|
|
|
- mutation CreateFulfillment($input: FulfillOrderInput!) {
|
|
|
- fulfillOrder(input: $input) {
|
|
|
- id
|
|
|
- method
|
|
|
- trackingCode
|
|
|
- orderItems {
|
|
|
- id
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-`;
|
|
|
-
|
|
|
-export const GET_ORDER_FULFILLMENTS = gql`
|
|
|
- query GetOrderFulfillments($id: ID!) {
|
|
|
- order(id: $id) {
|
|
|
- id
|
|
|
- fulfillments {
|
|
|
- id
|
|
|
- method
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-`;
|
|
|
-
|
|
|
export const GET_ORDER_LIST_FULFILLMENTS = gql`
|
|
|
query GetOrderListFulfillments {
|
|
|
orders {
|
|
|
items {
|
|
|
id
|
|
|
+ state
|
|
|
fulfillments {
|
|
|
id
|
|
|
+ state
|
|
|
+ nextStates
|
|
|
method
|
|
|
}
|
|
|
}
|
|
|
@@ -1361,8 +1400,10 @@ export const GET_ORDER_FULFILLMENT_ITEMS = gql`
|
|
|
query GetOrderFulfillmentItems($id: ID!) {
|
|
|
order(id: $id) {
|
|
|
id
|
|
|
+ state
|
|
|
fulfillments {
|
|
|
id
|
|
|
+ state
|
|
|
orderItems {
|
|
|
id
|
|
|
}
|