| import streamlit as st |
|
|
| |
| products_db = [] |
| clients_db = [] |
|
|
| st.title("Interface de Paiement Simplifiée") |
|
|
| |
| st.header("Ajouter un Produit") |
| with st.form("add_product"): |
| product_name = st.text_input("Nom du Produit") |
| product_price = st.number_input("Prix (en EUR)", min_value=0.01, format="%.2f") |
| submit_product = st.form_submit_button("Ajouter Produit") |
| |
| if submit_product: |
| product = {"name": product_name, "price": product_price} |
| products_db.append(product) |
| st.success(f"Produit '{product_name}' ajouté avec succès.") |
|
|
| |
| if products_db: |
| st.subheader("Produits Disponibles") |
| for product in products_db: |
| st.write(f"- {product['name']} : {product['price']} EUR") |
|
|
| |
| st.header("Informations du Client") |
| with st.form("add_client"): |
| client_name = st.text_input("Nom du Client") |
| client_email = st.text_input("Email du Client") |
| selected_product = st.selectbox("Produit à acheter", options=[p['name'] for p in products_db]) |
| submit_client = st.form_submit_button("Ajouter Client") |
|
|
| if submit_client: |
| product = next(p for p in products_db if p['name'] == selected_product) |
| client = {"name": client_name, "email": client_email, "product": product} |
| clients_db.append(client) |
| st.success(f"Client '{client_name}' enregistré pour l'achat de '{product['name']}'.") |
|
|
| |
| if clients_db: |
| st.header("Paiement Manuel") |
| for client in clients_db: |
| st.write(f"Client : {client['name']} | Email : {client['email']}") |
| st.write(f"Produit : {client['product']['name']} - {client['product']['price']} EUR") |
| st.write("Étapes de paiement :") |
| st.write("- Connectez-vous à votre compte PayPal Business.") |
| st.write("- Créez une facture pour le client.") |
| st.write(f"- Utilisez l'adresse email : {client['email']}.") |
| st.write(f"- Montant : {client['product']['price']} EUR.") |
| st.write("---") |
|
|