mpt-extension-sdk 5.12.0__py3-none-any.whl → 5.14.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mpt_extension_sdk/mpt_http/mpt.py +19 -5
- {mpt_extension_sdk-5.12.0.dist-info → mpt_extension_sdk-5.14.0.dist-info}/METADATA +1 -1
- {mpt_extension_sdk-5.12.0.dist-info → mpt_extension_sdk-5.14.0.dist-info}/RECORD +6 -6
- {mpt_extension_sdk-5.12.0.dist-info → mpt_extension_sdk-5.14.0.dist-info}/WHEEL +0 -0
- {mpt_extension_sdk-5.12.0.dist-info → mpt_extension_sdk-5.14.0.dist-info}/entry_points.txt +0 -0
- {mpt_extension_sdk-5.12.0.dist-info → mpt_extension_sdk-5.14.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -124,6 +124,14 @@ def create_order_asset(mpt_client, order_id, asset):
|
|
|
124
124
|
return response.json()
|
|
125
125
|
|
|
126
126
|
|
|
127
|
+
@wrap_mpt_http_error
|
|
128
|
+
def update_asset(mpt_client, asset_id, **kwargs):
|
|
129
|
+
"""Update an asset."""
|
|
130
|
+
response = mpt_client.put(f"/commerce/assets/{asset_id}", json=kwargs)
|
|
131
|
+
response.raise_for_status()
|
|
132
|
+
return response.json()
|
|
133
|
+
|
|
134
|
+
|
|
127
135
|
@wrap_mpt_http_error
|
|
128
136
|
def update_order_asset(mpt_client, order_id, asset_id, **kwargs):
|
|
129
137
|
"""Update an order asset."""
|
|
@@ -146,6 +154,14 @@ def get_agreement_asset_by_external_id(mpt_client, agreement_id, asset_external_
|
|
|
146
154
|
return assets["data"][0] if assets["data"] else None
|
|
147
155
|
|
|
148
156
|
|
|
157
|
+
@wrap_mpt_http_error
|
|
158
|
+
def get_asset_by_id(mpt_client, asset_id):
|
|
159
|
+
"""Get an asset by ID."""
|
|
160
|
+
response = mpt_client.get(f"/commerce/assets/{asset_id}")
|
|
161
|
+
response.raise_for_status()
|
|
162
|
+
return response.json()
|
|
163
|
+
|
|
164
|
+
|
|
149
165
|
@wrap_mpt_http_error
|
|
150
166
|
def get_order_asset_by_external_id(mpt_client, order_id, asset_external_id):
|
|
151
167
|
"""Retrieve an order asset by its external ID."""
|
|
@@ -348,21 +364,19 @@ def get_agreements_by_ids(mpt_client, ids):
|
|
|
348
364
|
ids_str = ",".join(ids)
|
|
349
365
|
rql_query = (
|
|
350
366
|
f"and(in(id,({ids_str})),eq(status,Active))"
|
|
351
|
-
"&select=lines,parameters,subscriptions,product,listing"
|
|
367
|
+
"&select=assets,lines,parameters,subscriptions,product,listing"
|
|
352
368
|
)
|
|
353
369
|
return get_agreements_by_query(mpt_client, rql_query)
|
|
354
370
|
|
|
355
371
|
|
|
356
|
-
def get_all_agreements(
|
|
357
|
-
mpt_client,
|
|
358
|
-
):
|
|
372
|
+
def get_all_agreements(mpt_client):
|
|
359
373
|
"""Retrieve all active agreements for specific products."""
|
|
360
374
|
product_ids_str = ",".join(settings.MPT_PRODUCTS_IDS)
|
|
361
375
|
product_condition = f"in(product.id,({product_ids_str}))"
|
|
362
376
|
|
|
363
377
|
return get_agreements_by_query(
|
|
364
378
|
mpt_client,
|
|
365
|
-
f"and(eq(status,Active),{product_condition})&select=lines,parameters,subscriptions,product,listing",
|
|
379
|
+
f"and(eq(status,Active),{product_condition})&select=assets,lines,parameters,subscriptions,product,listing",
|
|
366
380
|
)
|
|
367
381
|
|
|
368
382
|
|
|
@@ -16,7 +16,7 @@ mpt_extension_sdk/key_vault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
16
16
|
mpt_extension_sdk/key_vault/base.py,sha256=OnlBEhof_NMRToPQUO4Nrq-dnT_FPxr5FuSn3CRBQF0,3869
|
|
17
17
|
mpt_extension_sdk/mpt_http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
mpt_extension_sdk/mpt_http/base.py,sha256=PbaicrynWLo-plMNC7urIO_iAR5u97tgYrPxrpTn5mI,1514
|
|
19
|
-
mpt_extension_sdk/mpt_http/mpt.py,sha256=
|
|
19
|
+
mpt_extension_sdk/mpt_http/mpt.py,sha256=diHS02_boyQh70V_L4ZRSvFMDdFsin2--5bqgYtU6U8,17640
|
|
20
20
|
mpt_extension_sdk/mpt_http/utils.py,sha256=Ek2D4efcJNhQlOyXd4ZeBhwqDjFpvcbBEqxuCqRQ7cU,166
|
|
21
21
|
mpt_extension_sdk/mpt_http/wrap_http_error.py,sha256=bFaIH-VG1laWlVqnOudzKsJgKItJLI4D56phn5xGQdw,2148
|
|
22
22
|
mpt_extension_sdk/runtime/__init__.py,sha256=YY7ChHKTXXv0a6_PG1F4pVASDzleSWMv_Zf7uX0UDyc,244
|
|
@@ -47,8 +47,8 @@ mpt_extension_sdk/runtime/events/utils.py,sha256=GybK8Qs9Xj03Qqm98ulKeZzPiz92L-G
|
|
|
47
47
|
mpt_extension_sdk/swo_rql/__init__.py,sha256=QrvRDYhpK-Pd3OF-U2aMeazuKm_kbvXwLRIjd9Mm6ok,104
|
|
48
48
|
mpt_extension_sdk/swo_rql/constants.py,sha256=39BZ78OzdU_dIQtoy-Z_5utXqEXRweIFvM9Zfxg9j5M,171
|
|
49
49
|
mpt_extension_sdk/swo_rql/query_builder.py,sha256=CG1dm7uJNPPCwWcf9sRD5zLbz-dtgECkQ_pX4QXpJPw,10825
|
|
50
|
-
mpt_extension_sdk-5.
|
|
51
|
-
mpt_extension_sdk-5.
|
|
52
|
-
mpt_extension_sdk-5.
|
|
53
|
-
mpt_extension_sdk-5.
|
|
54
|
-
mpt_extension_sdk-5.
|
|
50
|
+
mpt_extension_sdk-5.14.0.dist-info/METADATA,sha256=xIdXDFve1amIo0eaeZHYz5ciZiZ7UrcSXHjKoMMqK1Q,1359
|
|
51
|
+
mpt_extension_sdk-5.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
52
|
+
mpt_extension_sdk-5.14.0.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
|
|
53
|
+
mpt_extension_sdk-5.14.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
54
|
+
mpt_extension_sdk-5.14.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|