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

Double store credit refunds when a error is received before redirecting to the buckaroo checkout. #989

Closed
leonhelmus opened this issue Jun 10, 2024 · 2 comments
Assignees
Labels
Status: Waiting for info We are waiting for more information regarding this issue.

Comments

@leonhelmus
Copy link

leonhelmus commented Jun 10, 2024

System requirements:
Adobe Commerce: 2.4.6-p4
php 8.1
module buckaroo/magento2: v1.46.1

Settings
Working buckaroo account
fill in the following settings:
buckaroo_magento2/account/secret_key
buckaroo_magento2/account/merchant_key

Certificate is not added (buckaroo_magento2/account/certificate_file) reason why is that buckaroo gives back an error before it redirects you as a customer to the buckaroo checkout.

ideal is enabled on test account

Steps to reproduce

  • First create a customer where you add store credit (magento_customerbalance).
  • Than add a product which you can pay of partially or full with store credit.
  • Than it will trigger the error "No Buckaroo certificate configured.". (this could be any error received from buckaroo which could cancel the payment)
  • In magento the order has been processed even though this error was given back.
  • I get twice as much store credit back.

Expected result

  • I get my store credit back, but not doubled.

Actual result

  • I get two times as much store credit back.

Additional info
If this function (\Magento\Quote\Model\QuoteManagement::submitQuote) receives an error after the order has been created Magento will rollbackAddresses using this function: \Magento\Quote\Model\QuoteManagement::rollbackAddresses.

This than triggers the dispatch the event sales_model_service_quote_submit_failure which in turn invokes this observer:
\Magento\CustomerBalance\Observer\RevertStoreCreditObserver::execute

Afterwards on the same event Buckaroo has this event:

    <event name="sales_model_service_quote_submit_failure">
        <observer name="buckaroo_failed_quote_order" instance="Buckaroo\Magento2\Observer\HandleFailedQuoteOrder"/>
    </event>

Which triggers a cancellation of the order which triggers this function (\Magento\Sales\Model\Order::cancel) Which adds the following event order_cancel_after which triggers the same observer again:
\Magento\CustomerBalance\Observer\RevertStoreCreditObserver::execute

I also added this bug to the magento issues since you could also say this is an issue of magento.
magento/magento2#38815

@Buckaroo-Rene
Copy link
Contributor

Hi @leonhelmus,

First of al thanks for contacting us. However I noticed that the issue you raised on the Magento side has been closed, and it seems you've implemented your own fix.
If there's been an update or you have more information, please share it with us.
Otherwise, can we proceed to close this issue?

Thanks!

@Buckaroo-Rene Buckaroo-Rene self-assigned this Aug 22, 2024
@Buckaroo-Rene Buckaroo-Rene added the Status: Waiting for info We are waiting for more information regarding this issue. label Aug 22, 2024
@Buckaroo-Rene
Copy link
Contributor

We will close this issue since there haven't been a reply anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting for info We are waiting for more information regarding this issue.
Projects
None yet
Development

No branches or pull requests

2 participants