Skip to content

Commit

Permalink
Add support for deprecated items in Chargebee streams (#74)
Browse files Browse the repository at this point in the history
* Add support for deprecated items in Chargebee streams

- Introduced 'include_deprecated' configuration option in the main function to control the inclusion of deprecated items.
- Added 'active_id' field to the subscriptions schema for better tracking of active subscriptions.
- Updated CustomersStream and SubscriptionsStream to include 'include_deprecated' parameter in API requests when enabled.

* Enhance Chargebee streams to support deprecated items

- Added 'include_deprecated' parameter to BaseChargebeeStream for customers and subscriptions.
- Removed redundant 'get_params' method overrides in CustomersStream and SubscriptionsStream, as the base class now handles the inclusion of deprecated items.

This update improves the flexibility of API requests by allowing the inclusion of deprecated items when specified in the configuration.
  • Loading branch information
butkeraites-hotglue authored Dec 13, 2024
1 parent a9b9c77 commit 584b9db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions tap_chargebee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def main():
required_config_keys=['api_key', 'start_date'])

full_site = args.config.get('full_site', None)
args.config['include_deprecated'] = args.config.get('include_deprecated', False)

product_catalog = args.config.get('product_catalog', '1.0')

Expand Down
3 changes: 3 additions & 0 deletions tap_chargebee/schemas/subscriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"id": {
"type": ["null", "string"]
},
"active_id": {
"type": ["null", "string"]
},
"customer_id": {
"type": ["null", "string"]
},
Expand Down
3 changes: 3 additions & 0 deletions tap_chargebee/streams/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ def sync_data(self):
for field_name, field_value in entity_filters.items():
params[field_name] = field_value
LOGGER.info("Querying filtering by {}={}".format(field_name, field_value))

if self.config.get('include_deprecated') is True and self.TABLE in ['customers', 'subscriptions']:
params["include_deprecated"] = "true"

ids = set()
while not done:
Expand Down
2 changes: 1 addition & 1 deletion tap_chargebee/streams/customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class CustomersStream(BaseChargebeeStream):
API_METHOD = 'GET'

def get_url(self):
return 'https://{}/api/v2/customers'.format(self.config.get('full_site'))
return 'https://{}/api/v2/customers'.format(self.config.get('full_site'))

0 comments on commit 584b9db

Please sign in to comment.