diff --git a/src/components/CheckOut.js b/src/components/CheckOut.js index 74cff79..74e4bac 100644 --- a/src/components/CheckOut.js +++ b/src/components/CheckOut.js @@ -428,6 +428,12 @@ function CheckOut(props) { setprice_ch(process.env.REACT_APP_API_URL_STRIP_ID_PACK_GOLD); } + else if (String(props.packs).toLocaleLowerCase() === String("decouverte")) { + setnb_formations("1"); + } + + + window.scrollTo(0, 0); }, []); @@ -448,7 +454,7 @@ function CheckOut(props) { //alert(" confirmation ok"); if (String(nb_formations) === "0") { - alert(" Vous devez choisir un nombre de formation "); + alert(" Vous devez choisir un nombre de formations "); document.getElementById('div_nb_formation').style.color = "red"; document.getElementById('div_ttc').style.color = "red"; @@ -557,8 +563,14 @@ function CheckOut(props) { setpaymentmode(""); setgotocheckout(""); + console.log(" ### packprice = ", packprice); if (parseFloat(packprice) > 0) finalize_abonnement(local_souscription_id); + else if (String(props.packs).toLowerCase() === String("decouverte")) { + MySy_LMS_Account_Management(); + window.location.reload(); + } + } else { @@ -588,6 +600,42 @@ function CheckOut(props) { setmenumodepayement("sepa"); } + + // Mise à jour du compte LMs Mysy + const [MySy_LMS_Account_Management_api, setMySy_LMS_Account_Management_api] = useState(""); + const [MySy_LMS_Account_Management_message, setMySy_LMS_Account_Management_message] = useState(""); + function MySy_LMS_Account_Management() { + + var formData_tpm = new FormData(); + formData_tpm.append('token', stored_part); + //formData_tpm.append('stripe_payment_id', stripe_pi); + //formData_tpm.append('packs', packs); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Check_MySy_LMS_Account/"; + + axios.post(myurl, formData_tpm).then(res => { + console.log('In MySy_LMS_Account_Management status = ', res.data.status, " -- message = ", res.data.message); + if (String(res.data.status) === String("true")) { + setMySy_LMS_Account_Management_api("true"); + + } + else { + setMySy_LMS_Account_Management_api("false") + setMySy_LMS_Account_Management_message(String(res.data.message)) + } + + + }).catch((error) => { + console.log('In MySy_LMS_Account_Management ', error); + setMySy_LMS_Account_Management_api("false") + + }) + + } + + const [invoiceAdressOK, setinvoiceAdressOK] = useState(); function checkInvoicingField() {