Copied to clipboard

Flag this post as spam?

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


  • Nigel Wilson 945 posts 2077 karma points
    Sep 26, 2012 @ 02:05
    Nigel Wilson
    0

    Trouble Triggering Event on PaymentStatusChanged

    Hi there

    Am loving Tea Commerce package.

    I am setting up a site with no payment provider, simply purchases "on account". 

    I need to trigger an event when an order is completed and so have the following code:

    public class events : ITeaCommerceExtension
    {
    public void Initialize()
    {
    WebshopEvents.PaymentStatusChanged += WebshopEvents_PaymentStatusChanged;
    }
    protected void WebshopEvents_PaymentStatusChanged(Order order, PaymentStatus? paymentStatus, APIInfo apiInfo)
    {
    if (paymentStatus.HasValue && order.PaymentStatus.Value.ToString() == "Authorized")
    {
    generateXMLFileofOrder(order);
    }
    }
            protected void generateXMLFileofOrder(Order order)
    {
    ... do stuff here ...
    }
    }

    The problem I have is that I can output a value for order.PaymentStatus.Value.ToString(), however when checking in the if statement above it fails.

    Can anyone enlighten as to how to check when the order is authorized.

    Ideally I also want to check the order status too as I only want to run the event once per order.

    Thanks, Nigel

     

Please Sign in or register to post replies

Write your reply to:

Draft