added template data
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}")
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user