bw-essentials-core 0.1.8__tar.gz → 0.1.10__tar.gz

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.

Potentially problematic release.


This version of bw-essentials-core might be problematic. Click here for more details.

Files changed (35) hide show
  1. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/PKG-INFO +1 -1
  2. bw_essentials_core-0.1.10/bw_essentials/services/payment.py +39 -0
  3. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/portfolio_catalogue.py +55 -1
  4. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials_core.egg-info/PKG-INFO +1 -1
  5. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials_core.egg-info/SOURCES.txt +1 -0
  6. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/setup.py +1 -1
  7. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/README.md +0 -0
  8. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/__init__.py +0 -0
  9. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/constants/__init__.py +0 -0
  10. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/constants/services.py +0 -0
  11. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/data_loch/__init__.py +0 -0
  12. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/data_loch/data_loch.py +0 -0
  13. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/email_client/__init__.py +0 -0
  14. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/email_client/email_client.py +0 -0
  15. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/notifications/__init__.py +0 -0
  16. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
  17. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/notifications/teams_notifications.py +0 -0
  18. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/s3_utils/__init__.py +0 -0
  19. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/s3_utils/s3_utils.py +0 -0
  20. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/__init__.py +0 -0
  21. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/api_client.py +0 -0
  22. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/broker.py +0 -0
  23. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/market_pricer.py +0 -0
  24. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/master_data.py +0 -0
  25. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/model_portfolio_reporting.py +0 -0
  26. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/notification.py +0 -0
  27. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/portfolio_content.py +0 -0
  28. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/trade_placement.py +0 -0
  29. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/user_app.py +0 -0
  30. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/user_portfolio.py +0 -0
  31. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials/services/user_portfolio_reporting.py +0 -0
  32. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
  33. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials_core.egg-info/requires.txt +0 -0
  34. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/bw_essentials_core.egg-info/top_level.txt +0 -0
  35. {bw_essentials_core-0.1.8 → bw_essentials_core-0.1.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -0,0 +1,39 @@
1
+ import logging
2
+ from bw_essentials.services.api_client import ApiClient
3
+ from bw_essentials.constants.services import Services
4
+
5
+ logger = logging.getLogger(__name__)
6
+
7
+
8
+ class Payment(ApiClient):
9
+
10
+ def __init__(self, service_user: str):
11
+ super().__init__(service_user)
12
+ self.urls = {
13
+ "get_subscription": "user-subscription",
14
+ }
15
+ self.name = Services.PAYMENT.value
16
+ self.base_url = self.get_base_url(Services.PAYMENT.value)
17
+
18
+ def get_subscription(self, user_id):
19
+ """
20
+ Fetch subscription details for a given user.
21
+
22
+ This method constructs the request URL using the configured base URL
23
+ and the `get_subscription` endpoint. It sends a GET request with
24
+ the provided `user_id` as a query parameter, logs the process,
25
+ and returns the subscription data payload.
26
+
27
+ Args:
28
+ user_id (str | int): Unique identifier of the user whose
29
+ subscription details need to be fetched.
30
+
31
+ Returns:
32
+ dict | None: A dictionary containing the subscription data if
33
+ available, otherwise `None`.
34
+ """
35
+ logger.info(f"Received request to get subscription with {user_id =}")
36
+ url = f"{self.base_url}"
37
+ subscription = self._get(url=url, endpoint=self.urls.get('get_subscription'), params={'userId': user_id})
38
+ logger.info(f"Successfully fetched subscription data. {subscription =}")
39
+ return subscription.get('data')
@@ -78,7 +78,9 @@ class PortfolioCatalogue(ApiClient):
78
78
  self.name = Services.PORTFOLIO_CATALOGUE.value
79
79
  self.urls = {
80
80
  "rebalance": "rebalance",
81
- "get_rebalance": "rebalance"
81
+ "get_rebalance": "rebalance",
82
+ "subscriptions_by_ids": "subscription-plan/list",
83
+ "otp_subscriptions_by_ids": "one-time-plans/list"
82
84
  }
83
85
 
84
86
  def create_rebalance(self, json: Dict[str, Any]) -> Optional[Dict[str, Any]]:
@@ -157,3 +159,55 @@ class PortfolioCatalogue(ApiClient):
157
159
  return next_rebalance_date
158
160
  logger.info("get_rebalance_due_date not applicable for status=%s", status)
159
161
  return None
162
+
163
+ def get_subscriptions_by_ids(self, plans_ids: list):
164
+ """
165
+ Fetch multiple subscriptions by their plan IDs.
166
+
167
+ This method constructs the request URL using the configured base URL
168
+ and the `subscriptions_by_ids` endpoint. It sends a POST request with
169
+ the given list of `plans_ids` in the request body, logs the process,
170
+ and returns the subscription data.
171
+
172
+ Args:
173
+ plans_ids (list[str] | list[int]): A list of subscription plan IDs
174
+ to fetch details for.
175
+
176
+ Returns:
177
+ list[dict]: A list of subscription data dictionaries if available,
178
+ otherwise an empty list.
179
+ """
180
+ logger.info(f"In get_subscriptions_by_ids {plans_ids =}")
181
+ url = f"{self.base_url}"
182
+ data = {
183
+ "planId": plans_ids
184
+ }
185
+ response = self._post(url=url, endpoint=self.urls.get('subscriptions_by_ids'), json=data)
186
+ logger.info(f"Successfully fetched subscriptions by ids data. {response =}")
187
+ return response.get('data', [])
188
+
189
+ def get_otp_subscriptions_by_ids(self, plans_ids: list):
190
+ """
191
+ Fetch OTP subscription details for multiple plan IDs.
192
+
193
+ This method sends a POST request to the `otp_subscriptions_by_ids`
194
+ endpoint with the given list of plan IDs in the request body.
195
+ It logs the request and response flow and returns the extracted
196
+ subscription data.
197
+
198
+ Args:
199
+ plans_ids (list[str] | list[int]): A list of OTP subscription plan IDs
200
+ to retrieve details for.
201
+
202
+ Returns:
203
+ list[dict]: A list of OTP subscription data dictionaries if available,
204
+ otherwise an empty list.
205
+ """
206
+ logger.info(f"In get_otp_subscriptions_by_ids {plans_ids =}")
207
+ url = f"{self.base_url}"
208
+ data = {
209
+ "id": plans_ids
210
+ }
211
+ response = self._post(url=url, endpoint=self.urls.get('otp_subscriptions_by_ids'), json=data)
212
+ logger.info(f"Successfully fetched otp subscriptions by ids data. {response =}")
213
+ return response.get('data', [])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -19,6 +19,7 @@ bw_essentials/services/market_pricer.py
19
19
  bw_essentials/services/master_data.py
20
20
  bw_essentials/services/model_portfolio_reporting.py
21
21
  bw_essentials/services/notification.py
22
+ bw_essentials/services/payment.py
22
23
  bw_essentials/services/portfolio_catalogue.py
23
24
  bw_essentials/services/portfolio_content.py
24
25
  bw_essentials/services/trade_placement.py
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
10
10
 
11
11
  setup(
12
12
  name="bw-essentials-core",
13
- version="0.1.8",
13
+ version="0.1.10",
14
14
  author="InvestorAI",
15
15
  author_email="support+tech@investorai.in",
16
16
  description="Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.",