Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 211 forks source link

[ECP-9113] Skip child items while building the line items array for credit memo #2577

Closed candemiralp closed 6 months ago

candemiralp commented 6 months ago

Description

Magento CreditmemoItem returns child items for the products which have variants. However, this child variant item doesn't have line item related information (price, row_total etc.). getPrice() returns 0 for this item and causes zero division exception.

This PR filters out the child items from credit memo line items and sends only parent items. Also, an extra check has been implemented to prevent possible zero divisions.

Tested scenarios

sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud