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

Service int_monei.http.rest returns error #1

Closed
federicogiampietro opened this issue May 16, 2023 · 13 comments
Closed

Service int_monei.http.rest returns error #1

federicogiampietro opened this issue May 16, 2023 · 13 comments

Comments

@federicogiampietro
Copy link

Hello,

the service int_monei.http.rest upon first call always returns the following message
SSLHandshakeException:com.demandware.beehive.core.internal.ssl.WrappedCertificateException:
sun.security.validator.ValidatorException: PKIX path validation failed
java.security.cert.CertPathValidatorException: validity check failed

this happens both on sandbox and development environment, the latter with a valid SSL certificate. Seems like the API endpoint is protected not only by the authorization header but with a certificate check as well.

A mocked up API call with Postman works ok only if the option to check the SSL certificate validity is turned off

@jimmyn
Copy link
Collaborator

jimmyn commented May 16, 2023

Please provide the API call with Postman so we can investigate the issue

@federicogiampietro
Copy link
Author

I'll provide partially obscured screenshots since the call contains sensitive info

Schermata 2023-05-16 alle 10 29 20
Schermata 2023-05-16 alle 10 30 14

@jimmyn
Copy link
Collaborator

jimmyn commented May 16, 2023

The endpoint should be https://api.monei.com/v1

@federicogiampietro
Copy link
Author

What???

the service credentials i've got it configured for being "https://api.monei.com/v1" but the code adds the endpoint to the service url. Obviously it has to be this way because MONEI has a list of available endpoints (https://docs.monei.com/api/) all starts with "https://api.monei.com/v1/" but when making an API call the correct endpoint has to be selected for the call itself.

The url i've used in postman and shared here is the exact url the code is calling when trying to open the MONEI popup (creating the payment in MONEI)

anyway, even by following your suggestion and calling a non-existing MONEI endpoint, i get the same response

can you send me an example of a call that you can make through postman?

Schermata 2023-05-16 alle 11 13 36

@jimmyn
Copy link
Collaborator

jimmyn commented May 16, 2023

You can find the postman collection here - https://postman.monei.com/

image
curl --location 'https://api.monei.com/v1/payments' \
--header 'Authorization: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 110,
    "currency": "EUR",
    "orderId": "12345678",
    "callbackUrl": "https://example.com/checkout/callback",
    "completeUrl": "https://example.com/checkout/complete"
}'

But https://api.monei.net/v1/payments works the same.

In your screenshots, I see that you are using insecure http:// endpoint. http requests are not supported. You should use https://api.monei.com/v1

@federicogiampietro
Copy link
Author

the endpoint was already with https within Commerce Cloud but indeed with http on my postman example

still, same issue

by the way, by disabling SSL check on Postman, also the http:// endpoint responds with a 200.

in the screenshot you're sharing SSL check is disabled or enabled within postman?
Settings -> Enable SSL certificate verification

Did you ever tried making the cartridge work on a CC environment? because the error we are getting

SSLHandshakeException:com.demandware.beehive.core.internal.ssl.WrappedCertificateException:
sun.security.validator.ValidatorException: PKIX path validation failed
java.security.cert.CertPathValidatorException: validity check failed

seems to clearly state that the api connection is requiring a SSL handshake which is not happening

Schermata 2023-05-16 alle 12 26 06

@federicogiampietro
Copy link
Author

follows screenshot of call debugging in CC

Schermata 2023-05-16 alle 12 42 47
Schermata 2023-05-16 alle 12 42 55

@federicogiampietro
Copy link
Author

Tried the GET payment endpoint, same result.

Be advised that no other API endpoints to other domains return this error, both on CCloud and Postman

@federicogiampietro
Copy link
Author

didn't noticed the endpoint was .NET instead of .COM . it works with the .com endpoint

please update the XML meta definition of the service versioned with the cartridge because it points to the .net domain

Schermata 2023-05-16 alle 12 55 02

@jimmyn
Copy link
Collaborator

jimmyn commented May 16, 2023

This is weird, I get the same error in postman if I enable the certificate validation, but the certificate is valid and not expired

 ~ openssl s_client -servername api.monei.com -connect api.monei.com:443 2>/dev/null | openssl x509 -noout -dates
notBefore=Feb 28 00:00:00 2023 GMT
notAfter=Jan 23 23:59:59 2024 GMT

@federicogiampietro
Copy link
Author

federicogiampietro commented May 16, 2023

with the validation enabled, the api.monei.com domain is not returning the error at all for me
i only got the issue (both on postman and CCloud) by using the api.monei.net domain which indeed is the wrong domain but it's the one that the versioned xmls in the cartridge contains

i think we can close the issue if you could update the xmls, so it would avoid the issue to happen again to others :)

@federicogiampietro
Copy link
Author

there was an open issue for postman regarding ssl certificates generated by let's encrypt that was regarding the error you're mentioning (certificate valid but not recognized) that was fixed at some point postmanlabs/postman-app-support#10338

maybe you could try update the postman app if that's the one you're using

anyway as stated in the previous message my issue was related the .net domain usage instead of the .com

@jimmyn
Copy link
Collaborator

jimmyn commented May 16, 2023

Fixed, thank you for pointing that out.

@jimmyn jimmyn closed this as completed May 16, 2023
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