WebshopEvents_AfterOrderFinalized doesn't seem to be firing
Hi
I have subscribed to the WebshopEvents_AfterOrderFinalized event, but it never seems to be firing? At what point should the code run? I need it to run once paypal has confirmed payment.
The event is fired when the order is finalized = when we recieve a callback from the payment provider. So the first check is to see if your orders gets finalized and has the status of authroized or captured? If not the callback isnt getting to the server. Then you will have to check if paypal makes the IPN to your server.
If the order status is captured then your website recieves the IPN from Paypal. Did you just compile your code with the event hook and put the dll in the bin folder?
MESSAGE: Exception has been thrown by the target of an invocation. STACKTRACE: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at TeaCommerce.Presentation.TeaCommerceBase.RequestModule.invokeMethod(restExtension myExtension, Object[] paras) INNEREXCEPTION: System.Xml.XmlException: The '$' character, hexadecimal value 0x24, cannot be included in a name. at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType) at System.Xml.Linq.XName..ctor(XNamespace ns, String localName) at System.Xml.Linq.XNamespace.GetName(String localName) at System.Xml.Linq.XName.Get(String expandedName) at TeaCommerce.Data.OrderProperty.GetXElement() at TeaCommerce.Data.OrderLine.b__d(OrderLineProperty i) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at TeaCommerce.Data.OrderLine.GetXElement() at TeaCommerce.Data.Order.b__68(OrderLine i) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at System.Xml.Linq.XContainer.Add(Object content) at TeaCommerce.Data.Order.GetXElement() at TeaCommerce.Data.Order.UpdateOrdersXmlCache() at TeaCommerce.Data.Order.Save() at TeaCommerce.Data.Order.Finalize(CallbackInfo callbackInfo) at TeaCommerce.Base.PaymentCallback(String alias, String encryptedOrderId) at TeaCommerce.Base.PaymentContinue(String alias, String encryptedOrderId)
That would probably explain it.. but why am I getting an error?
Where is it finding a "$" character as I can't see it in the names of any of my documents?
If you find the order in your database and look at the order properties and orderline properties for the orderlines in this order. Does any of them has a $ in the Alias or Value?
I assume this is where they are coming from, but how do things get in the orderline properties?
Both the controls listed are on a page where I am creating and adding the first item to an order like this in c# code:
TeaCommerce.Base.OverwriteQuantity(mynodeId, 1);
(I know this way is probably not quite how you intended but the reason I am doing it in c# is that a lot of checks need to be made before the item gets added to the basket and it has to be added before they can continue!)
The Tea Commerce Base is only for the javascript API, not for use in .NET. I fyou want to change the quantity of an orderline you will have to go through the Tea Commerce .NET API. You get the order throught the TeaCommerce.SessionController class, find the order line and manipulate that. When your'e done you call Save() on the order.
The problem now is that you already has orderlines in your DB with the $ in the property alias. So you need to clean your orderlines that has those properties so Tea Commerce will be able to generate the finalized orders xml. This method is ed event is fired - and because it fails - your code never gets called. Makes sende?
And you dont use the TeaCommerec.Base methods anymore? Because they are the ones that creates the orderline properties.
And you remembered to delete them in both the DB and then right click the Order node in Tea Commerce and click "Refresh order XML". Then double check if the xml in /app_tata/teaCommerce/orders.xml is empty. The try again :)
Right.. I wasn't telling it to refresh the xml, and when I tried it threw the error, so I deleted it manually amd refreshed everything!
Now it's working! yaaay!
May just be me, but maybe the documentation needs tweaking slightly, maybe a list of methods available with the .net api, kind of like the javascript api overview? I can't be the only one who it relying on intellisense and picking the wrong bits!
Your right - documentation could need an upgrade - but its always the problem to find the time to do it, while you still have to earn some money on other projects - But documentation will be better in the future :)
WebshopEvents_AfterOrderFinalized doesn't seem to be firing
Hi
I have subscribed to the WebshopEvents_AfterOrderFinalized event, but it never seems to be firing?
At what point should the code run? I need it to run once paypal has confirmed payment.
Should I be using another event?
Bex
Hi Bex
The event is fired when the order is finalized = when we recieve a callback from the payment provider. So the first check is to see if your orders gets finalized and has the status of authroized or captured? If not the callback isnt getting to the server. Then you will have to check if paypal makes the IPN to your server.
/Anders
Hi!
The order is coming back and the status of the payment is captured.
How does teacommerce get the success/declined back if it's not by IPN?
Is there a specific url I need to stick in the sandbox to test the IPN? I assume it's an internal teacommerce one?
Bex
If the order status is captured then your website recieves the IPN from Paypal. Did you just compile your code with the event hook and put the dll in the bin folder?
Yep.. all compiled and in the bin folder and I have a WebshopEvents_OrderCreated event in the same file and that fires..
I am writing it to the umbraco log!
Could you try and change the payment provider to the "Tea Commerce default" and see if that finalizes the orders and fires your event
I get this:
MESSAGE: Exception has been thrown by the target of an invocation.
STACKTRACE: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig,
MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at TeaCommerce.Presentation.TeaCommerceBase.RequestModule.invokeMethod(restExtension myExtension, Object[] paras) INNEREXCEPTION: System.Xml.XmlException: The '$' character, hexadecimal value 0x24, cannot be included in a name.
at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType) at System.Xml.Linq.XName..ctor(XNamespace ns, String localName) at System.Xml.Linq.XNamespace.GetName(String localName) at System.Xml.Linq.XName.Get(String expandedName) at TeaCommerce.Data.OrderProperty.GetXElement() at
TeaCommerce.Data.OrderLine.b__d(OrderLineProperty i) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at TeaCommerce.Data.OrderLine.GetXElement() at TeaCommerce.Data.Order.b__68(OrderLine i) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at System.Xml.Linq.XContainer.Add(Object content) at TeaCommerce.Data.Order.GetXElement() at TeaCommerce.Data.Order.UpdateOrdersXmlCache() at TeaCommerce.Data.Order.Save() at TeaCommerce.Data.Order.Finalize(CallbackInfo callbackInfo) at TeaCommerce.Base.PaymentCallback(String alias, String encryptedOrderId)
at TeaCommerce.Base.PaymentContinue(String alias, String encryptedOrderId)
That would probably explain it.. but why am I getting an error?
Where is it finding a "$" character as I can't see it in the names of any of my documents?
If you find the order in your database and look at the order properties and orderline properties for the orderlines in this order. Does any of them has a $ in the Alias or Value?
Ok, I'm looking in my orderline properties and I have this:
in an alias and then in another row I have
"__EVENTTARGET" in an alias and
in dataNtext.
I assume this is where they are coming from, but how do things get in the orderline properties?
Both the controls listed are on a page where I am creating and adding the first item to an order like this in c# code:
(I know this way is probably not quite how you intended but the reason I am doing it in c# is that a lot of checks need to be made before the item gets added to the basket and it has to be added before they can continue!)
All that page has on it is:
Hi Bex,
The Tea Commerce Base is only for the javascript API, not for use in .NET. I fyou want to change the quantity of an orderline you will have to go through the Tea Commerce .NET API. You get the order throught the TeaCommerce.SessionController class, find the order line and manipulate that. When your'e done you call Save() on the order.
/Rune
How do I just add an orderline then?
I only did he update quanity as this was how the javascript added the orderline in the example I had.
I need to do a lot of server side checking before the first order item can be added and afterwards.
For any extras it does it the normal way...
Am I just asking too much or am I going about it completely the wrong way?
You do something like this:
And then you can add other stuff to the order line. Still remember to call order.Save()
/Rune
Hi Rune (sorry just noticed not Anders)
Sorry I am getting exactly the same!
How are orderlineproperties added? What should I be looking for?
Hi Bex
The problem now is that you already has orderlines in your DB with the $ in the property alias. So you need to clean your orderlines that has those properties so Tea Commerce will be able to generate the finalized orders xml. This method is ed event is fired - and because it fails - your code never gets called. Makes sende?
I did! I cleared them all out! :( They recreate with the $'s when I add another! (although I am adding the same thing to the basket over and over)
And you dont use the TeaCommerec.Base methods anymore? Because they are the ones that creates the orderline properties.
And you remembered to delete them in both the DB and then right click the Order node in Tea Commerce and click "Refresh order XML". Then double check if the xml in /app_tata/teaCommerce/orders.xml is empty. The try again :)
Right.. I wasn't telling it to refresh the xml, and when I tried it threw the error, so I deleted it manually amd refreshed everything!
Now it's working! yaaay!
May just be me, but maybe the documentation needs tweaking slightly, maybe a list of methods available with the .net api, kind of like the javascript api overview?
I can't be the only one who it relying on intellisense and picking the wrong bits!
Thank you both! Will leave you in peace now :)
Your right - documentation could need an upgrade - but its always the problem to find the time to do it, while you still have to earn some money on other projects - But documentation will be better in the future :)
is working on a reply...