Skip to content

Conversation

@barryhughes
Copy link
Member

@barryhughes barryhughes commented Sep 2, 2022

Within Automattic\WooCommerce\Internal\Orders\CouponsController we reference the Exception type, but it is not fully qualified and there is no matching import statement. So, it is consequently expanded to:

Automattic\WooCommerce\Internal\Orders\Exception

That doesn't actually exist, so we likely intended to use a generic Exception. This change resolves that issue.

STEPS TO REPLICATE

  1. Manually create or edit an order.
  2. Try to apply a non-existent coupon code.
  3. You should see an error informing you the coupon code does not exist:

discount-does-not-exist

  1. Whereas, with current trunk code checked out, you will experience:
    • The above message will not appear: you will just see a spinner icon that keeps spinning indefinitely.
    • If you monitor the dev console, you will see the corresponding ajax request resulted in a 500 Internal Server Error.
    • In your error log, you may see an entry looking something like Uncaught Error: Class "Automattic\WooCommerce\Internal\Orders\Exception" not found in /.../src/Internal/Orders/CouponsController.php:80

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@barryhughes barryhughes requested review from a team and Konamiman and removed request for a team September 2, 2022 19:10
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Sep 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2022

Test Results Summary

Commit SHA: c3c1827

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests11800201200m 58s
E2E Tests186001018714m 45s
To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Konamiman
Konamiman previously approved these changes Sep 9, 2022
@barryhughes
Copy link
Member Author

Rebasing as it may clear the issue with the 'Lint and Test JS' check.

@barryhughes barryhughes force-pushed the spotfix/coupons-controller branch from 892aaa5 to c3c1827 Compare September 9, 2022 19:35
@barryhughes barryhughes merged commit 03b9032 into trunk Sep 9, 2022
@barryhughes barryhughes deleted the spotfix/coupons-controller branch September 9, 2022 21:24
@github-actions github-actions bot added this to the 7.0.0 milestone Sep 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2022

Hi @barryhughes, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants