Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
353 stars 102 forks source link

Feature: Manually map a webhook to a dispatchable class #127

Closed ClaraLeigh closed 1 year ago

ClaraLeigh commented 1 year ago

Description

To allow for different project structures, I wish to allow developers to manually map their webhook to a specific class.

Changes

To be able to use the feature, you need to change the webhooks config array to use an associate array where the key is the $type variable derived from the wehbook url.

For example:

'webhooks' => [
    'orders-create' => [
        'topic' => 'ORDERS_CREATE',
        'address' =>'https://some-app.com/webhook/orders-create',
        'class' => \App\Shopify\Actions\AppUninstalledJob::class
    ]
]

Where $type comes from https://some-app.com/webhook/ orders-create

Notes

Kyon147 commented 1 year ago

@ClaraLeigh thanks for submitting this PR - it's a fair point to allow more granular control on how the class names for jobs.

Two things can you add:

Thanks very much!

ClaraLeigh commented 1 year ago

@Kyon147 Those changes should be made now. Let me know if you need anything more for this

Kyon147 commented 1 year ago

@ClaraLeigh thanks for updating! Will take a look this week and get it merged in - I'll create a minor release as there is a couple other small fixes in master too.