The Opportunity Coseva is a multi-level marketing company focusing on wellness products. They needed an API integrated for WordPress that would allow distributor analytics and commissions to be recorded for marketing and sales purposes.
The Ask We broke down this project in 4 specific tasks or challenges.
Each of these issues were critical to the overall functionality of the site and the business goals of the company.
- Each individual distributor needed their own mini-portal and a way to access that portal via a URL like kelly.coseva.com.
- Managing the portal template to change data according to what distributor was being accessed.
- Managing session cookies for each distributor so that after visiting the distributor portal once and then leaving, the distributor would get credit for the sale even if the user accessed another portal.
- Changing the API from a PHP API integrated directly to a REST API to be used with secure AJAX calls
RESOLUTION In the end, we solved these using an object-oriented approach and used a plugin to interface with the WordPress system. We refactored the code to achieve the following:
- To create reusable code that will allow for quicker development cycles in the future.
- To separate different aspects of the code. We used an MVC(Model-View-Controller) Design. This design pattern allows cleaner code which results in faster development and lower development costs.
- To create less complicated code and loose coupling – when code gets unnecessarily mixed in with design and data structures it creates an unnecessary complexity that perpetuates itself and only grows more complex. When this happens, the smallest bug can cause the whole system to collapse. The goal is to compartmentalize each part of the code so that if one part fails it does not affect the system as a whole.
By refactoring the code were able to address each of the four challenges and make a solution that was not merely functional but scalable, secure, and reliable. It met all of the company needs and needs they didn’t even realize they had until we explained them to them.