Page 1 of 1

Modifying Triggers

Posted: Wed Mar 21, 2012 7:35 am
by simtay
Hi there I want to send a message to another web service when the payment captured.

Where do you think it is best to put my code and send a notification my web service when this trigger is fired? Where is the Payment Captured trigger? I cannot find it.

Thanks for your help

Re: Modifying Triggers

Posted: Wed Mar 21, 2012 7:42 am
by jmestep
Payment captured is based on your payement gateway settings- whether you have them set for authorize or authorize and capture. In most places, the best place I have found to do something special is on the receipt page because by then you know the payment status on the order. For example, I send special emails from there.

Re: Modifying Triggers

Posted: Wed Mar 21, 2012 7:55 am
by simtay
Yes I agree with the receipt page but sometimes receipt page wont be called.

When a customer use paypal for payment method customer might not be able to go to the receipt page. There is a trigger in email templates called "Payment was fully captured" where can I find this trigger in the code?

Can't I modify it?

Thanks a lot

Re: Modifying Triggers

Posted: Wed Apr 18, 2012 9:06 am
by mazhar
There can be two places. First either you do this in suitable payment form user control under Website/checkout/PaymentForms or you handle this in CheckedOut event handler of ConLib/OnePageCheckout.ascx.cs file. I think I will preffer CheckedOut event handler of OnePageCheckout.ascx.cs file becuase this event handler is already registered on all out of the box payment forms so I don't have to replicate the code in different payment forms but its up to you both locations can workout. So in CheckedOut event handler if checkout was a scuccess you may try doing something like

Code: Select all

if (response.Success)
{
            ..............................................
            ..............................................
            
            // LOAD NEWLY CREATED ORDER
            OrderDataSource order = OrderDataSource.Load(e.OrderId);
            if(order != null)
            {
                    // THE CODE TO NOTIFY YOUR CUSTOM SERVICE GOES HERE
            }
}