Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-braintree-native: change window size from days to hours #2191

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions source-braintree-native/source_braintree_native/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def fetch_transactions(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.transaction.search(
Expand Down Expand Up @@ -129,7 +129,7 @@ async def fetch_customers(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.customer.search(
Expand Down Expand Up @@ -163,7 +163,7 @@ async def fetch_credit_card_verifications(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.verification.search(
Expand Down Expand Up @@ -197,7 +197,7 @@ async def fetch_subscriptions(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.subscription.search(
Expand Down Expand Up @@ -234,7 +234,7 @@ async def fetch_disputes(
# The start date must be shifted back 1 day since we have to query Braintree using the received_date field,
# which is less granular than the created_at cursor field (date vs. datetime).
start = log_cursor - timedelta(days=1)
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.dispute.search(
Expand Down
4 changes: 2 additions & 2 deletions source-braintree-native/source_braintree_native/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class Advanced(BaseModel):
default=False,
)
window_size: Annotated[int, Field(
description="Window size in days for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
description="Window size in hours for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
title="Window Size",
default=15,
default=24,
gt=0,
)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"type": "boolean"
},
"window_size": {
"default": 15,
"description": "Window size in days for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
"default": 24,
"description": "Window size in hours for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
"exclusiveMinimum": 0,
"title": "Window Size",
"type": "integer"
Expand Down
Loading