55from mpt_api_client .http .mixins import (
66 AsyncCollectionMixin ,
77 AsyncCreateMixin ,
8- AsyncDeleteMixin ,
98 AsyncGetMixin ,
9+ AsyncUpdateMixin ,
1010 CollectionMixin ,
1111 CreateMixin ,
12- DeleteMixin ,
1312 GetMixin ,
13+ UpdateMixin ,
1414)
15- from mpt_api_client .models import Model , ResourceData
15+ from mpt_api_client .models import Model
16+ from mpt_api_client .resources .commerce .mixins import AsyncTerminateMixin , TerminateMixin
1617
1718
1819class Subscription (Model ):
@@ -29,9 +30,10 @@ class SubscriptionsServiceConfig:
2930
3031class SubscriptionsService ( # noqa: WPS215
3132 CreateMixin [Subscription ],
32- DeleteMixin ,
33+ UpdateMixin [ Subscription ] ,
3334 GetMixin [Subscription ],
3435 CollectionMixin [Subscription ],
36+ TerminateMixin [Subscription ],
3537 Service [Subscription ],
3638 SubscriptionsServiceConfig ,
3739):
@@ -49,24 +51,13 @@ def render(self, resource_id: str) -> str:
4951 response = self ._resource_do_request (resource_id , "GET" , "render" )
5052 return response .text
5153
52- def terminate (self , resource_id : str , resource_data : ResourceData ) -> Subscription :
53- """Terminate subscription.
54-
55- Args:
56- resource_id: Order resource ID
57- resource_data: Order resource data
58-
59- Returns:
60- Subscription template text in markdown format.
61- """
62- return self ._resource_action (resource_id , "POST" , "terminate" , json = resource_data )
63-
6454
6555class AsyncSubscriptionsService ( # noqa: WPS215
6656 AsyncCreateMixin [Subscription ],
67- AsyncDeleteMixin ,
57+ AsyncUpdateMixin [ Subscription ] ,
6858 AsyncGetMixin [Subscription ],
6959 AsyncCollectionMixin [Subscription ],
60+ AsyncTerminateMixin [Subscription ],
7061 AsyncService [Subscription ],
7162 SubscriptionsServiceConfig ,
7263):
@@ -83,15 +74,3 @@ async def render(self, resource_id: str) -> str:
8374 """
8475 response = await self ._resource_do_request (resource_id , "GET" , "render" )
8576 return response .text
86-
87- async def terminate (self , resource_id : str , resource_data : ResourceData ) -> Subscription :
88- """Terminate subscription.
89-
90- Args:
91- resource_id: Order resource ID
92- resource_data: Order resource data
93-
94- Returns:
95- Subscription template text in markdown format.
96- """
97- return await self ._resource_action (resource_id , "POST" , "terminate" , json = resource_data )
0 commit comments