Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BP-3546 Use object as array in \Buckaroo\HyvaCheckout\Block\Totals\Fee::getTotal #22

Closed
Shiriaev opened this issue Apr 24, 2024 · 8 comments · Fixed by #27 or #28
Closed

BP-3546 Use object as array in \Buckaroo\HyvaCheckout\Block\Totals\Fee::getTotal #22

Shiriaev opened this issue Apr 24, 2024 · 8 comments · Fixed by #27 or #28
Assignees
Labels
Bug Bugs, functions that are not working like they should. Priority: Normal This issue has a normal/medium priority. Status: Released A fix is included in a release already.

Comments

@Shiriaev
Copy link

Hello Everyone!

I found error right after installation Hyva_Checkout and this module.

The problem in Use object as array in \Buckaroo\HyvaCheckout\Block\Totals\Fee::getTotal:

isset($totalData['extension_attributes']['buckaroo_fee']) assumed that extension attributes is an array, but in our case extension attributes is an object. From my point of view, this function should be something as follow:

    public function getTotal(): float
    {
        $totalData = $this->getSegment();
        $extensionAttributes = $totalData['extension_attributes'] ?? null;
        if (
            $extensionAttributes &&
            is_scalar($extensionAttributes->getBuckarooFee())
        ) {
            return floatval($extensionAttributes->getBuckarooFee());
        }
        return 0;
    }

Please consider to add such fixes to the module. Thanks!

@Buckaroo-Rene Buckaroo-Rene self-assigned this Apr 25, 2024
@Buckaroo-Rene Buckaroo-Rene added Bug Bugs, functions that are not working like they should. Priority: Normal This issue has a normal/medium priority. labels Apr 25, 2024
@Buckaroo-Rene Buckaroo-Rene changed the title Use object as array in \Buckaroo\HyvaCheckout\Block\Totals\Fee::getTotal BP-3546 Use object as array in \Buckaroo\HyvaCheckout\Block\Totals\Fee::getTotal Apr 25, 2024
@Buckaroo-Rene
Copy link
Contributor

Hi @Shiriaev,

Thanks for mentioning this issue. We'll take a look at it.

Best regards,
René

@Buckaroo-Rene
Copy link
Contributor

@Shiriaev ,

Do you perhaps also have the Magento 2 version and PHP version that you are using?
Thanks alot.

Best regards,
René

@Shiriaev
Copy link
Author

Hello @Buckaroo-Rene !

Magento 2.4.6-p3
PHP 8.2.18

@Tjitse-E
Copy link

Tjitse-E commented May 15, 2024

@Buckaroo-Rene I can confirm this:

Error: Cannot use object of type Magento\Quote\Api\Data\TotalSegmentExtension as array in vendor/buckaroo/magento2-hyva-checkout/Block/Totals/Fee.php:54

Versions:
buckaroo/magento2-hyva-checkout - 1.1.2
hyva-themes/magento2-hyva-checkout - 1.1.17

Crashes out of the box. When that error is fixed, another one appears, which is probably related:

TypeError: Hyva\Checkout\ViewModel\Checkout\PriceSummary\TotalSegments::getTotalSegmentExtensionAttributes(): Return value must be of type array, int returned in vendor/hyva-themes/magento2-hyva-checkout/src/ViewModel/Checkout/PriceSummary/TotalSegments.php:142

Which is caused by the TotalSegmentInterface with the code buckaroo_fee. To replicate this you should have at least one payment method that charges an extra fee.

@mountainit-general
Copy link

@Buckaroo-Rene we can also confirm this. Also the same issue including @Tjitse-E's issue when fixing the first, however we don't have any surcharge added into the module.

PHP 8.2
Magento 2.4.6-p4

@larsmbm
Copy link

larsmbm commented Jun 7, 2024

We can confirm that we have the same issue. Is there any indication of when this will be resolved?

@Buckaroo-Rene Buckaroo-Rene added the Status: In progress We are working on this issue. label Jun 11, 2024
@larsmbm
Copy link

larsmbm commented Jul 23, 2024

Could you please provide an update on this ticket? We're experiencing the same problem and would be grateful for any news.

@Buckaroo-Rene
Copy link
Contributor

@Shiriaev & @larsmbm ,

The fix is now included in version 1.2.0 of our Hyvä Checkout module. Please make sure to also update the main Buckaroo Plugin for Magento 2 to ensure full compatibility.

@Buckaroo-Rene Buckaroo-Rene added Status: Released A fix is included in a release already. and removed Status: In progress We are working on this issue. labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment