velocity / components /updateinvoice.py
Junaidb's picture
Create updateinvoice.py
1a14e87 verified
raw
history blame contribute delete
727 Bytes
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}],
)