JeremySkinner / SagePayMvc

ASP.NET MVC Integration for SagePay
Apache License 2.0
31 stars 31 forks source link

BuildNotificationUrl always using Default values #26

Closed dermotcurranfiremelon closed 5 years ago

dermotcurranfiremelon commented 5 years ago

Hi,

After executing transactionRegistrar.Send(), the response comes back with error:

3011 : The NotificationURL format is invalid.

After digging around in the code I found that the notification URL being generated in the DefaultUrlResolver.BuildNotificationUrl() is:

https://localhost:44351/paymentResponse/index/...

Even though my config settings are as follows:

<sagePay>
    <add key="FailedController" value="Payment" />
    <add key="FailedAction" value="Failed" />
    <add key="Mode" value="Test" />
    <add key="NotificationHostName" value="localhost" />
    <add key="NotificationController" value="Payment" />
    <add key="NotificationAction" value="SagePay" />
    <add key="Protocol" value="https" />
    <add key="SuccessController" value="Payment" />
    <add key="SuccessAction" value="Success" />
    <add key="VatMultiplier" value="1" />
    <add key="VendorName" value="xxx" />
  </sagePay>

Notice I am using my own Controller "Payment" instead of the default "PaymentResponse" but I didn't think this would be an issue.

I have 2 questions:

  1. Why did the URL generate using the default values instead of my configured ones?
  2. Why did it say this URL was invalid?

Any help is appreciated.

Thanks.

JeremySkinner commented 5 years ago

I would've expected that to work fine. Only thing I can suggest is make sure that the sagePay element of your web.config is built correctly as a NameValue section (as per https://github.com/JeremySkinner/SagePayMvc/blob/master/Sample/SagePayMvc.Sample/Web.config)

I can't really help further than that I'm afraid - this isn't a project I maintain/support any further (the last commit was 4 years ago), so your best bet is probably to download and debug the code directly if you're still having problems.

dermotcurranfiremelon commented 5 years ago

Only thing I can suggest is make sure that the sagePay element of your web.config is built correctly as a NameValue section (as per https://github.com/JeremySkinner/SagePayMvc/blob/master/Sample/SagePayMvc.Sample/Web.config)

The section is built as a NameValue section, so that's not it (left that out of my snippet, but its there!).

I can't really help further than that I'm afraid - this isn't a project I maintain/support any further (the last commit was 4 years ago), so your best bet is probably to download and debug the code directly if you're still having problems.

I had noticed the dates on the commits but thought i'd have a stab in the dark anyway, you never know!

I will download and debug it myself to get to the bottom of this.

Thanks for your quick response.