JeremySkinner / SagePayMvc

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

Error processing transaction #22

Closed thilandakshina closed 8 years ago

thilandakshina commented 8 years ago

Hi ,

I'm using SagePay integration for my project.with help of your project i'm able to send my request. but my problem is response url.

I'm using azure portal.so i did added inbound rule to my server firewall for port 80 , 443 but still i have problem with this.after i publish my project i can go to sagepay also. but i have some doubt with that request. i ll attach it here

request

but i didn'' send my Redirect URL here.Actually In your sample project also i haven't notice that part. and another thing in my web configuration i just added these parts `

<sagePay>
      <add key="NotificationHostName" value="tdm.azurewebsites.net" />
    <add key="NotificationController" value="PaymentResponse" />
    <add key="NotificationAction" value="Notify" />
    <add key="SuccessAction" value="Success" />
    <add key="FailedAction" value="Failed" />
    <add key="VatMultiplier" value="1" />
    <add key="VendorName" value="VVVVVVV" />
    <add key="Mode" value="Test" />
  </sagePay>

I think these parts are ok.i just added your payment response controller and relevant views. so after i provide test card,then it looks like this. all necessary things here.

basket

So in final step i'm getting following error.

Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL. HTTP error 500: The request was unsuccessful due to an unexpected condition encountered by the server.

Could you please guide me with this because i'm little bit stuck here.don''t know what happen here.

is there any possible ways to send email to you regarding this issue?

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

JeremySkinner commented 8 years ago

The RedirectUrl is something you supply from your NotificationController. If you're using the built-in ActionResult instances, then these will automatically supply the RedirectUrl. For example, here's the implementation of ValidOrderResult:

https://github.com/JeremySkinner/SagePayMvc/blob/master/src/SagePayMvc/ActionResults/ValidOrderResult.cs

The URL is built from the values specified in the web.config (NotificationHostName, SuccessAction/FailedAction etc).

If SagePay is saying that you didn't supply a RedirectUrl then it's probably either because you're not returning one of the ActionResults, or your Notification action isn't accessible to SagePay.

thilandakshina commented 8 years ago

Thanks For the Reply.

Yes i'm supplying my Redirect URL from NotificationController and WebConfig Include that Part. like this


   <add key="NotificationController" value="PaymentResponse" />
    <add key="NotificationAction" value="Notify" />

so i think my controller or action have some problem.still i cannot realize what is this problem. but what do you think about my previous part.

i mean my fiddle image.do you think that part is ok? because i'm sending my basic details to sagepay according to your help project. (Later i'm Planing to add more things but 1st i need to go through this one.)

JeremySkinner commented 8 years ago

The fiddler image doesn't tell me much. What you need to look at is the response from your Notify action. What does fiddler show the RedirectUrl as when the Notify action is invoked?

On Friday, 29 July 2016, thilandakshina notifications@github.com wrote:

Thanks For the Reply.

Yes i'm supplying my Redirect URL from NotificationController and WebConfig Include that Part. like this

<add key="NotificationAction" value="Notify" />

so i think my controller or action have some problem.still i cannot realize what is this problem. but what do you think about my previous part.

i mean my fiddle image.do you think that part is ok? because i'm sending my basic details to sagepay according to your help project. (Later i'm Planing to add more things but 1st i need to go through this one.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236148642, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEnUY-6nj-QDHuhF-07xgpsPX7FLmks5qadckgaJpZM4JYB1A .

thilandakshina commented 8 years ago

I ll attach that image here

notificationresponse

but in that page i'm getting error because i dont have values for SagePayResponse'object.

Status=ERROR RedirectURL=http://ubttimestravel.azurewebsites.net/PaymentResponse/Failed StatusDetail=An error occurred when processing the request.

you also can visit this. http://ubttimestravel.azurewebsites.net/home/Notify

JeremySkinner commented 8 years ago

Perhaps I wasn't clear...you need to look at it when sagepay invokes the action with valid transaction data, not when you visit it yourself.

On Friday, 29 July 2016, thilandakshina notifications@github.com wrote:

I ll attach that image here

[image: notificationresponse] https://cloud.githubusercontent.com/assets/11039030/17246350/0ac528a8-55a9-11e6-9369-037d69d41a8a.png

but in that page i'm getting error because i dont have values for SagePayResponse'object.

Status=ERROR RedirectURL=http://ubttimestravel.azurewebsites.net/PaymentResponse/Failed StatusDetail=An error occurred when processing the request.

you also can visit this. http://ubttimestravel.azurewebsites.net/home/Notify

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236152848, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEj9ENYYj8pQSFcdMtv_h3YJW3ZMNks5qadz7gaJpZM4JYB1A .

thilandakshina commented 8 years ago

sorry for that. i ll attach that image here.

sageresponse

but still i'm getting error

Error processing transaction Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL. HTTP error 500: The request was unsuccessful due to an unexpected condition encountered by the server.

JeremySkinner commented 8 years ago

How are you registering the transaction?

On Friday, 29 July 2016, thilandakshina notifications@github.com wrote:

sorry for that. i ll attach that image here.

[image: sageresponse] https://cloud.githubusercontent.com/assets/11039030/17246603/e50d94cc-55aa-11e6-8acb-19f9e3cc1d69.jpg

but still i'm getting error

Error processing transaction Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL. HTTP error 500: The request was unsuccessful due to an unexpected condition encountered by the server.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236154636, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEvcK_DFcUsrDL4FuXrmyEysbkEMDks5qad-OgaJpZM4JYB1A .

thilandakshina commented 8 years ago

I'm doing it like this var response = _transactionRegistrar.Send(context, orderId, basket, sagePayAddress, sagePayAddress, null);

same way in your sample project. just add my things inside basket object.

JeremySkinner commented 8 years ago

And what's sagepay's response from that?

On Saturday, 30 July 2016, thilandakshina notifications@github.com wrote:

I'm doing it like this var response = _transactionRegistrar.Send(context, orderId, basket, sagePayAddress, sagePayAddress, null);

same way in your sample project. just add my things inside basket object.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236362362, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEr9JXruCcnz9wDBYhTO_kgwBW8Idks5qa0F8gaJpZM4JYB1A .

thilandakshina commented 8 years ago

Actually previously i was doing this on after pulish it on Azure. but now i checked it in local(by registering my ip on sagepay)

sagepay

JeremySkinner commented 8 years ago

Ok great, so you're getting a response back from sagepay for the transaction registration. Is the Notify action being hit too?

On Saturday, 30 July 2016, thilandakshina notifications@github.com wrote:

Actually previously i was doing this on after pulish it on Azure. but now i checked it in local(by registering my ip on sagepay)

[image: sagepay] https://cloud.githubusercontent.com/assets/11039030/17270400/697f3a1a-567f-11e6-8a14-76c20d7f69ed.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236362744, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEvQ1wbT61fqdpC6B2Vd7Yg680Tb2ks5qa0PIgaJpZM4JYB1A .

thilandakshina commented 8 years ago

No Actually that is the problem. previews result is from my local running.i got response. if we consider about Notify Action, if i need to get hit by from local,then do i need to add port 80,443 to my firewall inbound Rule? (I'm thinking that i should do that)but i did this on azure server.

Currently in my local machine notify action didn't get hit.

JeremySkinner commented 8 years ago

Yes, you'll need to open up the firewall to expose those ports publicly.

On Saturday, 30 July 2016, thilandakshina notifications@github.com wrote:

No Actually that is the problem. previews result is from my local running.i got response. if we consider about Notify Action, if i need to get hit by from local,then do i need to add port 80,443 to my firewall inbound? (I'm thinking that i should do that)but i did this on azure server.

Currently in my local machine notify action didn't get hit.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236365327, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgElK1KJ_eOpV6DZ5wJO2KaaV1v830ks5qa1G_gaJpZM4JYB1A .

thilandakshina commented 8 years ago

Great, I did add it like this.Port 80 and port 443.I just add it on port section. I did same way on azure server also. but still notify action get hit.

inbound rule

thilandakshina commented 8 years ago

still i'm not been able to fix this one. i'm not sure what happens here.because i cannot checked it by debugging or any other way. i did open my port on azure.but not sure whats going on there.

I did added this line also <add key="Protocol" value="https" />

because i saw following message from some another blog and your reply also.

`"Sagepay now only support protocol 3.0 on testing server and from August 2015 they going to stop support for older protocols and will support 3.0. So please give it support for 3.0 protocol

JeremySkinner- I've committed a change that sends protocol of 3.0 by default. This means it will no longer work with the Simulator, which doesn't support 3.0.

The only thing that doesn't seem to work is signature validation - the algorithm for generating the signature seems to have changed and I can't find any documentation on this. However, SagePay's own samples don't do signature validation anymore, so I'd suggest omitting this. Feel free to build from source and give it a try."`

So still nothing happend.

thilandakshina commented 8 years ago

I guess ,my Notify action should get hit after these steps.

  1. I select My payment method ->
  2. give test card No(Your card details Page)
  3. Review your order Page
  4. And after I select Pay Button(following image)

ss

After that final step my notify action should get hit. so am i correct?

JeremySkinner commented 8 years ago

Yes, that's correct.

On Saturday, 30 July 2016, thilandakshina notifications@github.com wrote:

I guess ,my Notify action should get hit after these steps.

  1. I select My payment method ->
  2. give test card No(Your card details Page)
  3. Review your order Page
  4. And after I select Pay Button(following image)

[image: ss] https://cloud.githubusercontent.com/assets/11039030/17272138/6f6dd3fa-56ac-11e6-86b6-d04be648a6e7.jpg

After that final step my notify action should get hit. so am i correct?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JeremySkinner/SagePayMvc/issues/22#issuecomment-236379504, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFgEhGdBhI03YEnCKxas_aKQcgmSwMVks5qa4-vgaJpZM4JYB1A .

thilandakshina commented 8 years ago

so i'm thinking that may be my redirect url or port can be the problem.

thilandakshina commented 8 years ago

actually debugging locally cannot be success isn't it?

 <add key="NotificationHostName" value="tdm.azurewebsites.net" />
    <add key="NotificationController" value="PaymentResponse" />
    <add key="NotificationAction" value="Notify" />

because of my notification host name.i cannot add iis one here.so actually in here that part doesn't work.
but in my azure server that should work.(but i cannot debug in there.)
thilandakshina commented 8 years ago

Hi Jeremy firewall port open up mean adding inbound rule to port 443 and 80 ,isnt it? is that enough or is there something i need to do?

JeremySkinner commented 8 years ago

That should be enough...so long as your NotificationHostname is properly set.

JeremySkinner commented 8 years ago

One way to confirm if your NotificationUrl is being built correctly. Put this code inside a controller action:

public ActionResult Test() {
  string notifyUrl = SagePayMvc.UrlResolver.Current.BuildNotificationUrl(ControllerContext.RequestContext);
  return Content(notifyUrl);
}

...and see what that returns.

thilandakshina commented 8 years ago

You mean just add this Test Action Inside my controller and check what happens?

I did it and my result is https://ubttimestravel.azurewebsites.net/Home/Notify

This Home Controller I already change in my webconfig also. because i just add those 3 actions inside my home controller(Notify,Failed,Success)

thilandakshina commented 8 years ago

You also can visit it

http://ubttimestravel.azurewebsites.net/Home/Test

thilandakshina commented 8 years ago

My NotificationHostName is like this. <add key="NotificationHostName" value="ubttimestravel.azurewebsites.net" /> I think this one is also ok.

thilandakshina commented 8 years ago

Hi Jeramy,

After I send my issue to SagePay they send me reply like this. Error 5006 recommendations (10 steps).docx

so i just add outbound port also.but same result.

thilandakshina commented 8 years ago

Hi jerami,

Can you please suggest me some good way to do this integration. because still i'm in same trouble.

thilandakshina commented 8 years ago

Hi Jeramy, Our site is published on Azure App Services.so basically i cannot open my port in there.i think that should be my problem. i'm planing to do this on Azure virtual macine.

JeremySkinner commented 8 years ago

Yes, if you can't open ports on azure app services then you can't use it for sagepay server integration. An azure vm sounds like a good choice (or any other hosting provider that allows you full control of the firewall).

This should solve your issue- good luck in your project.

thilandakshina commented 8 years ago

Thank you very much jeramy. but still i haven't solved that issue.

programming part is done without any problem but this port open may be the problem.

In Azure App Service I cannot open ports.or may be i cannot find it. still no reply from sagepay