my product data
This commit is contained in:
+3
-3
@@ -49,7 +49,7 @@ ALTER TABLE members ADD profile_completed timestamp without time zone DEFAULT NU
|
|||||||
ALTER TABLE members ADD option_name VARCHAR(100) REFERENCES subscription_options(option_name);
|
ALTER TABLE members ADD option_name VARCHAR(100) REFERENCES subscription_options(option_name);
|
||||||
ALTER TABLE members ADD next_billing timestamp without time zone;
|
ALTER TABLE members ADD next_billing timestamp without time zone;
|
||||||
ALTER TABLE members ADD trial_end timestamp without time zone;
|
ALTER TABLE members ADD trial_end timestamp without time zone;
|
||||||
|
-- bALTER TABLE members ADD option_name VARCHAR(100) REFERENCES subscription_options(option_name);
|
||||||
|
|
||||||
CREATE TABLE members_profile(
|
CREATE TABLE members_profile(
|
||||||
id SERIAL,
|
id SERIAL,
|
||||||
@@ -317,7 +317,7 @@ ALTER TABLE members_products ADD primary_server VARCHAR(100);
|
|||||||
ALTER TABLE members_products ADD db_status INT DEFAULT 0;
|
ALTER TABLE members_products ADD db_status INT DEFAULT 0;
|
||||||
ALTER TABLE members_products ADD provision_status INT DEFAULT 0;
|
ALTER TABLE members_products ADD provision_status INT DEFAULT 0;
|
||||||
ALTER TABLE members_products ADD p_file INT DEFAULT 0;
|
ALTER TABLE members_products ADD p_file INT DEFAULT 0;
|
||||||
ALTER TABLE members_products ADD url_status INT DEFAULT 0
|
ALTER TABLE members_products ADD url_status INT DEFAULT 0;
|
||||||
|
|
||||||
|
|
||||||
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Personal Website','Your personal professional web presence',1,'A000001', 'banner.jpg');
|
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Personal Website','Your personal professional web presence',1,'A000001', 'banner.jpg');
|
||||||
@@ -496,7 +496,7 @@ ALTER TABLE payments_session OWNER TO merms_panel;
|
|||||||
-- added = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
-- added = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
||||||
-- updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
-- updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||||
|
|
||||||
ALTER TABLE members ADD option_name VARCHAR(100) REFERENCES subscription_options(option_name);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE payments (
|
CREATE TABLE payments (
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
from .transaction_type import TransactionType
|
from .transaction_type import TransactionType
|
||||||
from .loan_status import LoanStatus
|
from .loan_status import LoanStatus
|
||||||
|
from .settings_items_data import SettingsItemsData
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
from symtable import Class
|
||||||
|
|
||||||
|
class SettingsItemsData:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_settings_data():
|
||||||
|
data = {
|
||||||
|
"site_title": { "name": 'Title', "controls": 'TEXT', "active": True },
|
||||||
|
"site_description": { "name": 'Description', "controls": 'TEXTAREA', "active": True },
|
||||||
|
"site_logo_text": { "name": 'Logo Text', "controls": 'TEXT', "active": True },
|
||||||
|
"site_contact_email": { "name": 'Email', "controls": 'TEXT', "active": True },
|
||||||
|
"site_contact_phone": { "name": 'Phone', "controls": 'TEXT', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_social_settings_data():
|
||||||
|
data = {
|
||||||
|
"facebook": { "name": 'Facebook', "controls": 'TEXT', "active": True },
|
||||||
|
"twitter": { "name": 'Twitter', "controls": 'TEXT', "active": True },
|
||||||
|
"youtube": { "name": 'Youtube', "controls": 'TEXT', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_home_settings():
|
||||||
|
data = {
|
||||||
|
"banner_text": { "name": 'Banner Text', "controls": 'TEXT', "active": True },
|
||||||
|
"banner_description": { "name": 'Banner Description', "controls": 'TEXTAREA', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_footer_settings():
|
||||||
|
data = {
|
||||||
|
"footer_description": { "name": 'Footer Description', "controls": 'TEXTAREA', "active": True },
|
||||||
|
"boolean_footer_show_email": { "name": 'Show email in footer', "controls": 'SELECT_NO_YES', "active": True },
|
||||||
|
"boolean_footer_show_made_by": { "name": 'Show made by in footer', "controls": 'SELECT_NO_YES', "active": True },
|
||||||
|
"boolean_footer_show_socials": { "name": 'Show social in footer', "controls": 'SELECT_NO_YES', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_about_items():
|
||||||
|
data = {
|
||||||
|
"about_title": { "name": 'About Title', "controls": 'TEXT', "active": True },
|
||||||
|
"about_description": { "name": 'About Details', "controls": 'TEXTAREA', "active": True },
|
||||||
|
"about_extra_1": { "name": 'Extra About us', "controls": 'TEXTAREA', "active": True },
|
||||||
|
"about_extra_2": { "name": 'More About us', "controls": 'TEXTAREA', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_site_contact_items():
|
||||||
|
data = {
|
||||||
|
"contact_title" : { "name": 'Contact Title', "controls": 'TEXT', "active": True },
|
||||||
|
"contact_introduction": { "name": 'Extra Introduction', "controls": 'TEXTAREA', "active": True },
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -194,6 +194,14 @@ def myproduct_settings():
|
|||||||
response = MyProductsService.process_settings(data)
|
response = MyProductsService.process_settings(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@api.route("/panel/myproduct/configuration", methods=["POST"])
|
||||||
|
def myproduct_configuration():
|
||||||
|
data = request.get_json()
|
||||||
|
# logger.info(f"Route Save MyProduct Settings Data ==>>>> {data}")
|
||||||
|
response = MyProductsService.product_configuration(data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/myproduct/settings/values", methods=["POST"])
|
@api.route("/panel/myproduct/settings/values", methods=["POST"])
|
||||||
def myproduct_settings_values():
|
def myproduct_settings_values():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
from urllib import request
|
||||||
|
|
||||||
from flask import session, jsonify
|
from flask import session, jsonify
|
||||||
|
|
||||||
|
from app.api.enums import SettingsItemsData
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.api.services.base_service import BaseService
|
from app.api.services.base_service import BaseService
|
||||||
from marshmallow import ValidationError
|
from marshmallow import ValidationError
|
||||||
@@ -59,14 +63,14 @@ class MyProductsService(BaseService):
|
|||||||
'template_9': {'title': 'Template Name-9', 'template_id': 'fc8f0738-6500-4775-9895-2047cd275302',
|
'template_9': {'title': 'Template Name-9', 'template_id': 'fc8f0738-6500-4775-9895-2047cd275302',
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||||
}
|
}
|
||||||
template_data =[]
|
template_data = []
|
||||||
for t in templates:
|
for t in templates:
|
||||||
template_data.append({
|
template_data.append({
|
||||||
'id': t.id,
|
'id': t.id,
|
||||||
'template_uid': t.uid,
|
'template_uid': t.uid,
|
||||||
'title': t.name,
|
'title': t.name,
|
||||||
'active': 1,
|
'active': 1,
|
||||||
'added': t.added.isoformat() if t.added else None
|
'added': t.added.isoformat() if t.added else None
|
||||||
})
|
})
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
@@ -414,3 +418,76 @@ class MyProductsService(BaseService):
|
|||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return ResponseHelper.internal_server_error()
|
return ResponseHelper.internal_server_error()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def product_configuration(data):
|
||||||
|
try:
|
||||||
|
with db.session.begin():
|
||||||
|
validated_data = MyProductsService.validate_data(data, MyProductSchema())
|
||||||
|
token = validated_data.get('token')
|
||||||
|
uid = validated_data.get('uid')
|
||||||
|
member_data = Members.get_member_by_uid(uid)
|
||||||
|
member_id = member_data.id
|
||||||
|
product_id = validated_data.get('product_id')
|
||||||
|
|
||||||
|
product_subscription_uid = ''
|
||||||
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
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)
|
||||||
|
settings_data = []
|
||||||
|
if memberSubscription is not None:
|
||||||
|
# logger.info(f"Incoming MyProduct data ==>>>> {memberSubscription}")
|
||||||
|
product_subscription_uid = memberSubscription.uid
|
||||||
|
settingsFields = SettingsItemsData.get_site_settings_data()
|
||||||
|
templateData = []
|
||||||
|
homeFields = SettingsItemsData.get_site_home_settings()
|
||||||
|
footerFields = SettingsItemsData.get_site_footer_settings()
|
||||||
|
contactFields = SettingsItemsData.get_site_contact_items()
|
||||||
|
socialFields = SettingsItemsData.get_site_social_settings_data()
|
||||||
|
aboutFields = SettingsItemsData.get_site_about_items()
|
||||||
|
|
||||||
|
settings_items = {
|
||||||
|
"settings": {"title": 'Settings', "controls": 'settings', "active": 'active show',
|
||||||
|
"custom": False, "data": settingsFields},
|
||||||
|
"home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False,
|
||||||
|
"data": homeFields},
|
||||||
|
"footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False,
|
||||||
|
"data": footerFields},
|
||||||
|
"about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False,
|
||||||
|
"data": aboutFields},
|
||||||
|
"contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '', "custom": False,
|
||||||
|
"data": contactFields},
|
||||||
|
"social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False,
|
||||||
|
"data": socialFields},
|
||||||
|
"template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True,
|
||||||
|
"data": templateData},
|
||||||
|
"color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '',
|
||||||
|
"custom": True, "data": {}}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Simulate processing
|
||||||
|
response_data = {
|
||||||
|
"settings_items": settings_data,
|
||||||
|
"member_id": member_id,
|
||||||
|
"product_subscription_uid": product_subscription_uid,
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseHelper.success(data=response_data)
|
||||||
|
|
||||||
|
except ValidationError as err:
|
||||||
|
|
||||||
|
logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}")
|
||||||
|
db.session.rollback()
|
||||||
|
return ResponseHelper.unprocessable_entity(result_description="Validation exception")
|
||||||
|
|
||||||
|
except ValueError as err:
|
||||||
|
logger.error(f"{getattr(err, 'messages', str(err))}")
|
||||||
|
db.session.rollback()
|
||||||
|
return ResponseHelper.error(result_description=str(err))
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
|
db.session.rollback()
|
||||||
|
return ResponseHelper.internal_server_error()
|
||||||
|
|||||||
@@ -171,9 +171,14 @@ class SubscriptionsService(BaseService):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
stripe_session = StripeIntegration.create_checkout_session_subscription(priceId, customerId)
|
stripe_session = StripeIntegration.create_checkout_session_subscription(priceId, customerId)
|
||||||
logger.info(f"Inside Stripe_Session ===== : {stripe_session}")
|
if stripe_session:
|
||||||
logger.info(f"Inside Stripe_Session ID ===== : {stripe_session.id}")
|
logger.info(f"Inside Stripe_Session ===== : {stripe_session}")
|
||||||
PaymentsSession.add_payment_session(member_id, option_name, 'STRIPE', stripe_session.id)
|
logger.info(f"Inside Stripe_Session ID ===== : {stripe_session.id}")
|
||||||
|
PaymentsSession.add_payment_session(member_id, option_name, 'STRIPE', stripe_session.id)
|
||||||
|
else:
|
||||||
|
stripe_error = f"Stripe Returned {stripe_session}"
|
||||||
|
db.session.rollback()
|
||||||
|
return ResponseHelper.error(result_description=str(stripe_error))
|
||||||
#
|
#
|
||||||
# product_id = validated_data.get('product_id')
|
# product_id = validated_data.get('product_id')
|
||||||
# product_subscription_uid=''
|
# product_subscription_uid=''
|
||||||
@@ -191,26 +196,6 @@ class SubscriptionsService(BaseService):
|
|||||||
# product_subscription_external_url = memberSubscription.external_url
|
# product_subscription_external_url = memberSubscription.external_url
|
||||||
# product_subscription_internal_url = memberSubscription.internal_url
|
# product_subscription_internal_url = memberSubscription.internal_url
|
||||||
|
|
||||||
# "banner": "banner.jpg",
|
|
||||||
# myproduct_data = {
|
|
||||||
# "myproudct": {
|
|
||||||
# "banner": product_data.banner,
|
|
||||||
# "description": product_description.details,
|
|
||||||
# "sale_text" : product_description.sale_text,
|
|
||||||
# "internal_url": product_subscription_internal_url,
|
|
||||||
# "external_url": product_subscription_external_url,
|
|
||||||
# "price_text": "90 days free and 3.95/Month",
|
|
||||||
# "product_id": product_data.product_id,
|
|
||||||
# "product_name": product_data.name,
|
|
||||||
# "product_subscription_uid": product_subscription_uid,
|
|
||||||
# "product_uid": product_data.uid,
|
|
||||||
# "promotion_text": "Start Free Today !",
|
|
||||||
# "subscription_uid": product_subscription_uid,
|
|
||||||
# "status": productDataStatus,
|
|
||||||
# "subscription_text": "Start with your goals in mind and then work possible.ith yand Goals. If the plan doesn\u2019t support the vision then change it!",
|
|
||||||
# "title": "Your personal professional web presence"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# Simulate processing
|
# Simulate processing
|
||||||
response_data = {
|
response_data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user