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

Unhandled exception occurs when postal code isnt provided #48

Open
JiyaadDolly opened this issue Feb 13, 2023 · 0 comments
Open

Unhandled exception occurs when postal code isnt provided #48

JiyaadDolly opened this issue Feb 13, 2023 · 0 comments

Comments

@JiyaadDolly
Copy link

JiyaadDolly commented Feb 13, 2023

We are seeing the following error when a postal code value isn't provided during a guest checkout.

report.CRITICAL: Exception: 
Deprecated Functionality: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /app/vendor/realexpayments/hpp/Model/PaymentMethod.php on line 405

Expected Result on checkout:
The Payment widgets loads allowing the customer to pay

Actual Result:
The payment widget does not load, resulting in a blank payment option

Recommendation is to add the following:
Adjust the following code at realexpayments/hpp/Model/PaymentMethod.php from:

$postalBit = $order->getShippingAddress()->getPostcode();
            if ($shippingCountryCode == "GB") {

To:

$postalBit = $order->getShippingAddress()->getPostcode();
            if ($shippingCountryCode == "GB" && isset($postalBit)) {

Reference code:

$postalBit = $order->getShippingAddress()->getPostcode();
if ($shippingCountryCode == "GB") {
$postalBit = preg_replace('/\D/', '', $postalBit);

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

1 participant