diff --git a/SQL/site_data.sql b/SQL/site_data.sql index 3eb7e9b..cc1e6b1 100644 --- a/SQL/site_data.sql +++ b/SQL/site_data.sql @@ -158,15 +158,76 @@ A Professional Website service utilizing AI tools offers a comprehensive solutio 8. **Maintenance and Support**: Many services offer ongoing support and automatic updates using AI to monitor site performance, ensuring that the website runs smoothly and is protected against threats. By leveraging these AI tools, the Professional Website service can deliver not only visually appealing and functional websites but also enhance user engagement, improve operational efficiency, and drive growth for businesses. ' +);details + +INSERT INTO products_details (product_id,details) VALUES ('A000002',' +

Elevate your online presence with a professional website service powered by cutting-edge AI tools. This all-inclusive solution empowers individuals and businesses to create a dynamic and impactful digital footprint. Key features of this service include powerful content generation, strategic SEO optimization, insightful analytics, personalized experiences, and much more. +

+Experience the transformative potential of a robust online platform that drives engagement and success!

' ); +INSERT INTO products_details (product_id,details) VALUES ('A000001', ' +

Establishing a powerful online presence is crucial in todays digital landscape. Our platform empowers you to effortlessly organize and manage every aspect of your website. +

+With our cutting-edge features, you will benefit from advanced SEO optimization that drives traffic, comprehensive analytics that provide valuable insights, and tailored experiences that engage your audience like never before. +

+Transform your online presence with us and unlock your full potential!

'); + +INSERT INTO products_details (product_id,details) VALUES ('A000003', ' +

Unlock your potential with your personalized sharing forum. We handle the platform management, allowing you to focus on impactful outreach and communication. Utilize our powerful tools to significantly expand your audience and amplify your message. +

+We are here to support you every step of the way in achieving your goals.

'); + + +INSERT INTO products_details (product_id,details) VALUES ('A000004', ' +

Elevate your business online presence by launching an engaging forum where you can exchange ideas and information with your users. This forum will not only foster meaningful interactions but also serve as a vital point of connection for your clients. +

+We partner with you to implement automated engagements, streamline appointments, create valuable links, and much more, ensuring a seamless experience that drives your success.

'); + +INSERT INTO products_details (product_id,details) VALUES ('A000005', ' +

OpenEMR is the most popular open source electronic health records and medical practice management solution. OpenEMR is a community of passionate volunteers and contributors dedicated to guarding OpenEMR status as a free, open source software solution for medical practices with a commitment to openness, kindness and cooperation. +

+Activate to deploy OpenEMR for your practice +

+URL: https://www.open-emr.org/

'); + + + + + +UPDATE products_details SET details = ' +

Elevate your online presence with a professional website service powered by cutting-edge AI tools. This all-inclusive solution empowers individuals and businesses to create a dynamic and impactful digital footprint. ' || + ' +Experience the transformative potential of a robust online platform that drives engagement and success!

' +WHERE product_id = 'A000002'; + + + + +INSERT INTO products_details (product_id,details) VALUES( +'A000001', +' +A Professional Website service utilizing AI tools offers a comprehensive solution for individuals and businesses looking to establish a robust online presence. Here are some key features typically included in such a service' +); + + UPDATE products_details SET sale_text = '

-Get started for free for 6 months, and add features to your product as needed. cancel anytime +Start free for 6 months, and customize your product with additional features as you see fit. You''re in control-you can cancel anytime.

