omise / omise-woocommerce

Omise WooCommerce Plugin
https://docs.opn.ooo/woocommerce-plugin
MIT License
47 stars 27 forks source link

[FRON-1433]: Issue of PromptPay QR code download button not downloadi… #264

Closed aashishgurung closed 2 years ago

aashishgurung commented 2 years ago

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 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

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

tanawin-opn commented 2 years ago

test and approved krub.