08/06/23 - 21h

master
cherif 2023-06-08 21:03:47 +02:00
parent 83597ea68a
commit b5978e2286
4 changed files with 1012 additions and 12 deletions

View File

@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="05/06/23 - 15h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06/06/23 - 19h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" 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_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -297,7 +293,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1685969841934</updated> <updated>1685969841934</updated>
</task> </task>
<option name="localTasksCounter" value="33" /> <task id="LOCAL-00033" summary="06/06/23 - 19h">
<created>1686072292768</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1686072292768</updated>
</task>
<option name="localTasksCounter" value="34" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -312,7 +315,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="15/04/23 - 14h" />
<MESSAGE value="15/04/23 - 22h" /> <MESSAGE value="15/04/23 - 22h" />
<MESSAGE value="20/04/23 - 16h" /> <MESSAGE value="20/04/23 - 16h" />
<MESSAGE value="20/04/23 - 20h" /> <MESSAGE value="20/04/23 - 20h" />
@ -337,6 +339,7 @@
<MESSAGE value="30/05/23 - 22h" /> <MESSAGE value="30/05/23 - 22h" />
<MESSAGE value="02/06/23 - 22h" /> <MESSAGE value="02/06/23 - 22h" />
<MESSAGE value="05/06/23 - 15h" /> <MESSAGE value="05/06/23 - 15h" />
<option name="LAST_COMMIT_MESSAGE" value="05/06/23 - 15h" /> <MESSAGE value="06/06/23 - 19h" />
<option name="LAST_COMMIT_MESSAGE" value="06/06/23 - 19h" />
</component> </component>
</project> </project>

File diff suppressed because one or more lines are too long

View File

@ -829,6 +829,11 @@ def createOrder(diction):
return False, "Impossible de créer la commande ", None return False, "Impossible de créer la commande ", None
# Mise à jour du partenaire (ajouter le nouveau pack) # Mise à jour du partenaire (ajouter le nouveau pack)
"""
/!\ Important :
Si le partenaire avait deja une date d'arret de son abonnement, la creation d'une nouvelle commande
entraine automatiquement l'annulation de l'arret de l'abonnement.
"""
if ("pack" in diction.keys()): if ("pack" in diction.keys()):
if diction['pack']: if diction['pack']:
mypack = diction['pack'] mypack = diction['pack']
@ -836,7 +841,8 @@ def createOrder(diction):
ret_val = coll_partner.find_one_and_update( ret_val = coll_partner.find_one_and_update(
{'recid': str(user_recid), }, {'recid': str(user_recid), },
{"$set": {'pack_service':str(mypack), {"$set": {'pack_service':str(mypack),
'nb_formation':str(nb_formation)}}, 'nb_formation':str(nb_formation),
'end_date_abonnement':''}},
upsert=False, upsert=False,
return_document=ReturnDocument.AFTER return_document=ReturnDocument.AFTER
) )

View File

@ -793,7 +793,7 @@ def stop_strip_subscription(diction):
if (ret_val is None or ret_val['_id'] is None): if (ret_val is None or ret_val['_id'] is None):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][3]) + " - Arret abonnement : impossible de mettre à jour le client") str(inspect.stack()[0][3]) + " - Arret abonnement : impossible de mettre à jour le client")
return False, False, "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_email = local_ret_val['email']
partners_nom = local_ret_val['nom'] partners_nom = local_ret_val['nom']
@ -806,7 +806,7 @@ def stop_strip_subscription(diction):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][3]) + " - WARNING : Arret abonnement, Impossible d'envoyer le mail de notification au partenaire") 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) return True, " Votre abonnement va s'arreter le "+str(arrete_abonnement_formated)
except Exception as e: except Exception as e:
@ -1118,11 +1118,13 @@ def strip_update_subscription_plan(diction):
#a = stripe.SubscriptionSchedule.release( str(local_ret_val['stripe_subscription_id']), ) #a = stripe.SubscriptionSchedule.release( str(local_ret_val['stripe_subscription_id']), )
a = stripe.Subscription.modify( a = stripe.Subscription.modify(
str(local_ret_val['stripe_subscription_id']), str(local_ret_val['stripe_subscription_id']),
cancel_at_period_end=False,
proration_behavior='create_prorations', proration_behavior='create_prorations',
items=[{ items=[{
'id': current_subscription['items'].data[0].id, 'id': current_subscription['items'].data[0].id,
'price': price_id, 'price': price_id,
'quantity': qty, 'quantity': qty,
}] }]
) )