add netopia payment process

This commit is contained in:
2025-11-06 10:48:57 +02:00
parent 5a40af5434
commit 6c713171ed
10 changed files with 566 additions and 72 deletions

View File

@@ -0,0 +1,33 @@
import sqlite3
from typing import Optional
class Netopia:
def __init__(self, db_path="instance/app_database.db"):
self.db_path = db_path
self._create_netopia_table()
def _create_netopia_table(self):
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS netopia (
id INTEGER PRIMARY KEY AUTOINCREMENT,
order_id TEXT,
netopia_id TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
""")
conn.commit()
def add_netopia_card(self, order_id, netopia_id):
try:
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute("""
INSERT INTO netopia (order_id, netopia_id)
VALUES (?, ? )
""", (order_id, netopia_id))
conn.commit()
return True
except sqlite3.IntegrityError:
return False