gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
179 stars 134 forks source link

Order and Transaction related webhooks not working #2612

Open dominiquemariano opened 7 months ago

dominiquemariano commented 7 months ago

Reproduction Steps

  1. Under LifterLMS > Settings > REST API > Webhooks create a new webhook with Topic set to "Order created" (webhook.site or other webhook testing site can be used to capture, for the Delivery URL)
  2. Create an order by doing a real or test purchase
  3. View the webhook log

Expected Behavior

You should get payload for the Order created topic.

Actual Behavior

Getting a rest_no_route error

{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method.",
  "data": {
    "status": 404
  }
}

This issue has be recreated:

brianhogg commented 7 months ago

The webhooks attempt to get the data for the webhook using the resource and action (ie. order and created). This translates to /llms/v1/orders/<order id> which is not currently an endpoint in our REST API. So we'll need to add an orders endpoint to get this working.

brianhogg commented 7 months ago

This also applies to any order-related webhook since there's no orders endpoints at all.

Same with transactions. I edited the title to include both. If we can add both at once great, otherwise we'll split this into two issues later.