addes stipe starter
This commit is contained in:
+3
-1
@@ -42,8 +42,10 @@ ALTER TABLE members ADD email VARCHAR(100);
|
||||
ALTER TABLE members ADD account_name VARCHAR(100);
|
||||
ALTER TABLE members ADD firstname VARCHAR(25);
|
||||
ALTER TABLE members ADD lastname VARCHAR(25);
|
||||
ALTER TABLE members ALTER COLUMN password TYPE VARCHAR(250);
|
||||
ALTER TABLE members ALTER COLUMN password TYPE VARCHAR(250);
|
||||
ALTER TABLE members ADD country VARCHAR(3);
|
||||
ALTER TABLE members ADD stripe_customer_id VARCHAR(100)
|
||||
|
||||
|
||||
-- UPDATE members SET account_name ='This is the account name';
|
||||
-- UPDATE members SET firstname ='Firstname';
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from .simbrella import SimbrellaIntegration
|
||||
from .kafka import KafkaIntegration
|
||||
from .kafka import KafkaIntegration
|
||||
from .merms_stripe import StripeIntegration
|
||||
@@ -9,13 +9,18 @@ stripe.api_key = settings.STRIPE_PRIV_KEY
|
||||
|
||||
class StripeIntegration:
|
||||
|
||||
def create_customer(self, data):
|
||||
@staticmethod
|
||||
def create_customer(stripe_customer):
|
||||
logger.info(f"Inside Stripe_Customer ===== : {stripe_customer}")
|
||||
customer = stripe.Customer.create(
|
||||
email="customer@example.com",
|
||||
description="Customer for subscription",
|
||||
payment_method="pm_card_visa", # Replace with a valid payment method ID or attach one later
|
||||
email= stripe_customer["email"],
|
||||
name=stripe_customer["name"],
|
||||
payment_method="pm_card_visa",
|
||||
description="Customer for Merms Subscription",
|
||||
invoice_settings={"default_payment_method": "pm_card_visa"},
|
||||
)
|
||||
# payment_method="pm_card_visa", # Replace with a valid payment method ID or attach one later
|
||||
return customer
|
||||
|
||||
def create_product(self, data):
|
||||
# Example of creating a Product and Price
|
||||
|
||||
@@ -6,7 +6,7 @@ import logging
|
||||
from app.api.integrations import KafkaIntegration
|
||||
from app.config import Config
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from app.api.integrations import StripeIntegration
|
||||
from flask_mail import Mail, Message
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
@@ -22,6 +22,17 @@ class BaseService:
|
||||
SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS
|
||||
THIS_SITE_URL = Config.THIS_SITE_URL
|
||||
|
||||
@staticmethod
|
||||
def addStripeCustomer(customerData):
|
||||
customer_data = {
|
||||
"email": customerData["email"],
|
||||
"name": customerData["name"],
|
||||
}
|
||||
stripe_customer = StripeIntegration.create_customer(customer_data)
|
||||
logger.info(f"Stripe_Customer ===== : {stripe_customer}")
|
||||
return stripe_customer
|
||||
|
||||
|
||||
@staticmethod
|
||||
def send_completepass_mail(signup_email, pending_uid, pending_id, firstname, lastname):
|
||||
msg_body = f"""
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
from flask import session, jsonify
|
||||
#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 PasswordReset, Members
|
||||
#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.login import LoginSchema
|
||||
|
||||
from app.api.schemas.reset_pass_start import ResetPassStart
|
||||
from app.api.schemas.reset_pass_verify import ResetPassVerify
|
||||
from app.api.schemas.reset_pass_complete import ResetPassComplete
|
||||
@@ -253,6 +247,13 @@ class LoginService(BaseService):
|
||||
"room": member.uid,
|
||||
"token": user_token
|
||||
}
|
||||
padded_member_id = str(member.id).zfill(6)
|
||||
customer_data = {
|
||||
"email":"support+" + padded_member_id + "@chiefsoft.com",
|
||||
"name": str(member.firstname) + ' ' + str(member.lastname),
|
||||
}
|
||||
stripe_customer = BaseService.addStripeCustomer(customer_data)
|
||||
logger.info(f"Stripe_Customer ===== : {stripe_customer}")
|
||||
|
||||
return ResponseHelper.success(data=response_data)
|
||||
|
||||
@@ -314,6 +315,11 @@ class LoginService(BaseService):
|
||||
"room": member.uid,
|
||||
"token": user_token
|
||||
}
|
||||
# customer_data=[]
|
||||
# customer_data["email"] = member.email
|
||||
# customer_data["name"] = "Bom Marley"
|
||||
# stripe_customer = StripeIntegration.create_customer(customer_data)
|
||||
# logger.indo(f"Stripe_Customer ===== : {stripe_customer}")
|
||||
|
||||
return ResponseHelper.success(data=response_data)
|
||||
|
||||
|
||||
@@ -32,7 +32,9 @@ class WebContentsService(BaseService):
|
||||
"about_title": "This is about title section",
|
||||
"about_description": "About Description - Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae",
|
||||
"about_extra_1": "About Extra 1 - Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae",
|
||||
"about_extra_2": "About - Extra 2 -Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae "
|
||||
"about_extra_2": "About - Extra 2 -Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae ",
|
||||
"contact_title": "Questions? Let's Talk",
|
||||
"contact_introduction": "Want to learn more about us, or speak with an expert? Let us know what you are looking for and we’ll get back to you right away",
|
||||
}
|
||||
# web_contents_data ={}
|
||||
settings_data_result = MembersProductsSettings.get_product_settings_by_subscription_uid(provision_uid)
|
||||
|
||||
Reference in New Issue
Block a user