md-systems / commerce_giftcard

2 stars 1 forks source link

Make GiftCardType a bundle plugin #1

Open mglaman opened 4 years ago

mglaman commented 4 years ago

Perhaps we should make GiftCardTypes a bundle plugin. This would help us integrate with third-party gift card providers to manage balances. This would work the same way as PaymentType and PaymentMethodTypes.

This could help @eiriksm. Not 100% sure how, but it makes it more feasible to extend the gift card system. And I'm not sure how many gift card types there would be to warrant making it a config entity

Berdir commented 4 years ago

Not against the idea, but I'm also not sure what the benefit exactly would be.

The plugin bundle thing is neat if you actually have plugins that do something. Right now, the only thing that can be controlled through the type is generate code settings (of which there is currently on the length but that can be extended). I suppose that could be moved to the plugin, but you'd still need basic settings then and a place to store them for something as simple as the length of your generated gift card codes?

I know that the client of my client has at least a few different types, although theoretically they could also have their own type/category system using a term field or so. I don't think something like that existed in D7 either.

I would expect that most third party integrations are basically about exporting/importing coupon codes, that's just standard entity API through custom endpoints, json API or whatever. Export can just as well listen on entity crud hooks/events and importing can't go through a plugin, as you need something to create the entity in the first place, needs to come from "the outside".

And not sure how plugins would be involved in the checkout process. One part that still needs to be improved is validation/conditions to control for what giftcards can be used, not sure yet if I can use the commerce condition system on a config entity but a plugin wouldn't really make it easier unless you want to hardcode all the conditions and again, an event would work for that too.

eiriksm commented 4 years ago

I feel pretty confident I can achieve what I want from swapping services and classes, and would probably prefer that over bundle plugins. We can have this issue open if someone else wanted that though? :smile:

Thanks again for making this available by the way @Berdir , awesome work!

mglaman commented 4 years ago

Okay, sounds fine to me. I'm in general against using config entities for bundles lately (just easier, less screens).