YounitedCredit / younitedpay-module-prestashop

0 stars 0 forks source link

additionalAdress is too long, make request 'Bad Request' #23

Open Emancipateur opened 1 month ago

Emancipateur commented 1 month ago

Hello,

I have an e-commerce Prestashop using your module. Some of my customers encounter a 'Bad Request' error when selecting Younited payment on the order page. In most of these cases,what i found , the issue is that the'complement address' is too long.

This occurs in PaymentService.phpin the function sendContractRequest. Unlike$adresseStreet, you do not check if mb_strlen($additionalAdress) > 38, and it seems that $additionalAdress cannot be longer than 38 characters either.

Could you please check?

Thank you.

kgleizes commented 1 month ago

Hello @Emancipateur

Thank you for your feedback.

We have check your issue and it will be fixed very soon in version 1.1.5.

The length of the main address is checked (38 caracters) but not the additional, we will make the same process to avoir this issue.

If you want to add it manually now you can do this in the file : modules/younitedpay/src/Service/PaymentService.php - L.129

        $additionalAdress .= $customerAdress->address2 . ' ' . $customerAdress->other;

        if (mb_strlen($additionalAdress) > 38) {
            $additionalAdress = substr($additionalAdress, 0, 38);
        }

We will update this thread as closed when the issue if solved with next release.