diff --git a/tap_mambu/tap_generators/installments_generator.py b/tap_mambu/tap_generators/installments_generator.py index e1ab1ca..a9810f3 100644 --- a/tap_mambu/tap_generators/installments_generator.py +++ b/tap_mambu/tap_generators/installments_generator.py @@ -1,18 +1,24 @@ from .multithreaded_offset_generator import MultithreadedOffsetGenerator -from datetime import datetime +from ..helpers.datetime_utils import datetime_to_utc_str, str_to_localized_datetime, utc_now class InstallmentsGenerator(MultithreadedOffsetGenerator): + def __init__(self, stream_name, client, config, state, sub_type): + super(InstallmentsGenerator, self).__init__(stream_name, client, config, state, sub_type) + self.date_windowing = False + def _init_endpoint_config(self): super(InstallmentsGenerator, self)._init_endpoint_config() self.endpoint_path = "installments" self.endpoint_api_method = "GET" + self.endpoint_params = { + "dueFrom": datetime_to_utc_str(str_to_localized_datetime(self.start_date))[:10], + "dueTo": datetime_to_utc_str(utc_now())[:10], + "detailsLevel": "FULL", + "paginationDetails": "OFF" + } self.endpoint_bookmark_field = "lastPaidDate" - def modify_request_params(self, start, end): - self.static_params["dueFrom"] = datetime.strftime(start, '%Y-%m-%d') - self.static_params["dueTo"] = datetime.strftime(end, '%Y-%m-%d') - def transform_batch(self, batch): temp_batch = super(InstallmentsGenerator, self).transform_batch(batch) for record in temp_batch: