I hope you're not sick of me yet! My request now is rather simple though; I am trying to create a rule to send an email once a payment is captured. I am not sure what event to use to fire off the email.

My first instinct was the "When an order is first paid in full" but that one didn't work.

I also thought of using "After updating an existing commerce payment transaction" with a condition that checks for capturing but I haven't been able to find a good condition for it. I may have to pop into the PHP evaluation.

Thanks!
-joe

Comments

maciej.zgadzaj’s picture

Now that's gonna be fun.

To start with - "When an order is first paid in full" is exactly the event you want. And I'd say that with your normal configuration it will work fine. And by "normal configuration" I mean the same currency code being used by site and by the gateway. But when you changed gateway to CA, which uses different currency than US, then things went south.

What exactly happens: each Moneris gateway supports only one currency: USD and CAD respectively. When a request is sent to their API, there is no currency code in it at all. It's just assumed to be default currency.
Now, the module has the code in it which checks if the order(=site) currency is the same as gateway currency, and if not - it converts the amount from order/site currency to gateway currency. Which is good in terms of sending the correct amount, but doesn't work so well for checking the order balance later on, on which mentioned "When an order is first paid in full" rule is based.
Essentially, commerce_payment_order_balance() returns value only if all payment transactions for the order use the same currency and it has to be the same currency as the one for order_total. If that's not the case, commerce_payment_order_balance() returns null, and the rule does not get fired.

And that's probably your case - I'd guess you have site and products set up in USD, so when you changed gateway to CA it stopped working. Changing it back to US should make it work again.

But then again, it still needs either a better solution, or a better documentation...

maciej.zgadzaj’s picture

Category: Support request » Bug report
Status: Active » Fixed

Ok, I have removed the currency conversion completely in the most recent commit, it wasn't really a very good idea after all.

Instead I have added errors being returned when the order currency is different from specific gateway currency (as we shouldn't really allow for such payment transactions to be made).

Which also means that if the payment transaction is completed successfully, the "When an order is first paid in full" rule should fire ok now.

Just pushed to d.o., you might want to give the most recent 2.x-dev version a try?

joegl’s picture

I'm currently still in the beta version but I want to confirm that the Event "When an order is first paid in full" fires on capturing and does not fire during pre-auth so it works great for our current project! Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.