Question Which is called first?

benFF

Customer
I'm working with custom serial numbers that are generated by an external system.

I had planned to use the "dbtech_ecommerce_license_purchase" event listener to hook in at that point and simply update the SerialKey::serial_key field.

However, I now notice that an email is sent in key.php (sendPaymentReceipt) that includes the serial in it.

I just want to confirm that 'dbtech_ecommerce_license_purchase' is fired before sendPaymentReceipt?

thanks!
 
Indeed that event should fire before the payment receipt is sent :)

dbtech_ecommerce_license_purchase fires inside public function complete(): bool which is triggered in public function completePurchase(CallbackState $state) which is again triggered by public function completeTransaction(CallbackState $state)

PHP:
            case CallbackState::PAYMENT_RECEIVED:
                $purchasableHandler->completePurchase($state);
                try
                {
                    $purchasableHandler->sendPaymentReceipt($state);
                }
                catch (\Exception $e)
                {
                    \XF::logException($e, false, "Error when sending payment receipt: ");
                }
                break;
 
Does the email only fire if an actual payment is made?

I'm using a 100% discount code and not getting an email for either the purchase or the serial key.
 
I did wonder about that which makes sense, however I think the serial key email should still be sent out whether a payment is made or not.
 
The serial key will be accessible from their license area, which I believe they’re immediately redirected to, so it’s not that big of a deal IMO.
 
The serial key will be accessible from their license area, which I believe they’re immediately redirected to, so it’s not that big of a deal IMO.
It doesn't - it just directs to the "shop/account" page.

You then have to click "my licenses" and see it that way - it's pretty confusing, as if you just click the order it doesn't give any license information.

I am getting around this by using the welcome email function to direct people to /shop/licenses.

But it's very convoluted.

If there could be a {serialKey} placeholder available, that would be useful.
 
It's even worse on mobile as there's no sub-menu at the top, so unless you knew what to do, you'd have no way to get to the serials.
 
The serial key will be accessible from their license area, which I believe they’re immediately redirected to, so it’s not that big of a deal IMO.
Ah ok, so if you pay with a 100% discount coupon, you get redirected to the orders page.

But yes, if you make a payment you do get redirected to the licenses page.
 
I’ll look into that to see if there’s anything I can change there. As I recall, it’s intended for the product type of the order to determine the redirect. Orders containing physical products should redirect to Orders page.

There’s likely room for improvement as that functionality was designed before additional product types were added.
 
I’ll look into that to see if there’s anything I can change there. As I recall, it’s intended for the product type of the order to determine the redirect. Orders containing physical products should redirect to Orders page.

There’s likely room for improvement as that functionality was designed before additional product types were added.
Thank you - I do still think the serial email (dbtech_ecommerce_purchase_alert_key) should be sent either way, because that is important for customer records.

I also include instructions in that email on how to use the actual key, which doesn't work with the welcome email, as I can't list the serial in it.
 
I'm making the following improvements for v4 for XenForo 2.3:
  • Checkout with an order total of 0.00 will now follow the same redirect rules as a normal order
    • If the order contains at least one Physical product, it will redirect to /dbtech-ecommerce/account/order/<orderId>/
    • Otherwise, it will redirect to /dbtech-ecommerce/licenses/
  • $purchaseRequest in the ProductType's sendPaymentReceipt function can now be null
    • This might affect your custom integration; null indicates the order was completed via the AdminCP or as a free order.
  • When an order is completed via the AdminCP or as a free order, purchase alerts (dbtech_ecommerce_purchase_alert_<productType>) will be sent.
 

DragonByte eCommerce

XenForo 2.0.6+ XenForo 2.1.x XenForo 2.2.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
2,479
Customer rating
4.83 star(s) 6 ratings
Back
Top