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

Issue: CleanUpIncompleteSessions cron fails. #1247

Open
mohit-sharma-rp opened this issue Oct 7, 2024 · 2 comments
Open

Issue: CleanUpIncompleteSessions cron fails. #1247

mohit-sharma-rp opened this issue Oct 7, 2024 · 2 comments

Comments

@mohit-sharma-rp
Copy link

mohit-sharma-rp commented Oct 7, 2024

What I expected

CleanUpIncompleteSessions cron should be run without any error.

What happened instead

When the CleanUpIncompleteSessions cron job runs, it throws the following error:
Error in log: ERROR strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/Client.php on line 43

Steps to reproduce the issue

  • Setup Amazon pay configuration at website specific.
  • Authorization Mode should be set to 'Immediate' in the admin configuration for Amazon Pay payment
  • Added a product to the cart
  • Go to the cart page, and click on the Amazon Pay button to proceed to checkout.
  • Use a credit card in Amazon Pay where the payment is declined.
  • Place the order but do not click on the 'Cancel and return to merchant' link and close the window.
  • Run the amazon_pay_cleanup_sessions cron job using n98 command and it will throw error

Your setup

  • Magento version: 2.4.6-p7
  • Amazon Pay Extension Version: 5.17.1
  • Magento Edition: Enterprise Cloud

More details about the issue:

The error occurs when the cron job runs to clean up incomplete transactions at this line: https://github.com/amzn/amazon-payments-magento-2-plugin/blob/5.17.1/Cron/CleanUpIncompleteSessions.php#L122
A null value is passed to the getCheckoutSession method, causing the error and preventing the cron job from completing.

Solution:

After passing the transaction store the cron job completed without any errors, and the order status was updated to "Cancelled".
$amazonSession = $this->amazonPayAdapter->getCheckoutSession($transactionData['store_id'], $checkoutSessionId);

@mohit-sharma-rp mohit-sharma-rp changed the title Issue: Order status stuck in payment review for incomplete transation. Issue: CleanUpIncompleteSessions cron fails. Oct 7, 2024
@sgabhart22
Copy link
Contributor

Hi @mohit-sharma-rp ,

Interesting find, I'm a little surprised this hasn't come up yet... certainly looks like that call couldn't succeed without supplying the store code. You're more than welcome to open a PR for this issue if you'd like; we wouldn't merge it directly but could cherry pick your code into our next release branch if everything looks good. Thanks again for the report!

Cheers,
Spencer

@mohit-sharma-rp
Copy link
Author

Hi @sgabhart22
PR is opened for this issue #1248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants