Closed thilandakshina closed 8 years ago
That's because of the signature validation.... you're calling response.IsSignatureValid inside your controller but the test data you're sending through Postman only has the VendorTxCode and the Status. You also need to include the SecurityKey. Is that what you're referring to? Or are you referring to the double port in the error?
If the latter, then it's probably because your notification host property in the web.config isn't correctly set.
Actually My Host Name also set correctly.last time you also verified it & right now i just tried to send to through postman.i ll add image
so right now i just add
{ "VendorTxCode":"8ad868c7-d50f-49d9-81c9-63839e374ed8", "Status":"OK", "securityKey":"WAFJZGPNSC", "vendorName": "timestravelltd" }
so i can connet with the sagepay.but problem is i cannot get response from them. ![https://cloud.githubusercontent.com/assets/11039030/17272138/6f6dd3fa-56ac-11e6-86b6-d04be648a6e7.jpg)
because of that i'm keep getting "5006 : Unable to redirect to Vendors web site."
but my point is this.
1) if i can send data through postman,then there is no problem with my ports and ip's. those things are working fine. isn't it? 2)so using postman i'm getting error like null reference something.but when i use my hosted site then it gives "5006 : Unable to redirect to Vendors web site."
Actually me postman result(Error - MD5 ) cannot be affected to the "5006 : Unable to redirect to Vendors web site" isn't it right? i mean because of MD5 error, i cannot keep getting 5006 : Unable to redirect to Vendors web site error.
Additional Details 1
<sagePay>
<!-- The public-facing hostname that SagePay can use to contact the site -->
<add key="NotificationHostName" value="ubttimestravel.azurewebsites.net" />
<!--<add key="NotificationHostName" value="my.external.hostname" />-->
<!-- The protocol defaults to http, but you can override that to https with the following setting my.external.hostname-->
<!--<add key="Protocol" value="https" />-->
<!-- Your notification controller -->
<add key="NotificationController" value="PaymentResponse" />
<!-- Your notification action. These three settings together are used to build the notification URL -->
<!-- EG: http://my.external.hostname/PaymentResponse/Notify -->
<add key="NotificationAction" value="Notify" />
<!-- Action names for URLS that the user will be directed to after payment either succeeds or fails -->
<!-- The URL is constructed from the notificationHostName and NotificationController. -->
<!-- Eg: http://my.external.hostname/PaymentResponse/Success -->
<add key="SuccessAction" value="Success" />
<add key="FailedAction" value="Failed" />
<!-- VAT multiplier. Currently at 20% -->
<add key="VatMultiplier" value="1" />
<!-- Name of vendor. You will need to change this -->
<add key="VendorName" value="timestravelltd" />
<!-- Simulator, Test or Live -->
<add key="Mode" value="Test" />
</sagePay>
and another some interesting thing is after i added sagepay mvc dll through nuget,it gives errors. so i decided to download this project in github and build it and add that sagepay dll.
Additional Details 2
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
<system.web>
<customErrors mode="Off" />
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5" />
</system.web>
And there is some difference bettween you sample project SagePayResponse Class ans My Project SagePayResponse Class. I ll add it here. Original Project - This is your Project.and other one is mine. SagePayResponse - Original Project.txt SagePayResponse My Project.txt
I know this is lots of questions.but I would be very grateful if you could help to solve this matter.
because of that i'm keep getting "5006 : Unable to redirect to Vendors web site."
So this means that when SagePay contact your server, they aren't getting a response back that contains a RedirectURL. So I'm guessing what you're sending via PostMan and what SagePay are sending are somehow slightly different. For one, you're sending JSON which is not what SagePay will be sending.
I'd suggest adding some logging to your application to intercept exactly what raw request SagePay is sending.
Secondly, I'd suggest temporarily running this outside Azure, on a regular IIS instance that's publicly accessible to the internet. That way you can determine whether or not there's something related to Azure that's causing the problem.
Beyond this, I can't really help you any further as the issue seems related to connectivity rather than SagePayMvc itself.
Hi Jeremy I fixed it yesteday. Actually Its really small things.In my notify action, I need to get matching Transaction using VendorTxCode from my database table.but in my program there is problem when it saved to database in previous steps.so because of that it cannot find any data in notify action. so then that error occured. Now its working... 👍
public ActionResult Notify(SagePayResponse response)
{
if (string.IsNullOrEmpty(response.VendorTxCode))
{
return new ErrorResult();
}
var OrderDetails = (from order in entity.Transaction_Registration_Details
where order.VendorTxCode == response.VendorTxCode
select order).FirstOrDefault();
if (OrderDetails == null)
{
return new TransactionNotFoundResult(response.VendorTxCode);
}
if (!response.IsSignatureValid(OrderDetails.SecurityKey, SagePayMvc.Configuration.Current.VendorName))
{
return new InvalidSignatureResult(response.VendorTxCode);
}
return new ValidOrderResult(OrderDetails.VendorTxCode, response);
}
Thanks for all your help, I really appreciate that.
Great, glad you got it working.
Hi ,
I'm using Sage Pay integration for my project.Last time also i have same problem but still i didn't found any good result for this issue.but later i have found something that you can answer.I did spent too much time for this.i admire your previous help. but actually still i cannot get it succeeded.
[I'm using azure portal.so i did added inbound rule to my server firewall for port 80 , 443 and Azure doesn't have any problem with it] Sage pay gave me something to verify later i found this.
using fiddler i tried to post data to my PaymentResponse Controller. Actually i'm ok with other 6 steps.but with this one i'm not satisfied.
when i'm doing my transaction ,i'm able save those VendorTxCode and other things realted to trasaction. so after i send post request (same time i'm debuging in localhost) Notify action get hit.
when i debug localhost.its also get hit,so i tried to post that request to our main site.so then i got some error(nulll reference exception like wise).but i'm sure it get hit and that error coming because i didn't supply all of parameters. however i can send post request to my hosted site PaymentResponse controller - Notify Action. so it means there is no problem with my port and other stuff isn't it?
I would be very grateful if you could help to solve this matter.if you have any problem regarding my issues please ask me.so then i can explain more