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

System.UriFormatException: Invalid URI: The URI is empty #4

Closed
MichaelNielsenDK opened this issue Mar 1, 2022 · 6 comments
Closed

Comments

@MichaelNielsenDK
Copy link

When trying to go to payment, I get a System.UriFormatException: Invalid URI: The URI is empty. error on a line with this code using (Html.BeginPaymentForm(order))

It's a simple order with just one product, no giftcards, discounts or any other price adjustments.

Phone number is valid without any prefixes. I've also tried removing all field aliases in the payment method settings, but I still get the error.

Terms Url has been added.

Umbraco 8.12.3
Vendr 1.8.6
Vendr.Contrib.PaymentProviders.Nets 1.0.1

@bjarnef
Copy link
Collaborator

bjarnef commented Mar 2, 2022

I just tested this in Umbraco 8.15.0, Vendr 1.8.6 and Vendr.Contrib.PaymentProviders.Nets 1.0.1

I could reproduce an error if addressLine1, postalCode or city properteis is missing in shippingAddress object since Nets required these properties, which throw an System.UriFormatException: Invalid URI: The URI is empty. error.

image

Any special characters in the shipping address?

For example it seems Nets Easy doesn't accept 900 og 0900 in postalCode property in shippingAddress object.
https://postnr.dk/?q=k%C3%B8benhavn

image

However with a simple product with a cost of 100 DKK (tested with a without shipping) it does seem to work.

image

@MichaelNielsenDK
Copy link
Author

shippingAddressLine1, shippingCity and shippingZipCode has values and fields are mapped
https://prnt.sc/Sd_a-KVKNBsW

Also, looking at Nets documentation, these fields do not seem to be required
https://nets-devs.isotop.se/nets-easy/en-EU/api/payment-v1/#v1-payments-post

@bjarnef
Copy link
Collaborator

bjarnef commented Mar 3, 2022

Yes, that shouldn't be the issue.

The shipping address details is optional, but is needed if the consumer data should be stored:
#3 (comment)

But I couldn't easily reproduced it in demo store:

image

I guess the (Test/Live) Secret Key and (Test/Live) Checkout Key are filled in the correct settings fields.

@MichaelNielsenDK
Copy link
Author

Yes the keys from Nets are filled out correct.

After updating Umbraco, Vendr and Vendr.Contrib.PaymentProviders.Nets, all to latest versions, it works with the same properties entered in the gateway configuration. 🤷‍♂️

So this configuration works:
Umbraco 8.17.2
Vendr 2.1.0
Vendr.Contrib.PaymentProviders.Nets 2.0.0

@bjarnef
Copy link
Collaborator

bjarnef commented Mar 5, 2022

Okay that's great, but also a bit strange.

When I disregard the changes it Vendr v2 accessing order and settings via ctx.Order and ctx.Settings the only changes are basically the request are async, the merchantTermsUrl is set and set shippingAddress if specified. It shouldn't probably not requeired ShippingAddressLine2PropertyAlias since address line 2 in optional.

image

image

I noticed the payment method settings, but it isn't really used as Nets currently decided the payment methods based on country and currency: https://developers.nets.eu/nets-easy/en-EU/docs/payment-methods/

However I have been told this feature may be added in June, so I think I will leave this setting for now.

If you still need to resolve this issue in v1 you could try creating an instance of NetsPaymentRequest populated with data as here: https://github.com/vendrcontrib/vendr-payment-provider-nets/blob/v1/main/src/Vendr.Contrib.PaymentProviders.Nets/Easy/NetsEasyOneTimePaymentProvider.cs#L330-L395 and serialize the json JsonConvert.SerializeObject(data) ...

or clone the repository, checkout v1/miain branch, in your solution add the Vendr.Contrib.PaymentProviders.Nets.csproj and then in the Umbraco/Vendr project add a reference to this project, would allow you to debug the source code and either see the stacktrace from Flurl or copy the was JSON and test the raw JSON request in e.g. Postman.

@bjarnef
Copy link
Collaborator

bjarnef commented Apr 6, 2022

I will close this as I couldn't reproduce the error in Vendr 1.8.6 and Vendr.Contrib.PaymentProviders.Nets 1.0.1 with demo store data, but let me know if it is still an issue and steps to reproduce.

Ideally the which part of the data in the JSON request that is causing the invalid request.

@bjarnef bjarnef closed this as completed Apr 6, 2022
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