automation calls
This commit is contained in:
@@ -11,6 +11,12 @@ class StripeIntegration:
|
|||||||
STRIPE_SUCCESS_URL = Config.STRIPE_SUCCESS_URL
|
STRIPE_SUCCESS_URL = Config.STRIPE_SUCCESS_URL
|
||||||
STRIPE_CANCEL_URL= Config.STRIPE_CANCEL_URL
|
STRIPE_CANCEL_URL= Config.STRIPE_CANCEL_URL
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def transction_hx(limit=30):
|
||||||
|
logger.info(f"Inside Stripe_Transaction Hx ===== :")
|
||||||
|
invoice_items = stripe.InvoiceItem.list(limit)
|
||||||
|
return invoice_items
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_customer(stripe_customer):
|
def create_customer(stripe_customer):
|
||||||
logger.info(f"Inside Stripe_Customer ===== : {stripe_customer}")
|
logger.info(f"Inside Stripe_Customer ===== : {stripe_customer}")
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from app.api.services import (
|
|||||||
SubscriptionsService,
|
SubscriptionsService,
|
||||||
CommonDataService,
|
CommonDataService,
|
||||||
OfficeCustomerService,
|
OfficeCustomerService,
|
||||||
|
AutomationCalls,
|
||||||
GenerativesService, OfficeUsersService, OfficeTemplatesService, OfficeCountryService, WebsiteService,
|
GenerativesService, OfficeUsersService, OfficeTemplatesService, OfficeCountryService, WebsiteService,
|
||||||
FileUploadService, ReportService
|
FileUploadService, ReportService
|
||||||
)
|
)
|
||||||
@@ -897,6 +898,14 @@ def email_check():
|
|||||||
AccountService.process_test_email(data)
|
AccountService.process_test_email(data)
|
||||||
return {"status": "ok"}, 200
|
return {"status": "ok"}, 200
|
||||||
|
|
||||||
|
# ===================================================
|
||||||
|
# Health Check Endpoint
|
||||||
|
@api.route("/cron/refresh-payhx", methods=["GET"])
|
||||||
|
def refresh_payhx():
|
||||||
|
data = {}
|
||||||
|
AutomationCalls.process_stripe_payment_refresh(data)
|
||||||
|
return {"status": "ok"}, 200
|
||||||
|
|
||||||
|
|
||||||
# Health Check Endpoint
|
# Health Check Endpoint
|
||||||
@api.route("/health", methods=["GET"])
|
@api.route("/health", methods=["GET"])
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from app.api.services.comments import CommentsService
|
|||||||
from app.api.services.file_upload import FileUploadService
|
from app.api.services.file_upload import FileUploadService
|
||||||
from app.api.services.reports import ReportService
|
from app.api.services.reports import ReportService
|
||||||
|
|
||||||
|
from app.api.services.automation_calls import AutomationCalls
|
||||||
|
|
||||||
#WEBSITE
|
#WEBSITE
|
||||||
from app.api.services.website import WebsiteService
|
from app.api.services.website import WebsiteService
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
from flask import session, jsonify
|
||||||
|
|
||||||
|
from app.api.schemas.user_update import UserUpdateSchema
|
||||||
|
# from app.models.loan import Loan
|
||||||
|
from app.utils.logger import logger
|
||||||
|
from app.api.services.base_service import BaseService
|
||||||
|
# from app.api.schemas.eligibility_check import EligibilityCheckSchema
|
||||||
|
from marshmallow import ValidationError
|
||||||
|
from app.api.enums import TransactionType
|
||||||
|
# from app.api.integrations import SimbrellaIntegration
|
||||||
|
from app.extensions import db
|
||||||
|
from app.models import Members, MembersActions, MembersProfile, Payments, MembersProducts, ProvisionActions
|
||||||
|
# from app.api.services.offer_analysis import OfferAnalysis
|
||||||
|
from app.api.helpers.response_helper import ResponseHelper
|
||||||
|
from werkzeug.security import generate_password_hash, check_password_hash
|
||||||
|
from app.api.schemas.user import UserSchema
|
||||||
|
from app.api.schemas.start_profile import StartProfileSchema
|
||||||
|
from app.api.schemas.profile_links import ProfileLinksSchema
|
||||||
|
from app.api.integrations import StripeIntegration
|
||||||
|
|
||||||
|
|
||||||
|
from flask_mail import Mail, Message
|
||||||
|
import smtplib
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import jwt
|
||||||
|
import random
|
||||||
|
from app.config import Config
|
||||||
|
|
||||||
|
|
||||||
|
import smtplib, ssl
|
||||||
|
from email.message import EmailMessage
|
||||||
|
|
||||||
|
class AutomationCalls(BaseService):
|
||||||
|
JWT_SECRET_KEY = Config.JWT_SECRET_KEY
|
||||||
|
|
||||||
|
SEND_EMAIL_FROM = Config.SEND_EMAIL_FROM
|
||||||
|
SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS
|
||||||
|
THIS_SITE_URL = Config.THIS_SITE_URL
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def process_stripe_payment_refresh(data):
|
||||||
|
|
||||||
|
stripe_transactions = StripeIntegration.transction_hx()
|
||||||
|
print(stripe_transactions)
|
||||||
|
logger.info(f"Return Stripe_Transaction Hx ===== : {stripe_transactions}")
|
||||||
|
|
||||||
|
bar_data = {
|
||||||
|
"last_update": datetime.datetime.utcnow(),
|
||||||
|
"top_bar": [
|
||||||
|
{"id": "1", "description": "Contacts", "last_update": "10-10-2010 11:00 AM",
|
||||||
|
"value": random.randint(0, 10), "data_span": 'Last 2 months', "link": "#", "extra_style": ''},
|
||||||
|
{"id": "2", "description": "Site Traffic", "last_update": "10-10-2010 11:30 AM",
|
||||||
|
"value": random.randint(0, 10), "data_span": 'Past 12 hours', "link": "#", "extra_style": ''},
|
||||||
|
{"id": "3", "description": "Appointments", "last_update": "10-12-2010 11:30 AM",
|
||||||
|
"value": random.randint(0, 10), "data_span": 'Last 14 days', "link": "#", "extra_style": ''},
|
||||||
|
{"id": "4", "description": "Upgrade Account", "last_update": "10-12-2010 11:30 AM",
|
||||||
|
"value": "Free Trial", "data_span": 'End: 10/10/2025', "link": "/subscription",
|
||||||
|
"extra_style": " billing "}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return ResponseHelper.success(data=bar_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user