Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 12:54
    Bex
    0

    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

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 13:02
    Anders Burla
    0

    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

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 13:08
    Bex
    0

    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


     

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 13:16
    Anders Burla
    0

    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?

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 13:24
    Bex
    0

    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!

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 13:26
    Anders Burla
    0

    Could you try and change the payment provider to the "Tea Commerce default" and see if that finalizes the orders and fires your event

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 13:33
    Bex
    0

    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?

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 13:42
    Anders Burla
    0

    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?

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 13:53
    Bex
    0

    Ok, I'm looking in my orderline properties and I have this:

    ctl00$ctl00$ctl00$ContentPlaceHolderDefault$main$SubmitProperty_1$chkTerms

    in an alias and then in another row I have 

    "__EVENTTARGET" in an alias and 

    ctl00$ctl00$ctl00$ContentPlaceHolderDefault$main$SubmitProperty_1$lnkSubmit

    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:

     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!) 

    All that page has on it is:

        function TermsChecked(oSrc, args) {
            var checkbox = document.getElementById('<%=chkTerms.ClientID %>');
            if (checkbox.checked) {
                args.IsValid = true;
            } else {
                args.IsValid = false;
            }
        }
    
    
    </script>
    
    <label>
        Select a type</label>
    <asp:Repeater ID="rptTyoes" runat="server">
        <ItemTemplate>
            <input type="radio" name="types" value='<%# Eval("NodeId") %>' />
            <%#Eval("ProductName") %><br />
            <%#Eval("description") %><br />
            <%#Eval("ProductPrice") %>
        </ItemTemplate>
    </asp:Repeater>
    
    <br /><br />
    <label>
        I accept the <a href='javascript:window.open("/terms.aspx")'>terms and conditions</a></label>
    <asp:CheckBox ID="chkTerms" runat="server" /><asp:CustomValidator ID="cvChecked" runat="server" ValidationGroup="Submit" Text="*" ClientValidationFunction="TermsChecked" OnServerValidate="cvChecked_ServerValidate"></asp:CustomValidator><br />
    <asp:LinkButton ID="lnkSubmit" runat="server" Text="Next" OnClick="lnkSubmit_Click" ValidationGroup="Submit"></asp:LinkButton>
    
    I can't see that any of that should fire any javascript and add anything else?
  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 02, 2011 @ 14:13
    Rune Grønkjær
    0

    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

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 14:19
    Bex
    0

    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?

     

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 02, 2011 @ 14:23
    Rune Grønkjær
    0

    You do something like this:

    order.CreateOrderLine(nodeId, quantity)

    And then you can add other stuff to the order line. Still remember to call order.Save()

    /Rune

     

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 14:39
    Bex
    0

    Hi Rune (sorry just noticed not Anders)

    Sorry I am getting exactly the same!

    How are orderlineproperties added? What should I be looking for?

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 14:45
    Anders Burla
    0

    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?

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 14:49
    Bex
    0

    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)

     

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 15:08
    Anders Burla
    0

    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 :)

  • Bex 444 posts 555 karma points
    Nov 02, 2011 @ 15:27
    Bex
    0

    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 :)

  • Anders Burla 2560 posts 8256 karma points
    Nov 02, 2011 @ 15:30
    Anders Burla
    0

    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 :)

Please Sign in or register to post replies

Write your reply to:

Draft