Skip to content

Commit

Permalink
[ISSUE #32871] integration tests for UpdatedCursorIncrementalStripeLa… (
Browse files Browse the repository at this point in the history
  • Loading branch information
maxi297 committed Jan 4, 2024
1 parent f53ecac commit 8c499e5
Show file tree
Hide file tree
Showing 7 changed files with 1,217 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ class StripeRequestBuilder:
def application_fees_endpoint(cls, account_id: str, client_secret: str) -> "StripeRequestBuilder":
return cls("application_fees", account_id, client_secret)

@classmethod
def application_fees_refunds_endpoint(cls, application_fee_id: str, account_id: str, client_secret: str) -> "StripeRequestBuilder":
return cls(f"application_fees/{application_fee_id}/refunds", account_id, client_secret)

@classmethod
def customers_endpoint(cls, account_id: str, client_secret: str) -> "StripeRequestBuilder":
return cls("customers", account_id, client_secret)

@classmethod
def customers_sources_endpoint(cls, customer_id: str, account_id: str, client_secret: str) -> "StripeRequestBuilder":
# FIXME this endpoint is not available in the documentation and stripe mentions explicitly that the sources API is deprecated
# (see https://stripe.com/docs/sources/customers and https://github.com/airbytehq/airbyte/issues/33714)
return cls(f"customers/{customer_id}/sources", account_id, client_secret)

@classmethod
def events_endpoint(cls, account_id: str, client_secret: str) -> "StripeRequestBuilder":
return cls("events", account_id, client_secret)
Expand Down Expand Up @@ -60,6 +74,7 @@ def __init__(self, resource: str, account_id: str, client_secret: str) -> None:
self._object: Optional[str] = None
self._starting_after_id: Optional[str] = None
self._types: List[str] = []
self._expands: List[str] = []

def with_created_gte(self, created_gte: datetime) -> "StripeRequestBuilder":
self._created_gte = created_gte
Expand Down Expand Up @@ -89,6 +104,10 @@ def with_types(self, types: List[str]) -> "StripeRequestBuilder":
self._types = types
return self

def with_expands(self, expands: List[str]) -> "StripeRequestBuilder":
self._expands = expands
return self

def build(self) -> HttpRequest:
query_params = {}
if self._created_gte:
Expand All @@ -103,6 +122,8 @@ def build(self) -> HttpRequest:
query_params["types[]"] = self._types
if self._object:
query_params["object"] = self._object
if self._expands:
query_params["expand[]"] = self._expands

if self._any_query_params:
if query_params:
Expand Down

0 comments on commit 8c499e5

Please sign in to comment.