Spaces:
Sleeping
Sleeping
| from components.mongodbconnection import provideClient | |
| client=provideClient() | |
| db=client["x402ify_db"] | |
| coll=db["x402ify_col"] | |
| def GetInvoices(owner): | |
| doc = coll.find_one({"owner": owner}) | |
| all_invoices = [] | |
| if doc: | |
| # Extract invoices from 'endpoints' | |
| if "endpoints" in doc: | |
| for ep in doc["endpoints"]: | |
| all_invoices.extend(ep.get("invoices", [])) | |
| # Extract invoices from 'dynamicendpoints' | |
| if "dynamicendpoints" in doc: | |
| for dep in doc["dynamicendpoints"]: | |
| all_invoices.extend(dep.get("invoices", [])) | |
| return all_invoices | |
| ''' | |
| def GetInvoices(owner,endpoint_linker): | |
| doc = coll.find_one({"owner": owner}) | |
| all_invoices = [] | |
| if doc: | |
| # Extract invoices from 'endpoints' | |
| if "endpoints" in doc: | |
| for ep in doc["endpoints"]: | |
| if ep.get("endpoint_linker") == endpoint_linker: | |
| all_invoices.extend(ep.get("invoices", [])) | |
| #Extract invoices from 'dynamicendpoints' | |
| if "dynamicendpoints" in doc: | |
| for dep in doc["dynamicendpoints"]: | |
| if dep.get("endpoint_linker") == endpoint_linker: | |
| all_invoices.extend(dep.get("invoices", [])) | |
| return all_invoices | |
| ''' | |