Skip to content

BP-4301 Payment is in test mode = incorrect #345

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

Closed
GokhanAltan1 opened this issue Apr 18, 2025 · 5 comments
Closed

BP-4301 Payment is in test mode = incorrect #345

GokhanAltan1 opened this issue Apr 18, 2025 · 5 comments
Assignees
Labels
Status: Released A fix is included in a release already.

Comments

@GokhanAltan1
Copy link

Hello,

after updating the plugin to the latest version 4.0.3 I see this message in my woocommerce orders: The payment for this order was made in test mode. But the payments are all in live mode. Is this some kind of a bug in this version?

@Buckaroo-Rens
Copy link
Contributor

@GokhanAltan1 do you have more info on this? We cannot reproduce it at this point. Maybe a screenshot could help here. Same as PHP version, Wordpress version.

@Buckaroo-Rens Buckaroo-Rens added the Status: Waiting for info We are waiting for more information regarding this issue. label Apr 18, 2025
@vildanbina
Copy link
Contributor

vildanbina commented Apr 18, 2025

It looks like you're using the legacy WordPress post storage, as this test mode message is currently only supported there.

That said, I’ve identified the root cause of the issue. When parsing the response from the Return or Push URL, the payload is parsed with all values as strings. In this case, we get isTest => "false" (as a string), which when cast to a boolean like (bool) "false" incorrectly becomes true.

If you want to apply a quick fix on your end, you can update the following methods to properly parse the boolean values using filter_var:

File: wp-content/plugins/wc-buckaroo-bpe-gateway/src/ResponseParser/JsonParser.php

public function isTest(): bool {
    return filter_var($this->get('IsTest'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
}

File: wp-content/plugins/wc-buckaroo-bpe-gateway/src/ResponseParser/FormDataParser.php

public function isTest(): bool {
    return filter_var($this->get('brq_test'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
}

Using FILTER_VALIDATE_BOOLEAN ensures correct boolean parsing regardless of whether the input is "true", "false", "1", "0", 1, 0, or even real booleans. It prevents PHP from treating any non-empty string (like "false") as true.

Even though this is only a visual issue, we plan to fix it properly in the next release (most likely on Tuesday), where we’ll also add support for this message in HPOS

@vildanbina vildanbina added Status: In progress We are working on this issue. and removed Status: Waiting for info We are waiting for more information regarding this issue. labels Apr 22, 2025
@vildanbina vildanbina changed the title Payment is in test mode = incorrect BP-4301 Payment is in test mode = incorrect Apr 22, 2025
@GokhanAltan1
Copy link
Author

Thank you very much. I will wait for the new release of this plugin.

@Buckaroo-Rene Buckaroo-Rene self-assigned this Apr 23, 2025
@Stannistor
Copy link

Thanks for the solution!
I was a scared when seeing the message ;)
Surprised that i didn't see any topic in the wp plugin repository.

@Buckaroo-Rene Buckaroo-Rene added Status: Waiting for release This issue has been solved, but is not released yet. and removed Status: In progress We are working on this issue. labels Apr 24, 2025
@Buckaroo-Rene
Copy link
Contributor

Hi @GokhanAltan1 & @Stannistor ,

A fix has been implemented in version 4.1.0 of the plugin.
Please update to the latest version and let us know if you encounter any further issues!

Thanks for your patience.

@Buckaroo-Rene Buckaroo-Rene added Status: Released A fix is included in a release already. and removed Status: Waiting for release This issue has been solved, but is not released yet. labels Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Released A fix is included in a release already.
Projects
None yet
Development

No branches or pull requests

5 participants