File size: 727 Bytes
1a14e87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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}],
    )