Skip to content

Fix the issue where the certificate cannot be downloaded when the order status is "processing".

This pull request addresses an issue where, after completing an order, the status might be marked as "processing". In this state, the "Finalizing order" interface cannot be called again, resulting in a 403 status code and preventing the certificate from being downloaded.

Problem

This pull request addresses an issue where, after completing an order, the status might be marked as "processing". In this state, the "Finalizing order" interface cannot be called again, resulting in a 403 status code and preventing the certificate from being downloaded.

Solution

To resolve this issue, the script has been modified to:

  1. Check for non-empty CERTIFICATE_URL: Instead of waiting for the status to change to "valid", the script now checks if the CERTIFICATE_URL is not empty. If the CERTIFICATE_URL is available, the script breaks out of the loop and proceeds to download the certificate.
  2. Use getorder API: To ensure that the latest status and certificate URL are retrieved, the getorder API endpoint is used to fetch the updated information.

Changes Made

  1. Loop logic modification: The loop now checks if the CERTIFICATE_URL is not empty instead of checking for a specific status.
  2. Error handling: After the loop, an error message is displayed if the CERTIFICATE_URL remains empty, indicating that the certificate is still not available.
  3. API call update: The getorder API endpoint is called to ensure that the most up-to-date status and certificate URL are retrieved.

Steps to Reproduce

  1. Create a new order: Trigger the creation of a new order through the script.
  2. Observe the status: Observe the status returned by the API after the order is marked as "valid".
  3. Run the modified script: Execute the modified script to observe the behavior.
  4. Verify certificate retrieval: Ensure that the script successfully retrieves the certificate once the CERTIFICATE_URL is available, even if the order status is "processing".

Testing

  • Manual testing: I manually tested the modified script by creating orders and observing the behavior.
  • Automated testing: Automated tests may be required to ensure the robustness of the change.

Conclusion

This fix ensures that the script can reliably retrieve the certificate as soon as it is available, regardless of the order status being "processing" or "valid". It improves the reliability and efficiency of the script when dealing with completed orders.

Merge request reports

Loading