Triggers not working: Order Submitted, Payment Completed


(Emily) #1

Matrix Version: 5.5.2

Firstly, thank you in advance to those taking the time to read & help me. :slight_smile:

I am setting up a Trigger to move a User between user groups when they make a purchase. I have tried using the “Payment Completed” and the “Order Submitted” triggers (one or the other, not both at once!) but neither seem to trigger when I go through the checkout process and place an order. But the order is created as an asset in the “Completed Orders” folder of the Checkout, and the email-on-purchase is sent.

When I used the Payment Completed event, I had the Asset ID condition as the Payment Gateway (which is a Braintree Gateway).
When I used the Order Submitted event, I had the Asset ID condition as the Checkout asset.

No errors shown in the Error Log. The User is not moved / trigger is not fired. The System Log does show that there was an Order Completed…

[asset.attributes.scalar - assetid:74662;] (Asset Attribute Changed) - The value of attribute "status_message" for asset "Ecommerce Order #74662" has been changed from "Pending" to "Completed"

Am I using these Trigger Events wrong somehow?
When I change the trigger event to just be “user logs in”, the trigger works fine & moves the account logging in to the specified folder, so I do not think it is my Action that is problematic.
The trigger also has a condition “User is NOT public”, and I am always processing this with my testing account which is just a standard User type. The log also reflects that this was the user that triggered the Order.
Luke from Squiz has confirmed in another thread that the Payment Completed Event should work for Braintree Gateway.

Thank you for any suggestions or help :slight_smile:
Emily


(Emily) #2

Update:

Realised that I had the Condition of “Asset ID” even when using “Order Submitted”.
It seems “Order Submitted” needs a “Tree Location” instead, since the order is created BELOW it.

However, not sure what the Payment Complete needs? The manual indicated it was to be set to a specific Gateway I thought, which I assumed would then mean Asset ID (not Tree Location).

Can anyone confirm what the setting for Payment Completed should be?

In the mean time, Order Submitted will work fine.


(John gill) #3

I’m not familiar with the payment gateways, but looking at the code Payment Complete appears to be pulling the asset to fire the event on out of a session variable

if (isset($_SESSION['SQ_ECOM_PAYMENT_COMPLETED_BROADCASTER_ASSETID'])) {
		$broadcaster = $GLOBALS['SQ_SYSTEM']->am->getAsset($_SESSION['SQ_ECOM_PAYMENT_COMPLETED_BROADCASTER_ASSETID']);
		if (!empty($broadcaster)) {
		...
				$GLOBALS['SQ_SYSTEM']->broadcastTriggerEvent('trigger_event_ecommerce_payment_completed', $broadcaster);
		}
}

So the value of SQ_ECOM_PAYMENT_COMPLETED_BROADCASTER_ASSETID is the asset that the event is fired on, but I can’t find any code that ever sets that session var.

Presumably I’m missing something (PHP is not my bag) but based on a few greps it doesn’t look like that event ever fires :thinking: