Spaces:
Sleeping
Sleeping
| from components.mongodbconnection import provideClient | |
| client=provideClient() | |
| db=client["x402ify_db"] | |
| coll=db["x402ify_col"] | |
| def updateInvoice(owner,endpoint_linker,data): | |
| if "x402" in endpoint_linker: | |
| coll.find_one_and_update( | |
| {"owner": owner}, | |
| { | |
| "$push": { | |
| "endpoints.$[elem].invoices":data | |
| } | |
| }, | |
| array_filters=[{"elem.endpoint_linker":endpoint_linker}], | |
| ) | |
| else: | |
| coll.find_one_and_update( | |
| {"owner": owner}, | |
| { | |
| "$push": { | |
| "dynamicendpoints.$[elem].invoices":data | |
| } | |
| }, | |
| array_filters=[{"elem.endpoint_linker":endpoint_linker}], | |
| ) | |