Skip to content

Commit

Permalink
🐛Source Stripe: update endpoint for bank_accounts stream (#33926)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Karpets committed Jan 8, 2024
1 parent 7503dc7 commit c6e10a7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ acceptance_tests:
- name: "application_fees"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "application_fees_refunds"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "authorizations"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "bank_accounts"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "cards"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "early_fraud_warnings"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "external_account_bank_accounts"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "external_account_cards"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "payment_methods"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "persons"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "reviews"
bypass_reason: "this stream can't be seeded in our sandbox account"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "transactions"
bypass_reason: "This stream can't be seeded in our sandbox account"
- name: "events"
Expand Down Expand Up @@ -84,6 +84,16 @@ acceptance_tests:
invoice_line_items:
- name: margins
bypass_reason: "API randomly returns this field"
subscriptions:
- name: current_period_start
bypass_reason: "Frequently changing data"
- name: current_period_end
bypass_reason: "Frequently changing data"
- name: latest_invoice
bypass_reason: "Frequently changing data"
customers:
- name: next_invoice_sequence
bypass_reason: "Frequently changing data"
incremental:
tests:
- config_path: "secrets/config.json"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: e094cb9a-26de-4645-8761-65c0c425d1de
dockerImageTag: 5.1.0
dockerImageTag: 5.1.1
dockerRepository: airbyte/source-stripe
documentationUrl: https://docs.airbyte.com/integrations/sources/stripe
githubIssueLabel: source-stripe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"account_holder_type": {
"type": ["null", "string"]
},
"account_type": {
"type": ["null", "string"]
},
"bank_name": {
"type": ["null", "string"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,11 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
),
UpdatedCursorIncrementalStripeLazySubStream(
name="bank_accounts",
path=lambda self, stream_slice, *args, **kwargs: f"customers/{stream_slice['parent']['id']}/sources",
path=lambda self, stream_slice, *args, **kwargs: f"customers/{stream_slice['parent']['id']}/bank_accounts",
parent=self.customers(expand_items=["data.sources"], **args),
event_types=["customer.source.created", "customer.source.expiring", "customer.source.updated", "customer.source.deleted"],
legacy_cursor_field=None,
sub_items_attr="sources",
extra_request_params={"object": "bank_account"},
response_filter=lambda record: record["object"] == "bank_account",
**args,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def parse_response(self, response: requests.Response, *args, **kwargs) -> Iterab
# as the events API does not support expandable items. Parent class will try getting sub-items from this object,
# then from its own API. In case there are no sub-items at all for this entity, API will raise 404 error.
self.logger.warning(
"Data was not found for URL: {response.request.url}. "
f"Data was not found for URL: {response.request.url}. "
"If this is a path for getting child attributes like /v1/checkout/sessions/<session_id>/line_items when running "
"the incremental sync, you may safely ignore this warning."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,16 @@ def test_request_headers(stream_by_name):
}
],
},
"https://api.stripe.com/v1/customers/cus_HezytZRkaQJC8W/sources?object=bank_account&starting_after=cs_2": {
"https://api.stripe.com/v1/customers/cus_HezytZRkaQJC8W/bank_accounts?starting_after=cs_2": {
"data": [
{
"id": "cs_3",
"object": "card",
},
{
"id": "cs_4",
"object": "bank_account",
},
],
"has_more": False,
"object": "list",
"total_count": 4,
"url": "/v1/customers/cus_HezytZRkaQJC8W/sources",
"url": "/v1/customers/cus_HezytZRkaQJC8W/bank_accounts",
},
},
"bank_accounts",
Expand Down Expand Up @@ -651,7 +646,7 @@ def test_cursorless_incremental_substream(requests_mock, stream_by_name, sync_mo
"has_more": False,
},
)
requests_mock.get("/v1/customers/1/sources", json={"has_more": False, "data": [{"id": 2, "object": "bank_account"}]})
requests_mock.get("/v1/customers/1/bank_accounts", json={"has_more": False, "data": [{"id": 2, "object": "bank_account"}]})
requests_mock.get(
"/v1/events",
json={
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/stripe.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Each record is marked with `is_deleted` flag when the appropriate event happens

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 5.1.1 | 2024-01-04 | [33926](https://github.com/airbytehq/airbyte/pull/33926/) | Update endpoint for `bank_accounts` stream |
| 5.1.0 | 2023-12-11 | [32908](https://github.com/airbytehq/airbyte/pull/32908/) | Read full refresh streams concurrently |
| 5.0.2 | 2023-12-01 | [33038](https://github.com/airbytehq/airbyte/pull/33038) | Add stream slice logging for SubStream |
| 5.0.1 | 2023-11-17 | [32638](https://github.com/airbytehq/airbyte/pull/32638/) | Availability stretegy: check availability of both endpoints (if applicable) - common API + events API |
Expand Down

0 comments on commit c6e10a7

Please sign in to comment.