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

Klarna Issue #38675

Open
5 tasks
dvakerlis opened this issue Apr 29, 2024 · 10 comments
Open
5 tasks

Klarna Issue #38675

dvakerlis opened this issue Apr 29, 2024 · 10 comments
Labels
Issue: ready for confirmation Reported on 2.4.5 Indicates original Magento version for the Issue report.

Comments

@dvakerlis
Copy link

Preconditions and environment

Version 2.4.5

Steps to reproduce

After comple the payment in klarna website when its returns to our site we get error 500 in this url /checkout/klarna/updateSession/

Expected result

Order placed successfully

Actual result

No redirect to the success page. It's returns to checkout page and the order not placed

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Apr 29, 2024

Hi @dvakerlis. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

Copy link

m2-assistant bot commented Apr 29, 2024

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@dvakerlis
Copy link
Author

Reproduced on 2.4.5

@engcom-Dash
Copy link

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Dash engcom-Dash added the Reported on 2.4.5 Indicates original Magento version for the Issue report. label Apr 30, 2024
@engcom-Dash
Copy link

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Dash engcom-Dash removed their assignment May 14, 2024
@alicedfisheye
Copy link

alicedfisheye commented May 14, 2024

Issue:
vendor/klarna/module-payments/Controller/Klarna/QuoteStatus.php
Local and CI work as expected as is_active is always '1' due to the fact it technically errors on the try/catch which allows orders to go through. On live checkout/klarna/authorize callback happens which means that the klarnaQuote is set and does not error.

It then moves out of the try/catch and goes to set is_active again.
$result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted();
It sets this to true.

However, the JS vendor/klarna/module-payments/view/frontend/web/js/view/payments/kp.js check to decide if it should call checkout/klarna/authorizationTokenUpdate and then call context.placeOrder(); checks - if (result['is_active'] === '1') {
but since the above has set it to true this will not run and a order will never be placed.

Therefore, the stack trace below will happen.

Stack trace:
#0 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\OrderRepository->get()
#1 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\OrderRepository\Interceptor->___callParent()
#2 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\OrderRepository\Interceptor->Magento\Framework\Interception{closure}()
#3 /var/www/website/releases/20240509084859/generated/code/Magento/Sales/Model/OrderRepository/Interceptor.php(23): Magento\Sales\Model\OrderRepository\Interceptor->___callPlugins()
#4 /var/www/website/releases/20240509084859/vendor/klarna/module-payments/Controller/Klarna/UpdateSession.php(103): Magento\Sales\Model\OrderRepository\Interceptor->get()
#5 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(58): Klarna\Kp\Controller\Klarna\UpdateSession->execute()
#6 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(138): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->___callParent()
#7 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(153): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->Magento\Framework\Interception{closure}()
#8 /var/www/website/releases/20240509084859/generated/code/Klarna/Kp/Controller/Klarna/UpdateSession/Interceptor.php(23): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->___callPlugins()

Apply this patch :)

index 34a6f20..c6349bb 100644
--- a/Controller/Klarna/QuoteStatus.php
+++ b/Controller/Klarna/QuoteStatus.php
@@ -114,7 +114,7 @@ class QuoteStatus extends CsrfAbstract implements HttpPostActionInterface
         }
 
         $magentoQuote = $this->magentoQuoteRepository->get($klarnaQuote->getQuoteId());
-        $result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted();
+        $result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted() ? '1' : '0';
 
         return $this->result->getJsonResult(200, $result);
     }

This caused me great pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation Reported on 2.4.5 Indicates original Magento version for the Issue report.
Projects
Issue Confirmation and Triage Board
  
Ready for Confirmation
Development

No branches or pull requests

3 participants