Skip to content

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

Update stories

dominik-zeglen3498d3b1f021
diff --git a/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx b/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
index 9aec26130d..14bd600863 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPayment/OrderPayment.tsx
@@ -145,33 +145,38 @@ const OrderPayment = decorate<OrderPaymentProps>(
</tbody>
</table>
</CardContent>
- {(canCapture || canRefund || canRelease || canMarkAsPaid) && (
- <>
- <Hr />
- <CardActions>
- {canCapture && (
- <Button color="secondary" variant="flat" onClick={onCapture}>
- {i18n.t("Capture", { context: "button" })}
- </Button>
- )}
- {canRefund && (
- <Button color="secondary" variant="flat" onClick={onRefund}>
- {i18n.t("Refund", { context: "button" })}
- </Button>
- )}
- {canRelease && (
- <Button color="secondary" variant="flat" onClick={onRelease}>
- {i18n.t("Release", { context: "button" })}
- </Button>
- )}
- {canMarkAsPaid && (
- <Button color="secondary" variant="flat" onClick={onMarkAsPaid}>
- {i18n.t("Mark as paid", { context: "button" })}
- </Button>
- )}
- </CardActions>
- </>
- )}
+ {maybe(() => order.status) !== OrderStatus.CANCELED &&
+ (canCapture || canRefund || canRelease || canMarkAsPaid) && (
+ <>
+ <Hr />
+ <CardActions>
+ {canCapture && (
+ <Button color="secondary" variant="flat" onClick={onCapture}>
+ {i18n.t("Capture", { context: "button" })}
+ </Button>
+ )}
+ {canRefund && (
+ <Button color="secondary" variant="flat" onClick={onRefund}>
+ {i18n.t("Refund", { context: "button" })}
+ </Button>
+ )}
+ {canRelease && (
+ <Button color="secondary" variant="flat" onClick={onRelease}>
+ {i18n.t("Release", { context: "button" })}
+ </Button>
+ )}
+ {canMarkAsPaid && (
+ <Button
+ color="secondary"
+ variant="flat"
+ onClick={onMarkAsPaid}
+ >
+ {i18n.t("Mark as paid", { context: "button" })}
+ </Button>
+ )}
+ </CardActions>
+ </>
+ )}
</Card>
);
}
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
index fb6b2ef74a..15355643cc 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
@@ -32,25 +32,95 @@ const props: OrderDetailsPageProps = {
storiesOf("Views / Orders / Order details", module)
.addDecorator(Decorator)
- .add("when loading data", () => (
- <OrderDetailsPage {...props} order={undefined} />
+ .add("default", () => <OrderDetailsPage {...props} />)
+ .add("loading", () => <OrderDetailsPage {...props} order={undefined} />)
+ .add("pending payment", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ paymentStatus: PaymentStatusEnum.PREAUTH
+ }}
+ />
))
- .add("when loaded data", () => <OrderDetailsPage {...props} />)
- .add("as a draft", () => (
+ .add("payment error", () => (
<OrderDetailsPage
{...props}
order={{
...props.order,
- status: OrderStatus.DRAFT
+ paymentStatus: PaymentStatusEnum.ERROR
}}
/>
))
- .add("as a unpaid order", () => (
+ .add("payment confirmed", () => (
<OrderDetailsPage
{...props}
order={{
...props.order,
- paymentStatus: PaymentStatusEnum.PREAUTH
+ paymentStatus: PaymentStatusEnum.CONFIRMED
+ }}
+ />
+ ))
+ .add("no payment", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ paymentStatus: null
+ }}
+ />
+ ))
+ .add("refunded payment", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ paymentStatus: PaymentStatusEnum.REFUNDED
+ }}
+ />
+ ))
+ .add("rejected payment", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ paymentStatus: PaymentStatusEnum.REJECTED
+ }}
+ />
+ ))
+ .add("cancelled", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ status: OrderStatus.CANCELED
+ }}
+ />
+ ))
+ .add("fulfilled", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ status: OrderStatus.FULFILLED
+ }}
+ />
+ ))
+ .add("partially fulfilled", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ status: OrderStatus.PARTIALLY_FULFILLED
+ }}
+ />
+ ))
+ .add("unfulfilled", () => (
+ <OrderDetailsPage
+ {...props}
+ order={{
+ ...props.order,
+ status: OrderStatus.UNFULFILLED
}}
/>
));