You would probably program to an interface, meaning both your FreeContent and PayedContent will implement a Content class. This way you retain the logic/methods, but each unique class will return it's own values.
Purchaseable model that can be free. Best implementation?
Hey,
I am creating a website where people can purchase access to videos, some videos however can be free. In cases where the video is free, I don't want the purchase form to appear.
I can implement this, but I want to use good design patterns so I can improve.
Right now I have the Video as a vue-component. Should the vue-component be responsible for checking the price (if price = 0 then just register, otherwise purchase). And lastly, would you send up two endpoints for these situations (purchase and register) or just have one single endpoint (register) that can be posted to with/without a Stripe token depending on if the video is free or not?
I guess what I am looking for are some design principles for this, as I don't want my website to turn into complete spaghetti.
Thanks in advance
Please or to participate in this conversation.