The query selector was pulling the first svg from the document. There were more than one svg element in the document and the intended svg was not the first one. This resulted in selecting a svg element which had no content. So, the download button downloaded a file with no content.
A second parameter id is added the load_qr_svg_to_DOM method to optionally add the id into the svg element. The default value will be null for id. This will help to query the specific element. The query selector is changed in the JS to target the specific svg element.
3. Quality assurance
Add an item to the card
Go to checkout page
Select PromptPay as the payment method
Place order
Click on Download QR
You should see a PNG file in your local machine. You should see a QR code opening the file.
🔧 Environments:
Specify the details of your test environments, including, for each, the platform version (on which the plugin was run), the Omise plugin version, and the versions of your system software such as PHP or Ruby.
1. Objective
Fix the issue of PromptPay QR code download button downloading an empty file.
Jira Ticket: https://omise.atlassian.net/browse/FRON-1433
2. Description of change
The query selector was pulling the first
svg
from the document. There were more than onesvg
element in the document and the intendedsvg
was not the first one. This resulted in selecting asvg
element which had no content. So, the download button downloaded a file with no content.A second parameter
id
is added theload_qr_svg_to_DOM
method to optionally add the id into thesvg
element. The default value will be null forid
. This will help to query the specific element. The query selector is changed in the JS to target the specific svg element.3. Quality assurance
You should see a PNG file in your local machine. You should see a QR code opening the file.
🔧 Environments:
Specify the details of your test environments, including, for each, the platform version (on which the plugin was run), the Omise plugin version, and the versions of your system software such as PHP or Ruby.
WooCommerce: v6.4.1 WordPress: v5.9.3 PHP version: 7.4.28 Omise plugin version: Omise-WooCommerce 4.19.2