21/01/23 - 12h
parent
755524c68c
commit
7fd9ac5fda
|
@ -4,11 +4,11 @@
|
|||
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="19/01/23 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/statistics.py" beforeDir="false" afterPath="$PROJECT_DIR$/statistics.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
3077
Log/log_file.log
3077
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -300,7 +300,7 @@ def add_payement_mode(diction):
|
|||
str(inspect.stack()[0][3]) + " : Impossible de créer la carte de payement dans Stripe")
|
||||
return False, "Impossible d'ajouter le mode de paiement."
|
||||
|
||||
print(" ### la carte est créée : "+str(created_stripe_cart))
|
||||
#print(" ### la carte est créée : "+str(created_stripe_cart))
|
||||
|
||||
|
||||
if (str(new_data['type']) == "sepa"):
|
||||
|
@ -352,7 +352,7 @@ def add_payement_mode(diction):
|
|||
|
||||
|
||||
'''
|
||||
Cette fonction recuperer le mode de payement par defaut d'un client
|
||||
Cette fonction recupere le mode de payement par defaut d'un client
|
||||
'''
|
||||
def get_payement_mode(diction):
|
||||
try:
|
||||
|
@ -428,26 +428,13 @@ def get_payement_mode(diction):
|
|||
tmp_diction = {}
|
||||
tmp_diction['stripe_account_id'] = str(stripe_account_id)
|
||||
|
||||
#print("## recherche mod de payement stripe_account_id = "+str(stripe_account_id) )
|
||||
#print("### recherche mod de payement stripe_account_id = "+str(stripe_account_id) )
|
||||
|
||||
localStatus, payment_cards = Stripe.get_customer_payement_cards(tmp_diction)
|
||||
val_tmp = {}
|
||||
for tmp in payment_cards:
|
||||
# RetObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = tmp
|
||||
RetObject_stripe.append(val_tmp)
|
||||
#RetObject_stripe.append(JSONEncoder().encode(tmp))
|
||||
|
||||
#print(" #### mode de payement via stripe = "+str(RetObject_stripe))
|
||||
|
||||
RetObject = []
|
||||
coll_facture = MYSY_GV.dbname['payement_mode']
|
||||
|
||||
for retVal in coll_facture.find({'client_recid': user_recid, 'valide': '1'}):
|
||||
user = retVal
|
||||
user['stripe_paymentmethod_id'] = stripe_paymentmethod_id
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
RetObject_stripe.append(payment_cards[0])
|
||||
|
||||
return True, RetObject_stripe
|
||||
|
||||
|
@ -543,7 +530,7 @@ def createOrder(diction):
|
|||
new_data['nb_product'] = str(nb_line)
|
||||
i = 0
|
||||
total_ht = 0
|
||||
|
||||
nb_formation = ""
|
||||
while (i < nb_line):
|
||||
#print("PRODUIT N° " + str((i + 1)) + " : " )
|
||||
line_dict = json.loads(diction[str(i)])
|
||||
|
@ -562,12 +549,15 @@ def createOrder(diction):
|
|||
new_data_item['code'] = line_dict['code']
|
||||
new_data_item['prix'] = line_dict['prix']
|
||||
new_data_item['qty'] = line_dict['qty']
|
||||
nb_formation = line_dict['qty']
|
||||
new_data_item['pack_products'] = line_dict['pack_products']
|
||||
|
||||
new_data_item['amount'] = str(montant_line)
|
||||
row = "item_"+str(i)
|
||||
new_data[str(row)] = new_data_item
|
||||
|
||||
|
||||
|
||||
i = i + 1
|
||||
|
||||
|
||||
|
@ -578,6 +568,7 @@ def createOrder(diction):
|
|||
total_ttc_float = mycommon.tryFloat(str(new_data['total_ttc']))
|
||||
#print("str(new_data['total_ttc']) === " + str(total_ttc_float))
|
||||
|
||||
|
||||
if (tmp_count <= 0 and total_ttc_float > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucune donnée de payement, Impossible de créer la commande ")
|
||||
|
@ -753,7 +744,8 @@ def createOrder(diction):
|
|||
coll_partner = MYSY_GV.dbname['partnair_account']
|
||||
ret_val = coll_partner.find_one_and_update(
|
||||
{'recid': str(user_recid), },
|
||||
{"$set": {'pack_service':str(mypack)}},
|
||||
{"$set": {'pack_service':str(mypack),
|
||||
'nb_formation':str(nb_formation)}},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
@ -772,8 +764,8 @@ def createOrder(diction):
|
|||
CreateInvoice(new_data)
|
||||
|
||||
# Apres la facturation, on met à jour le display_ranking des formations du partenaire.
|
||||
tmp_diction = {"partnaire_recid":str(user_recid), "new_pack_na"
|
||||
"me":str(mypack)}
|
||||
tmp_diction = {"partnaire_recid":str(user_recid), "new_pack_name":str(mypack)}
|
||||
|
||||
class_mgt.UpdataPartnerRankingClass(tmp_diction)
|
||||
return True, "la commande été correctement créee", str(new_data['order_id'])
|
||||
else:
|
||||
|
|
|
@ -148,7 +148,7 @@ def incription_training_confirmation_mail(diction):
|
|||
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
@ -250,7 +250,7 @@ def incription_training_refused_mail(diction):
|
|||
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Inscription formation refusée'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
@ -338,7 +338,7 @@ def Pre_incription_training_confirmation_mail(diction):
|
|||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training] : pre-inscription formation'
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
@ -535,7 +535,7 @@ def Evaluation_training_confirmation_mail(diction):
|
|||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = 'MySy Training : Evaluation formation : '+str(diction['title'])
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
@ -607,7 +607,7 @@ def SendAttestion_to_attendee_by_email(diction):
|
|||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = 'MySy Training : Votre attestation de formation : ' + str(diction['title'])
|
||||
msg['To'] = str(diction['email'])
|
||||
|
||||
|
|
81
email_mgt.py
81
email_mgt.py
|
@ -161,7 +161,7 @@ def send_partner_account_mail_old(message, account_mail):
|
|||
msg['Subject'] = '[MySy Training]: activation de votre compte PRO'
|
||||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
@ -353,7 +353,7 @@ def Pro_Account_Token_Pass_old(account_mail, my_token):
|
|||
msg['Subject'] = '[MySy Training]: votre compte PRO est pret'
|
||||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
cle = my_token
|
||||
|
||||
|
@ -473,7 +473,7 @@ def SalesOrderConfirmationEmail_old(account_mail, diction):
|
|||
msg['Subject'] = '[MySy Training]: votre compte PRO est pret'
|
||||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
to = [{"email": str(account_mail)}]
|
||||
|
||||
|
@ -623,7 +623,7 @@ def SendInvoiceEmail_Old(account_mail, diction):
|
|||
msg['Subject'] = '[MySy Training]: votre compte PRO est pret'
|
||||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
to = [{"email": str(account_mail)}]
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
|||
msg['Subject'] = "[MySy Training] : Confirmation commande N°"+str(order_id)
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['To'] = str(mail_recever)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
msg.add_attachment('./Template/MySy_CGV.pdf')
|
||||
with open('./Template/MySy_CGV.pdf', 'rb') as content_file:
|
||||
|
@ -1226,7 +1226,7 @@ def send_partner_account_mail(message, account_mail):
|
|||
msg['Subject'] = '[MySy Training]: activation de votre compte PRO'
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ def Pro_Account_Token_Pass(account_mail, my_token):
|
|||
cle = my_token
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
|
@ -1361,7 +1361,7 @@ def send_user_thks_mail(message, account_mail):
|
|||
msg.set_content(sourceHtml, subtype='html')
|
||||
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training]: Votre compte est actif '
|
||||
msg['To'] = str(account_mail)
|
||||
|
||||
|
@ -1423,7 +1423,7 @@ def send_user_init_pwd_mail(token, account_mail, type_account):
|
|||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = '[MySy Training Technology] : Reinitialisez votre mot de passe'
|
||||
msg['To'] = str(account_mail)
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ def EmailDemandeInfoClass( diction):
|
|||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
msg['Subject'] = "[MySy Training Technology] : Demande d'information sur une formation"
|
||||
msg['To'] = str(diction['email_partnair'])
|
||||
|
@ -1652,7 +1652,7 @@ def SendInvoiceEmail(account_mail, diction):
|
|||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = "[MySy Training Technology] : Votre facture N° "+str(invoice_id)
|
||||
msg['To'] = str(toaddrs)
|
||||
|
||||
|
@ -1755,7 +1755,7 @@ def SendEmargementMail( diction):
|
|||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = "[MySy Training Technology] : Emargement Matinée du "+str(val_emarge['date'])
|
||||
msg['To'] = str(val_emarge['email'])
|
||||
|
||||
|
@ -1875,7 +1875,7 @@ def ManualSendInvoiceEmailRIB(diction):
|
|||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = "[MySy Training Technology] : Votre facture N° FACT_221100019"
|
||||
msg['To'] = 'billardman1@gmail.com'
|
||||
|
||||
|
@ -1892,3 +1892,58 @@ def ManualSendInvoiceEmailRIB(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " impossible d'envoyer la facure"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction envoie un email pour notifier a un partenaire l'arrete d'un abonnement
|
||||
"""
|
||||
def EmailStopAbonnement( partners_email, partners_pack_service, partners_date_arret, partners_nom):
|
||||
try:
|
||||
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
|
||||
tomorrow_day = tomorrow.strftime("%A")
|
||||
|
||||
|
||||
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
# msg = MIMEMultipart("alternative")
|
||||
msg = EmailMessage()
|
||||
|
||||
# JINJA2
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/MySy_Stop_Abonnement_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {
|
||||
"params":{"user_name": str(partners_nom),
|
||||
"packs": str(partners_pack_service),
|
||||
"end_date_abonnement": str(partners_date_arret),
|
||||
"email": str(partners_email),
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
sourceHtml = template.render(params=body["params"])
|
||||
|
||||
msg.set_content(sourceHtml, subtype='html')
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
|
||||
msg['Subject'] = "[MySy Training Technology] : Arret de votre abonnement "+str(partners_pack_service)
|
||||
msg['To'] = str(partners_email)
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
return True
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
|
|
@ -983,7 +983,7 @@ def partner_login(diction):
|
|||
# Verification que les informations sont juste
|
||||
coll_name = MYSY_GV.dbname['partnair_account']
|
||||
ret_val = coll_name.find_one_and_update({'email': str(email), 'pwd': str(pwd), 'active': '1', 'locked':'0'},
|
||||
{"$set": {'last_connexion':str(now)}},
|
||||
{"$set": {'lastconnexion':str(now)}},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
|
|
@ -17,6 +17,7 @@ import sys, os
|
|||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import email_mgt as email_mgt
|
||||
|
||||
# Setup Stripe python client library
|
||||
load_dotenv(find_dotenv())
|
||||
|
@ -229,7 +230,7 @@ def create_update_payment_card(diction):
|
|||
stripe_paymentmethod_id,
|
||||
)
|
||||
|
||||
print(" #### detache "+str(detache))
|
||||
#print(" #### detache "+str(detache))
|
||||
|
||||
|
||||
|
||||
|
@ -547,6 +548,7 @@ def stop_strip_subscription(diction):
|
|||
return False, " Impossible d'annuler le payement "
|
||||
|
||||
|
||||
|
||||
#a = stripe.SubscriptionSchedule.release( str(local_ret_val['stripe_subscription_id']), )
|
||||
a = stripe.Subscription.modify(
|
||||
str(local_ret_val['stripe_subscription_id']),
|
||||
|
@ -574,6 +576,16 @@ def stop_strip_subscription(diction):
|
|||
str(inspect.stack()[0][3]) + " - Arret abonnement : impossible de mettre à jour le client")
|
||||
return False, False, "Arret abonnement : : impossible de mettre à jour le client"
|
||||
|
||||
partners_email = local_ret_val['email']
|
||||
partners_nom = local_ret_val['nom']
|
||||
partners_pack_service = local_ret_val['pack_service']
|
||||
partners_date_arret = arrete_abonnement_formated
|
||||
|
||||
local_ret_val = email_mgt.EmailStopAbonnement( partners_email, partners_pack_service, partners_date_arret, partners_nom)
|
||||
|
||||
if( local_ret_val is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - WARNING : Arret abonnement, Impossible d'envoyer le mail de notification au partenaire")
|
||||
|
||||
return True, " Votre abonement va s'arreter le "+str(arrete_abonnement_formated)
|
||||
|
||||
|
|
Loading…
Reference in New Issue