Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invoice download for non logged in customer #35530

Merged
merged 2 commits into from Mar 1, 2024

Conversation

Hlavtox
Copy link
Contributor

@Hlavtox Hlavtox commented Feb 29, 2024

Questions Answers
Branch? 8.1.x
Description? You can't download an invoice sometimes, if you are not logged in. This fixes it. Interesting that nobody in the huge community found it in like 13 years. :-)))
Type? bug fix
Category? FO
BC breaks? no
Deprecations? no
How to test? See below.
UI Tests https://github.com/kpodemski/ga.tests.ui.pr/actions/runs/8110500915
Fixed issue or discussion? Fixes #35537
Related PRs
Sponsor company

What's wrong

  • When you want to download an invoice via a standardized link https://www.domain.com/index.php?controller=pdf-invoice&id_order=XXXX&secure_key=XXXX, it doesn't work sometimes.
  • The condition now says this: if there is a customer in context and it doesn't match the order customer OR the secure key doesn't match, die.
  • So now if you have a perfectly legit link with secure_key, but you are logged in as different customer or start a guest checkout, the link won't work.
  • So the fix is easy, die only if both of these fail:
    • If there is a customer in context and it's not the customer of the order.
    • If there isn't a secure key in the link.

How to test

  • Make sure that some guest order exists in a shop and invoice is available for it.
  • Go to FO, make sure you are logged out. Start a checkout as a guest (without password), no need to fill any addresses.
  • Now go to guest tracking and try to track the order and try to download an invoice.
  • You will get white screen and The invoice was not found..
  • Same situation is when you are logged in in FO as a different customer and you have the link to the invoice in the mail for example.

@Hlavtox Hlavtox added this to the 8.1.6 milestone Feb 29, 2024
@Hlavtox Hlavtox requested a review from a team as a code owner February 29, 2024 22:10
@prestonBot prestonBot added 8.1.x Branch Bug fix Type: Bug fix labels Feb 29, 2024
@PrestaShop PrestaShop deleted a comment from prestonBot Feb 29, 2024
@ps-jarvis ps-jarvis added the Waiting for QA Status: action required, waiting for test feedback label Mar 1, 2024
@Hlavtox Hlavtox linked an issue Mar 1, 2024 that may be closed by this pull request
2 tasks
@florine2623
Copy link
Contributor

Oh nice, I will test it then !

@florine2623 florine2623 self-assigned this Mar 1, 2024
Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

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

Hello @Hlavtox ,

Tested with/without address in Step 2.
Tested with more than 2 different guest accounts.
Tested at all stages of checkout process.

In Guest Tracking page, updated order status, the page is well updated, the link to download PDF invoice, is displayed and does not show any error.

LGTM ✅

@florine2623 florine2623 added QA ✔️ Status: check done, code approved and removed Waiting for QA Status: action required, waiting for test feedback labels Mar 1, 2024
@Hlavtox Hlavtox merged commit debcf49 into PrestaShop:8.1.x Mar 1, 2024
38 checks passed
@Hlavtox
Copy link
Contributor Author

Hlavtox commented Mar 1, 2024

Thank you @florine2623! :-)

@Hlavtox Hlavtox modified the milestones: 8.1.6, 8.1.5 Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.1.x Branch Bug fix Type: Bug fix QA ✔️ Status: check done, code approved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Impossible to download PDF invoice for guest order
6 participants