Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Download invoice for order #790

Merged
merged 11 commits into from
Jul 8, 2020
Merged

Download invoice for order #790

merged 11 commits into from
Jul 8, 2020

Conversation

orzechdev
Copy link
Contributor

@orzechdev orzechdev commented Jun 30, 2020

I want to merge this change because it adds the possibility to download invoice from the popup menu in the order details view for logged in user.

PR intended to be tested with API branch:
saleor/saleor#5732

PR intended to be tested with SDK branch:
saleor/saleor-sdk#13

Screenshots

Zrzut ekranu 2020-07-1 o 12 01 17

Pull Request Checklist

  1. All visible strings are translated with proper context.
  2. All data-formatting is locale-aware (dates, numbers, and so on).
  3. The changes are tested.
  4. The code is documented (docstrings, project documentation).
  5. Changes are mentioned in the changelog.

@lgtm-com

This comment has been minimized.

@lgtm-com

This comment has been minimized.

@orzechdev orzechdev marked this pull request as ready for review July 1, 2020 11:20
@orzechdev
Copy link
Contributor Author

@orzechdev orzechdev requested a review from AlicjaSzu July 2, 2020 11:06
{order.paymentStatusDisplay} / {order.statusDisplay}
</p>
</div>
{"invoices" in order && order.invoices?.length && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{"invoices" in order && order.invoices?.length && (
{order?.invoices?.length > 0 && (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing "invoices" in order causes error Zrzut ekranu 2020-07-3 o 10 22 55

@@ -17,13 +17,29 @@ const View: React.FC<RouteComponentProps<{ token?: string }>> = ({
const { data: user } = useUserDetails();
const guest = !user;

const handleDownloadInvoice = () => {
if (order && "invoices" in order && order.invoices?.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (order && "invoices" in order && order.invoices?.length) {
if (order?.invoices?.length > 0) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

src/userAccount/views/OrderDetails/View.tsx Show resolved Hide resolved
@@ -1,6 +1,6 @@
import * as H from "history";

export interface IProps {
orders: any[];
orders?: any[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's temporary fix for crash when no order exists for a user, together with changes in src/@next/pages/OrdersHistory/OrdersHistory.tsx. We should create no order information view in the future if the appropriate design will exist.

@orzechdev orzechdev merged commit d02b4f6 into master Jul 8, 2020
@orzechdev orzechdev deleted the feature/invoices branch July 8, 2020 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants