Using the Payment Provider (SagePay), I have a payment process completing, ending in the creation of a Transaction and an email confirmation but the page continues to display the Sagepay error 5006
The Callback is received from Sagepay (the param SagePayResponse response)
I can then retrieve the response properties (like TxAuthNo, AVSCV2 etc)
I then call response.GenerateSignature Then
TeaCommerce.Api.Web.PaymentProviders.CallbackInfo mycbi = mysp.ProcessCallback(TC.GetCurrentOrder(1), myreq, settings);
This results in a Transaction ID and order.Finalize
At this point I try to redirect to the umbraco page but nothing happens.
What i am still unsure of is what httprequest object to use to pass to the ProcessCallback
The ProcessCallback indicates:
public override CallbackInfo ProcessCallback(Order order, HttpRequest request, IDictionary
So 2 questions:
what httprequest to pass to ProcessCallback
why is the redirect not working at the end of the process
I cant figure out if your are doing a custom provider that doesnt quite use the flow of a normal provider in Tea Commerce or if you use the standard in Tea Commerce. From my look at your question it looks like you are making a total custom one from scratch. For it to work properly with Tea Commerce you need to use its payment provider API to build a provider - else the flow will be totally wrong and hard to debug.
You should not do new SagePay(); and all that. You should use the Razor API of Tea Commerce. See how its done here. That will do all the magic with the continue url, cancel url, callback etc. So no need for you to do all this hard work :)
If you look in the code in line 155, it sets the cancel url to the action if something went wrong. It also logs it. So look in the Umbraco log files in the App_Data folder and see what the error message is. Should give you a clue about it.
Nearly there. Everything works except Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.
In the back office I have tried both fully qualified url and relative url for both ContinueURL and CancelURL (also have SuccessURL and FailureURL)
In SagePay.cs I have tried hard coding lines 104-106 with full urls (I thought the NotificationURL was the RedirectURL)
Does the page which NotificationURL points to need to call a function in the SagePay Payment Provider to send a request back to SagePay?
Here is log
2016-06-08 16:28:54,385 [47] INFO umbraco.BusinessLogic.Log - [P17660/T1/D42] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 1316 | Comment: PROCESSCALLBACK FUNCTION IS HERE
2016-06-08 16:28:54,386 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Sage Pay(CART-36241) - Process callback - Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary2 settings)
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary2 settings)
2016-06-08 16:28:54,407 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Form:
VPSProtocol : 3.00
TxType : PAYMENT
VendorTxCode : CART-36241
VPSTxId : {1C41B209-6F2D-B4FC-92B4-6C480A26E786}
Status : OK
StatusDetail : 0000 : The Authorisation was Successful.
TxAuthNo : 11164459
AVSCV2 : SECURITY CODE MATCH ONLY
AddressResult : NOTMATCHED
PostCodeResult : NOTMATCHED
CV2Result : MATCHED
GiftAid : 0
3DSecureStatus : NOTCHECKED
CardType : VISA
Last4Digits : 5559
VPSSignature : 4281D0DBFD48AD350627F7BF653774AB
Surcharge : 1.01
DeclineCode : 00
ExpiryDate : 1020
BankAuthCode : 999777
2016-06-08 16:28:54,407 [47] INFO umbraco.BusinessLogic.Log - [P17660/T1/D42] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 1316 | Comment: PROCESSCALLBACK FUNCTION IS HERE
2016-06-08 16:28:54,408 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Sage Pay(CART-36241) - Process callback - Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary2 settings)
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary2 settings)
From the code in the provider you can see that there is some if statements before the redirect url is set in line 233 and 244. This might indicate that something is wrong and the code is logging the error. So have a look in your Umbraco log files and see for things that starts with "Sage Pay(" as in line 251 and 254
Error 5006 - Sagepay
Using the Payment Provider (SagePay), I have a payment process completing, ending in the creation of a Transaction and an email confirmation but the page continues to display the Sagepay error 5006
The Callback is received from Sagepay (the param SagePayResponse response)
I can then retrieve the response properties (like TxAuthNo, AVSCV2 etc)
I then call response.GenerateSignature Then
TeaCommerce.Api.Web.PaymentProviders.CallbackInfo mycbi = mysp.ProcessCallback(TC.GetCurrentOrder(1), myreq, settings); This results in a Transaction ID and order.Finalize
At this point I try to redirect to the umbraco page but nothing happens.
What i am still unsure of is what httprequest object to use to pass to the ProcessCallback
The ProcessCallback indicates:
public override CallbackInfo ProcessCallback(Order order, HttpRequest request, IDictionary
So 2 questions:
Hi Stephen
I cant figure out if your are doing a custom provider that doesnt quite use the flow of a normal provider in Tea Commerce or if you use the standard in Tea Commerce. From my look at your question it looks like you are making a total custom one from scratch. For it to work properly with Tea Commerce you need to use its payment provider API to build a provider - else the flow will be totally wrong and hard to debug.
A callback in the SagePay case is a URL that their server calls server to server. The URL to call in your webshop is a "magic" Tea Commerce generated URL that does all the magic of finding which provider that shoudl make the checks etc is done in Tea Commerce core. The URL that is normally hit is the PaymentCallback REST method seen here: https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Web/RestExtensions.cs
That will route to the right provider and send the HTTP context as a parameter etc. So you dont need to think about this.
So could you try and let me know if you are using the TC payment provider API in the way it was thought to, or if your a haxing it? :-)
Kind regards
Anders
I am using https://github.com/TeaCommerce/Payment-providers/blob/master/Source/TeaCommerce.PaymentProviders/Classic/SagePay.cs
in my model
So my final page in the order process instantiates a new SagePay() object and
The Callback url (from Sagepay to website) goes to:
and all the other SagePay response properties THEN
(myreq is a url I have entered which I know is incorrect but this is where one of my questions relates)
Now it calls the PROCESSCALLBACK in the class SagePay : APaymentProvider
I then try to either redirect (umbracopage) or call another action (fails here)
So all of the above uses both the
in the SagePay payment provider.
and I have replicated the PaymentProvider class as a model in my project.
For now I do not make any call to
and I have not seen any documentation which indicates how this is used with the TeaCommerce Payment Providers/SagePay.cs
thanks
Hi Stephen
You should not do new SagePay(); and all that. You should use the Razor API of Tea Commerce. See how its done here. That will do all the magic with the continue url, cancel url, callback etc. So no need for you to do all this hard work :)
https://github.com/TeaCommerce/Starter-kit-for-Umbraco/blob/master/Source/Website/Views/CartStep4.cshtml
https://documentation.teacommerce.net/razor-api/payment-provider/generatepaymentform/
So when I use CartStep4 it generates the following form action:
which returns me to the Fail page
If you look in the code in line 155, it sets the cancel url to the action if something went wrong. It also logs it. So look in the Umbraco log files in the App_Data folder and see what the error message is. Should give you a clue about it.
https://github.com/TeaCommerce/Payment-providers/blob/master/Source/TeaCommerce.PaymentProviders/Classic/SagePay.cs
Nearly there. Everything works except Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.
In the back office I have tried both fully qualified url and relative url for both ContinueURL and CancelURL (also have SuccessURL and FailureURL)
In SagePay.cs I have tried hard coding lines 104-106 with full urls (I thought the NotificationURL was the RedirectURL)
Does the page which NotificationURL points to need to call a function in the SagePay Payment Provider to send a request back to SagePay?
Here is log
2016-06-08 16:28:54,385 [47] INFO umbraco.BusinessLogic.Log - [P17660/T1/D42] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 1316 | Comment: PROCESSCALLBACK FUNCTION IS HERE 2016-06-08 16:28:54,386 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Sage Pay(CART-36241) - Process callback - Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary
2.get_Item(TKey key) at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary
2 settings) System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary
2 settings) 2016-06-08 16:28:54,407 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Form:VPSProtocol : 3.00 TxType : PAYMENT VendorTxCode : CART-36241 VPSTxId : {1C41B209-6F2D-B4FC-92B4-6C480A26E786} Status : OK StatusDetail : 0000 : The Authorisation was Successful. TxAuthNo : 11164459 AVSCV2 : SECURITY CODE MATCH ONLY AddressResult : NOTMATCHED PostCodeResult : NOTMATCHED CV2Result : MATCHED GiftAid : 0 3DSecureStatus : NOTCHECKED CardType : VISA Last4Digits : 5559 VPSSignature : 4281D0DBFD48AD350627F7BF653774AB Surcharge : 1.01 DeclineCode : 00 ExpiryDate : 1020 BankAuthCode : 999777
2016-06-08 16:28:54,407 [47] INFO umbraco.BusinessLogic.Log - [P17660/T1/D42] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Debug | User: 0 | NodeId: 1316 | Comment: PROCESSCALLBACK FUNCTION IS HERE 2016-06-08 16:28:54,408 [47] ERROR TeaCommerce.Umbraco.Configuration.Infrastructure.Logging.LoggingProvider - [P17660/T1/D42] Sage Pay(CART-36241) - Process callback - Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary
2.get_Item(TKey key) at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary
2 settings) System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at NorthAyrshire.Models.SagePay.ProcessCallback(Order order, HttpRequest request, IDictionary
2 settings)thanks
Check the DB. Does your order have a custom property named teaCommerceContinueUrl or teaCommerceCancelUrl?
Yes there is an entry for both in [TeaCommerce_CustomOrderProperty] called teaCommerceCancelUrl and teaCommerceContinueUrl
with a fully qualified url ending in .aspx
From the code in the provider you can see that there is some if statements before the redirect url is set in line 233 and 244. This might indicate that something is wrong and the code is logging the error. So have a look in your Umbraco log files and see for things that starts with "Sage Pay(" as in line 251 and 254
Kind regards
Anders
Excellent got it working. Many thanks
Hi Stephen
SUPER! Could you try an elaborate what was wrong and how you fixed it. I could help others in the same situation in the future :)
is working on a reply...