import os,sys,re from receiver import database if len(sys.argv)!=4 or not re.fullmatch(r"[1-9]\d{0,23}",sys.argv[3]):raise SystemExit("Usage: save-order.py ORDER_ID INVOICE_ID FINAL_AMOUNT_RIAL") with database(os.environ.get('BLUAUTO_WEBHOOK_DB','merchant.sqlite')) as db: db.execute('INSERT INTO orders(order_id,invoice_id,amount_rial) VALUES(?,?,?)',sys.argv[1:]) print('Sample order stored. Existing orders are never overwritten.')