'; +merms_panel=# select product_id,description from products; + product_id | description +------------+---------------------------------------------- + A000002 | Your healthcare practice online presence + A000001 | Your personal professional web presence + A000003 | Blog to share your health care view + A000004 | Booster your practice with engaging contents + A000005 | Get Open EMR for practice management +(5 rows) + CREATE TABLE members_products ( @@ -339,6 +400,18 @@ CREATE TABLE subscription_options_items ( ADD CONSTRAINT subscription_options_items_id_key UNIQUE (id); +CREATE TABLE payments ( + id SERIAL, + uid uuid DEFAULT uuid_generate_v4(), + option_name VARCHAR(100) REFERENCES subscription_options(option_name), + description VARCHAR(100) NOT NULL, + list_order INT DEFAULT 0, + status INT DEFAULT 1, + added timestamp without time zone DEFAULT now() + ); + ALTER TABLE ONLY payments + ADD CONSTRAINT payments_id_key UNIQUE (id); + diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 108e3ba..833f6e3 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -149,7 +149,15 @@ def myproduct_refresh(): response = ProductsService.myproduct_refresh_request(data) return response -# +@api.route("/panel/account/products/templates", methods=["POST"]) +# @token_required +def get_myproduct_templates(): + # Call the Template service + data = request.get_json() + logger.info(f"Route Product Template Data ==>>>> {data}") + response = MyProductsService.mpproduct_template_data(data) + return response + @api.route("/panel/contacts", methods=["POST"]) def merms_contacts(): data = request.get_json() diff --git a/app/api/services/myproduct.py b/app/api/services/myproduct.py index 847d891..38b06c6 100644 --- a/app/api/services/myproduct.py +++ b/app/api/services/myproduct.py @@ -21,6 +21,30 @@ class MyProductsService(BaseService): def process_provision_actions(data): pass + @staticmethod + def mpproduct_template_data(): + # class MyProductSchema(Schema): + # token = fields.Str(required=True) + # uid = fields.Str(required=True) + # product_id = fields.Str(required=True) + + template_data = { + 'template_16' : { 'title': 'Template Name-16', 'template_id': '02af24fd-2b1a-46ed-af21-87018e726408', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_22' : { 'title': 'Template Name-22', 'template_id': '8b296894-42e4-4f2e-abd1-7c2a38d6e07b', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_47' : { 'title': 'Template Name-47', 'template_id': 'ef2ffa1c-9272-42cd-9d33-0e614047b4f8', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_25' : { 'title': 'Template Name-25', 'template_id': 'b3a7ba31-dc47-4a40-a5cc-fd1ff27d6b78', 'banner': 'file-icon/svg.png', 'active': '1' }, + 'template_49' : { 'title': 'Template Name-49', 'template_id': '60959c69-6672-4f69-a006-eeb7d210e605', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_27' : { 'title': 'Template Name-27', 'template_id': 'e4acb98a-c584-45f2-bece-af677dcf0a1f', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_51' : { 'title': 'Template Name-51', 'template_id': '975ee42e-3169-4978-92d7-d28e7e2ac014', 'banner': 'file-icon/svg.png', 'active': '0' }, + 'template_9' : { 'title': 'Template Name-9', 'template_id': 'fc8f0738-6500-4775-9895-2047cd275302', 'banner': 'file-icon/svg.png', 'active': '0' }, + } + + response_data = { + "templates": template_data, + "last_update": datetime.datetime.utcnow(), + } + return ResponseHelper.success(data=response_data) + @staticmethod def process_provision(data): try: @@ -232,7 +256,7 @@ class MyProductsService(BaseService): product_subscription_external_url = '' product_subscription_internal_url = '' product_data = Products.get_product_by_product_id(product_id) - product_description = ProductsDetails.get_product_details_with_product_id('A000002') + product_description = ProductsDetails.get_product_details_with_product_id(product_id) productDataStatus = product_data.status memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id) @@ -304,7 +328,7 @@ class MyProductsService(BaseService): product_subscription_uid = '' product_data = Products.get_product_by_product_id(product_id) - product_description = ProductsDetails.get_product_details_with_product_id('A000002') + product_description = ProductsDetails.get_product_details_with_product_id(product_id) productDataStatus = product_data.status memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id) diff --git a/app/api/services/subscription.py b/app/api/services/subscription.py index acfc1c0..c02640f 100644 --- a/app/api/services/subscription.py +++ b/app/api/services/subscription.py @@ -160,6 +160,12 @@ class SubscriptionService(BaseService): priceId = validated_data.get('priceId') member_data = Members.get_member_by_uid(uid) member_id = member_data.id + option_name = validated_data.get('option_name') + sub_option = SubscriptionOptions.get_subscription_options_by_option_name(option_name) + + if sub_option is None: + logger.error(f"Invalid Option Name") + return [] stripe_session = StripeIntegration.create_checkout_session_subscription(priceId, customerId) logger.info(f"Inside Stripe_Session ===== : {stripe_session}") diff --git a/app/models/members_products.py b/app/models/members_products.py index e020f23..e5ff613 100644 --- a/app/models/members_products.py +++ b/app/models/members_products.py @@ -41,7 +41,6 @@ class MembersProducts(db.Model): back_populates="members_products", ) - @classmethod def get_member_productlist_by_member_id(cls, member_id): member_products = cls.query.filter_by(member_id=str(member_id)) @@ -73,13 +72,6 @@ class MembersProducts(db.Model): @classmethod def create_subscription(cls, member_id ,product_id,status,internal_url): - # Create the subscription - ''' - merms_panel=# select * from members_products; - id | uid | member_id | product_id | internal_url | external_url | dns_group | status | added | updated - ----+-----+-----------+------------+--------------+--------------+-----------+--------+-------+--------- - (0 rows) - ''' dns_group = "DNS_G01" logger.info(f" Data for Subscription Data {member_id} ,{product_id} ,{status}, {internal_url} ") subscription = cls( diff --git a/app/models/subscription_options.py b/app/models/subscription_options.py index d616a9a..19dcb7a 100644 --- a/app/models/subscription_options.py +++ b/app/models/subscription_options.py @@ -26,6 +26,14 @@ class SubscriptionOptions(db.Model): return None return sub_options + @classmethod + def get_subscription_options_by_option_name(cls, option_name): + sub_options = cls.query.filter_by(option_name=option_name).all() + if not sub_options: + return None + return sub_options + + @classmethod def set_stripe_product_id(cls,package_uid, stripe_product_id): # Retrieve