Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix stories

dominik-zeglen6d964923efe9
diff --git a/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx b/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
index 8f40086021..de4523968a 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
@@ -39,18 +39,16 @@ const decorate = withStyles(theme => ({
}));
const OrderPayment = decorate<OrderPaymentProps>(
({ classes, order, onCapture, onMarkAsPaid, onRefund, onVoid }) => {
- const canCapture = maybe(() => order.actions)
- ? order.actions.includes(OrderAction.CAPTURE)
- : false;
- const canVoid = maybe(() => order.actions)
- ? order.actions.includes(OrderAction.VOID)
- : false;
- const canRefund = maybe(() => order.actions)
- ? order.actions.includes(OrderAction.REFUND)
- : false;
- const canMarkAsPaid = maybe(() => order.actions)
- ? order.actions.includes(OrderAction.MARK_AS_PAID)
- : false;
+ const canCapture = maybe(() => order.actions, []).includes(
+ OrderAction.CAPTURE
+ );
+ const canVoid = maybe(() => order.actions, []).includes(OrderAction.VOID);
+ const canRefund = maybe(() => order.actions, []).includes(
+ OrderAction.REFUND
+ );
+ const canMarkAsPaid = maybe(() => order.actions, []).includes(
+ OrderAction.MARK_AS_PAID
+ );
const payment = transformPaymentStatus(maybe(() => order.paymentStatus));
return (
<Card>
diff --git a/saleor/static/dashboard-next/orders/fixtures.ts b/saleor/static/dashboard-next/orders/fixtures.ts
index 1f7397bf73..6811d6077e 100644
--- a/saleor/static/dashboard-next/orders/fixtures.ts
+++ b/saleor/static/dashboard-next/orders/fixtures.ts
@@ -1014,6 +1014,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
});
export const draftOrder = (placeholder: string) => ({
__typename: "Order" as "Order",
+ actions: [OrderAction.CAPTURE],
availableShippingMethods: null,
billingAddress: null,
created: "2018-09-20T23:23:39.811428+00:00",