Skip to content

Commit

Permalink
Set date_windowing as False and restored original implementation for …
Browse files Browse the repository at this point in the history
…Installments stream.
  • Loading branch information
shantanu73 committed Mar 25, 2024
1 parent 69f2435 commit 2be5cf7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tap_mambu/tap_generators/installments_generator.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 2be5cf7

Please sign in to comment.