Add data
This commit is contained in:
@@ -129,6 +129,13 @@ def myproduct_url():
|
|||||||
response = ProductsService.product_url_request(data)
|
response = ProductsService.product_url_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@api.route("/panel/account/products/refresh", methods=["POST"])
|
||||||
|
def myproduct_refresh():
|
||||||
|
data = request.get_json()
|
||||||
|
logger.info(f"Route Product URL Data ==>>>> {data}")
|
||||||
|
response = ProductsService.myproduct_refresh_request(data)
|
||||||
|
return response
|
||||||
|
|
||||||
#
|
#
|
||||||
@api.route("/panel/contacts", methods=["POST"])
|
@api.route("/panel/contacts", methods=["POST"])
|
||||||
def merms_contacts():
|
def merms_contacts():
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from marshmallow import Schema, fields
|
||||||
|
|
||||||
|
class MyProductRefreshSchema(Schema):
|
||||||
|
token = fields.Str(required=True)
|
||||||
|
uid = fields.Str(required=True)
|
||||||
|
product_id = fields.Str(required=True)
|
||||||
|
subscription_uid = fields.Str(required=True)
|
||||||
|
|
||||||
@@ -222,6 +222,7 @@ class MyProductsService(BaseService):
|
|||||||
"product_subscription_uid": product_subscription_uid,
|
"product_subscription_uid": product_subscription_uid,
|
||||||
"product_uid": product_data.uid,
|
"product_uid": product_data.uid,
|
||||||
"promotion_text": "Start Free Today !",
|
"promotion_text": "Start Free Today !",
|
||||||
|
"subscription_uid": product_subscription_uid,
|
||||||
"status": productDataStatus,
|
"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!",
|
"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"
|
"title": "Your personal professional web presence"
|
||||||
|
|||||||
@@ -5,16 +5,18 @@ from flask import session, jsonify
|
|||||||
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
|
||||||
from app.api.enums import TransactionType
|
# from app.api.enums import TransactionType
|
||||||
from app.api.integrations import SimbrellaIntegration
|
# from app.api.integrations import SimbrellaIntegration
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models import MembersProducts, Products, Members
|
from app.models import MembersProducts, Products, Members
|
||||||
|
|
||||||
from app.api.services.offer_analysis import OfferAnalysis
|
# from app.api.services.offer_analysis import OfferAnalysis
|
||||||
from app.api.helpers.response_helper import ResponseHelper
|
from app.api.helpers.response_helper import ResponseHelper
|
||||||
from werkzeug.security import generate_password_hash, check_password_hash
|
from werkzeug.security import generate_password_hash, check_password_hash
|
||||||
from app.api.schemas.products import ProductsSchema
|
from app.api.schemas.products import ProductsSchema
|
||||||
from app.api.schemas.user import UserSchema
|
from app.api.schemas.user import UserSchema
|
||||||
|
from app.api.schemas.myproduct_refresh import MyProductRefreshSchema
|
||||||
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import jwt
|
import jwt
|
||||||
@@ -131,6 +133,46 @@ class ProductsService(BaseService):
|
|||||||
#
|
#
|
||||||
# return st_text
|
# return st_text
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def myproduct_refresh_request(data):
|
||||||
|
try:
|
||||||
|
with db.session.begin():
|
||||||
|
validated_data = ProductsService.validate_data(data, MyProductRefreshSchema())
|
||||||
|
token = validated_data.get('token')
|
||||||
|
uid = validated_data.get('uid')
|
||||||
|
member_data = Members.get_member_by_uid(uid)
|
||||||
|
member_id = member_data.id
|
||||||
|
subscription_uid = validated_data.get('subscription_uid')
|
||||||
|
|
||||||
|
#products = MembersProducts.get_member_productlist_by_member_id(member_id)
|
||||||
|
|
||||||
|
# Simulate processing
|
||||||
|
response_data = {
|
||||||
|
"products_data": [],
|
||||||
|
"member_id":member_id,
|
||||||
|
"uid": member_data.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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def product_url_request(data):
|
def product_url_request(data):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user