Hello everyone, I have a product that I want to improve, and I already have an official NOP web API plugin. My goal is to add the ability to search for products by SKU and add multiple products at once using new methods. I want to achieve this without modifying any NOP core codes, even if it's the NOP official plugin. Therefore, I added a new plugin to extend the capabilities of the current API plugin.
The official plugin already has a method for adding products to the cart using product ID, called "AddProductToCartFromDetails". It looks like this:
AddProductToCartFromDetails([FromBody] IDictionary<string, string> dictionary, int productId, [FromQuery, Required] ShoppingCartType shoppingCartType)
To achieve my goal, I wrote a new method called "AddProductToCartFromDetailsBySku". It looks like this:
AddProductToCartFromDetailsBySku([FromBody] IDictionary<string, string> dictionary, string sku, [FromQuery, Required] ShoppingCartType shoppingCartType)
I believe that it would be more secure to find products by SKU and then call the official API plugin methods. Do you agree? If so, what would be the best way to do this? Should I use HttpClient calling or reflection, or is there another suggestion you would make?