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-4009 & BP-4160 buckarooFee.title is not a function #1108

Open
onepack opened this issue Nov 22, 2024 · 8 comments · Fixed by #1119
Open

BP-4009 & BP-4160 buckarooFee.title is not a function #1108

onepack opened this issue Nov 22, 2024 · 8 comments · Fixed by #1119
Assignees
Labels
Bug Bugs, functions that are not working like they should. Priority: Normal This issue has a normal/medium priority. Status: Researching We are researching this issue.

Comments

@onepack
Copy link

onepack commented Nov 22, 2024

Since we updated Magento to 2.4.7-p3 we get this issue at the checkout for every payment method.

Your PHP version: 8.1.30
Buckaroo version: 1.50.2

Uncaught TypeError: window.checkoutConfig.buckarooFee.title is not a function

Uncaught TypeError: window.checkoutConfig.buckarooFee.title is not a function
selectPaymentMethod https://domain.com/static/version1731686103/frontend/Themebase/theme/nl_NL/Buckaroo_Magento2/js/view/payment/method-renderer/ideal.js:151
init https://domain.com/static/version1731686103/frontend/Themebase/theme/nl_NL/knockoutjs/knockout.js:4669
jQuery 5

@Buckaroo-Rene Buckaroo-Rene changed the title buckarooFee.title is not a function BP-4009 buckarooFee.title is not a function Dec 17, 2024
@Buckaroo-Rene Buckaroo-Rene added Bug Bugs, functions that are not working like they should. Status: In progress We are working on this issue. Priority: Normal This issue has a normal/medium priority. labels Dec 17, 2024
@Buckaroo-Rene Buckaroo-Rene linked a pull request Dec 17, 2024 that will close this issue
@Buckaroo-Rene
Copy link
Contributor

Hi @onepack ,

Thank you for reporting this issue. We have developed a fix, which will be included in our next release.
The fix is currently undergoing testing, and we will keep you updated when a new release is available containing this fix.

@richardreen
Copy link

We are several weeks later and still there is no solutioh for this error!!!
I wrote several email, no solution. We are facing this error now for weeks....losing sales now!!

@SandervdHulst
Copy link
Contributor

Hi @richardreen,
Thank you for your message. We are currently in the final phase of testing for our next release, which is planned for the first half of January. This problem is part of the upcoming release.

Additionally, we have prepared a Pull Request to address this issue: #1119
You could consider to checkout this specific Pull Request.

@Buckaroo-Rene Buckaroo-Rene added Status: Waiting for release This issue has been solved, but is not released yet. Status: Released A fix is included in a release already. and removed Status: In progress We are working on this issue. Status: Waiting for release This issue has been solved, but is not released yet. labels Jan 22, 2025
@Buckaroo-Rene
Copy link
Contributor

Hi @onepack & @richardreen ,

A fix has been implemented and is now available in v1.51.0.

@MatthijsvanNoort
Copy link

MatthijsvanNoort commented Jan 28, 2025

This doesn't work with FireCheckout for certain stores.
Still getting this error.

There is no error checking or fallback in the various payment method js's

for example, if you pick ideal.js and comment out
// window.checkoutConfig.buckarooFee.title(this.paymentFeeLabel);
everything then the payment method works

I see in totals.js (the change that is in the latest version)
window.checkoutConfig.buckarooFee.title = ko.observable(options.title);

but there's no error checking here. Apparently ko.observable(options.title) fails, then everything fails.

@coughsyrupgit
Copy link

coughsyrupgit commented Jan 28, 2025

This bug may occur because of a racing issue with Magento_PaymentServicesPaypal module.

This core module adds the COMPLETE checkout config into the shortcut buttons HTML, which is stored in the local storage and used by minicart component. And minicart component is used as sidebar on checkout.

No surprise, disabling shortcut buttons in the admin doesn't help, because checkout config is placed in extra_actions HTML regardless. Reference: magento/module-payment-services-paypal/view/frontend/templates/smart_buttons_minicart.phtml.


In this module, the line

window.checkoutConfig.buckarooFee.title = ko.observable(options.title);

may be executed before the customer section update. In this case, the checkout config script from shortcut buttons HTML completely overwrites checkoutConfig changes, which makes window.checkoutConfig.buckarooFee.title unavailable.

I think script view/frontend/web/js/view/summary/totals.js can be improved, so this buckarooFee.title property is redefined again after the customer sections update by subscribing to customer data using Magento_Customer/js/model/customer module. However, I think buckarooFee.title is ko.observable() for a reason, and this may not be enough to make this module more stable with Magento_PaymentServicesPaypal.


Alternatively, you can just disable the PayPal buttons in minicart and adjustsmart_buttons_minicart.phtml template, so checkout config is not added if buttons are disabled:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

?>

<?php
/** @var \Magento\PaymentServicesPaypal\Block\SmartButtons $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>

<?php $serializedCheckoutConfig = /* @noEscape */ $block->getSerializedCheckoutConfig();

$scriptString = <<<script
            window.checkoutConfig = {$serializedCheckoutConfig};
script;
?>

<?php if ($block->isLocationEnabled('minicart')): ?>
    <div class="smart-buttons">
        <div data-mage-init='{"Magento_PaymentServicesPaypal/js/view/payment/smart-buttons-cart":
        <?= /* @noEscape */ json_encode($block->getComponentParams()) ?>}'></div>
    </div>
<?php endif ?>
<?php if ($block->isApplePayLocationEnabled('minicart')): ?>
    <div class="apple-pay">
        <div data-mage-init='{"Magento_PaymentServicesPaypal/js/view/payment/apple-pay-cart":
        <?= /* @noEscape */ json_encode($block->getComponentParams()) ?>}'></div>
    </div>
<?php endif ?>
<?php if ($block->isGooglePayLocationEnabled('minicart')): ?>
    <div class="google-pay">
        <div data-mage-init='{"Magento_PaymentServicesPaypal/js/view/payment/google-pay-cart":
        <?= /* @noEscape */ json_encode($block->getComponentParams()) ?>}'></div>
    </div>
<?php endif ?>

<!-- here's the changed part -->
<?php if ($block->isLocationEnabled('minicart')
    || $block->isApplePayLocationEnabled('minicart')
    || $block->isGooglePayLocationEnabled('minicart')
): ?>
    <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
<?php endif ?>

That's what we did in the end, because we don't use these PayPal buttons anyway.

@Buckaroo-Rene Buckaroo-Rene reopened this Jan 29, 2025
@LeanderMatse
Copy link

Same issue. Unable to select any payment.

Magento 2.4.7-p3
buckaroo/magento2 1.51.0

@Buckaroo-Rene Buckaroo-Rene added Status: Researching We are researching this issue. and removed Status: Released A fix is included in a release already. labels Jan 29, 2025
@Buckaroo-Rene
Copy link
Contributor

Hi @MatthijsvanNoort, @coughsyrupgit & @LeanderMatse ,

Thank you for sharing such detailed information. Your insights have been extremely helpful in understanding the issue, which indeed appears to be a race condition problem.

We are actively investigating the issue and already have a potential fix.
To proceed, we’d appreciate it if one of you could reach out via email to [email protected] regarding this case.
This will allow us to collaborate more closely and share additional information more easily to verify whether the fix works for your situation.

Looking forward to your response.

Best regards,
René

@Buckaroo-Rene Buckaroo-Rene changed the title BP-4009 buckarooFee.title is not a function BP-4009 & BP-4160 buckarooFee.title is not a function Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bugs, functions that are not working like they should. Priority: Normal This issue has a normal/medium priority. Status: Researching We are researching this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants